summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatermediabrowser.cpp30
-rw-r--r--indra/newview/llfloatermediabrowser.h3
-rw-r--r--indra/newview/llviewermedia.cpp17
-rw-r--r--indra/newview/llweb.cpp10
-rw-r--r--indra/newview/llweb.h9
-rw-r--r--indra/newview/skins/default/xui/en/floater_media_browser.xml2
6 files changed, 43 insertions, 28 deletions
diff --git a/indra/newview/llfloatermediabrowser.cpp b/indra/newview/llfloatermediabrowser.cpp
index 5405de2f9a..c38ef0c014 100644
--- a/indra/newview/llfloatermediabrowser.cpp
+++ b/indra/newview/llfloatermediabrowser.cpp
@@ -63,6 +63,30 @@ LLFloaterMediaBrowser::LLFloaterMediaBrowser(const LLSD& key)
}
+//static
+void LLFloaterMediaBrowser::create(const std::string &url, const std::string& target)
+{
+ std::string tag = target;
+
+ if(target.empty() || target == "_blank")
+ {
+ // create a unique tag for this instance
+ LLUUID id;
+ id.generate();
+ tag = id.asString();
+ }
+
+ // TODO: Figure out whether we need to close an existing instance and/or warn the user about the number of instances they have open
+
+ LLFloaterMediaBrowser *browser = dynamic_cast<LLFloaterMediaBrowser*> (LLFloaterReg::showInstance("media_browser", tag));
+ llassert(browser);
+ if(browser)
+ {
+ // tell the browser instance to load the specified URL
+ browser->openMedia(url);
+ }
+}
+
void LLFloaterMediaBrowser::draw()
{
getChildView("go")->setEnabled(!mAddressCombo->getValue().asString().empty());
@@ -197,12 +221,6 @@ void LLFloaterMediaBrowser::setCurrentURL(const std::string& url)
getChildView("reload")->setEnabled(TRUE);
}
-void LLFloaterMediaBrowser::onOpen(const LLSD& media_url)
-{
- LLFloater::onOpen(media_url);
- openMedia(media_url.asString());
-}
-
//static
void LLFloaterMediaBrowser::onEnterAddress(LLUICtrl* ctrl, void* user_data)
{
diff --git a/indra/newview/llfloatermediabrowser.h b/indra/newview/llfloatermediabrowser.h
index c315f9e797..1645ed4613 100644
--- a/indra/newview/llfloatermediabrowser.h
+++ b/indra/newview/llfloatermediabrowser.h
@@ -47,10 +47,11 @@ class LLFloaterMediaBrowser :
public:
LLFloaterMediaBrowser(const LLSD& key);
+ static void create(const std::string &url, const std::string& target);
+
/*virtual*/ BOOL postBuild();
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void draw();
- /*virtual*/ void onOpen(const LLSD& key);
// inherited from LLViewerMediaObserver
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 77f7740449..7a17bfeb46 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2826,25 +2826,18 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL;
// retrieve the event parameters
std::string url = plugin->getClickURL();
+ std::string target = plugin->getClickTarget();
U32 target_type = plugin->getClickTargetType();
-
+
switch (target_type)
{
- case LLPluginClassMedia::TARGET_EXTERNAL:
- // force url to external browser
- LLWeb::loadURLExternal(url);
- break;
- case LLPluginClassMedia::TARGET_BLANK:
- // open in SL media browser or external browser based on user pref
- LLWeb::loadURL(url);
- break;
case LLPluginClassMedia::TARGET_NONE:
// ignore this click and let media plugin handle it
break;
- case LLPluginClassMedia::TARGET_OTHER:
- LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL;
+ default:
+ // loadURL now handles distinguishing between _blank, _external, and other named targets.
+ LLWeb::loadURL(url, target);
break;
- default: break;
}
};
break;
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 5c9633c036..b61109d490 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -84,23 +84,23 @@ void LLWeb::initClass()
// static
-void LLWeb::loadURL(const std::string& url)
+void LLWeb::loadURL(const std::string& url, const std::string& target)
{
- if (gSavedSettings.getBOOL("UseExternalBrowser"))
+ if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external"))
{
loadURLExternal(url);
}
else
{
- loadURLInternal(url);
+ loadURLInternal(url, target);
}
}
// static
-void LLWeb::loadURLInternal(const std::string &url)
+void LLWeb::loadURLInternal(const std::string &url, const std::string& target)
{
- LLFloaterReg::showInstance("media_browser", url);
+ LLFloaterMediaBrowser::create(url, target);
}
diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h
index 1119b80bb4..20c7391dbf 100644
--- a/indra/newview/llweb.h
+++ b/indra/newview/llweb.h
@@ -49,11 +49,14 @@ public:
static void initClass();
/// Load the given url in the user's preferred web browser
- static void loadURL(const std::string& url);
+ static void loadURL(const std::string& url, const std::string& target);
+ static void loadURL(const std::string& url) { loadURL(url, LLStringUtil::null); }
/// Load the given url in the user's preferred web browser
- static void loadURL(const char* url) { loadURL( ll_safe_string(url) ); }
+ static void loadURL(const char* url, const std::string& target) { loadURL( ll_safe_string(url), target); }
+ static void loadURL(const char* url) { loadURL( ll_safe_string(url), LLStringUtil::null ); }
/// Load the given url in the Second Life internal web browser
- static void loadURLInternal(const std::string &url);
+ static void loadURLInternal(const std::string &url, const std::string& target);
+ static void loadURLInternal(const std::string &url) { loadURLInternal(url, LLStringUtil::null); }
/// Load the given url in the operating system's web browser, async if we want to return immediately
/// before browser has spawned
static void loadURLExternal(const std::string& url);
diff --git a/indra/newview/skins/default/xui/en/floater_media_browser.xml b/indra/newview/skins/default/xui/en/floater_media_browser.xml
index c02d607586..18f3b9ab06 100644
--- a/indra/newview/skins/default/xui/en/floater_media_browser.xml
+++ b/indra/newview/skins/default/xui/en/floater_media_browser.xml
@@ -9,7 +9,7 @@
name="floater_about"
help_topic="floater_about"
save_rect="true"
- single_instance="true"
+ auto_tile="true"
title="MEDIA BROWSER"
width="820">
<floater.string