summaryrefslogtreecommitdiff
path: root/indra/newview/llmediactrl.cpp
diff options
context:
space:
mode:
authorLynx Linden <lynx@lindenlab.com>2010-01-14 11:57:03 +0000
committerLynx Linden <lynx@lindenlab.com>2010-01-14 11:57:03 +0000
commit507ccd52a9d398c76896e38db867716bc2acd7f9 (patch)
treee305d434d502a7d8363f78b2848010c5dfb28114 /indra/newview/llmediactrl.cpp
parentf3bd6481a554ade34b133b2ae805838e27598639 (diff)
EXT-3624: Support "_blank" href target types.
Support href links in web views that have a target attribute set to "_blank". This will open the link in the user's preferred browser (internal or external, as defined in Prefs). This change relies on the new llqtwebkit package that has just been pushed. Also updated the hardcoded Qt version number in the About floater.
Diffstat (limited to 'indra/newview/llmediactrl.cpp')
-rw-r--r--indra/newview/llmediactrl.cpp45
1 files changed, 30 insertions, 15 deletions
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 6b0f9b709d..87ebce1d34 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -84,7 +84,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
mHomePageUrl( "" ),
mIgnoreUIScale( true ),
mAlwaysRefresh( false ),
- mExternalUrl( "" ),
mMediaSource( 0 ),
mTakeFocusOnClick( true ),
mCurrentNavUrl( "" ),
@@ -877,9 +876,27 @@ bool LLMediaCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( 0 == option )
{
- // open in external browser because we don't support
- // creation of our own secondary browser windows
- LLWeb::loadURLExternal( notification["payload"]["external_url"].asString() );
+ LLSD payload = notification["payload"];
+ std::string url = payload["url"].asString();
+ S32 target_type = payload["target_type"].asInteger();
+
+ switch (target_type)
+ {
+ case LLPluginClassMedia::TARGET_EXTERNAL:
+ // load target in an external browser
+ LLWeb::loadURLExternal(url);
+ break;
+
+ case LLPluginClassMedia::TARGET_BLANK:
+ // load target in the user's preferred browser
+ LLWeb::loadURL(url);
+ break;
+
+ default:
+ // unsupported link target - shouldn't happen
+ LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL;
+ break;
+ }
}
return false;
}
@@ -993,20 +1010,18 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self )
{
// retrieve the event parameters
- std::string target = self->getClickTarget();
std::string url = self->getClickURL();
+ U32 target_type = self->getClickTargetType();
- // if there is a value for the target
- if ( !target.empty() )
+ // is there is a target specified for the link?
+ if (target_type == LLPluginClassMedia::TARGET_EXTERNAL ||
+ target_type == LLPluginClassMedia::TARGET_BLANK)
{
- if ( target == "_external" )
- {
- mExternalUrl = url;
- LLSD payload;
- payload["external_url"] = mExternalUrl;
- LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
- return;
- }
+ LLSD payload;
+ payload["url"] = url;
+ payload["target_type"] = LLSD::Integer(target_type);
+ LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
+ return;
}
const std::string protocol1( "http://" );