diff options
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llfloaterhud.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llmediactrl.cpp | 106 | ||||
-rw-r--r-- | indra/newview/llmediactrl.h | 9 | ||||
-rw-r--r-- | indra/newview/llpanellogin.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 61 | ||||
-rw-r--r-- | indra/newview/llviewermedia.h | 2 |
7 files changed, 71 insertions, 134 deletions
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 47766a24cb..0cd6e48d14 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -297,11 +297,17 @@ private: // append details to agent string LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent ); + // TODO: Remove this ifdef when the Linux version of llqtwebkit gets updated with the new WOB constant. +#if !LL_LINUX + // Set up window open behavior + LLQtWebKit::getInstance()->setWindowOpenBehavior(mBrowserWindowId, LLQtWebKit::WOB_SIMULATE_BLANK_HREF_CLICK); +#endif + #if !LL_QTWEBKIT_USES_PIXMAPS // don't flip bitmap LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true ); #endif // !LL_QTWEBKIT_USES_PIXMAPS - + // set background color // convert background color channels from [0.0, 1.0] to [0, 255]; LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) ); diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp index d2ee3e44c5..930bbe9e6b 100644 --- a/indra/newview/llfloaterhud.cpp +++ b/indra/newview/llfloaterhud.cpp @@ -79,9 +79,6 @@ BOOL LLFloaterHUD::postBuild() mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" ); if (mWebBrowser) { - // Open links in internal browser - mWebBrowser->setOpenInExternalBrowser(false); - // This is a "chrome" floater, so we don't want anything to // take focus (as the user needs to be able to walk with // arrow keys during tutorial). diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 05cb6ddc4a..7a4ed74c4c 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -78,8 +78,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : mBorder(NULL), mFrequentUpdates( true ), mForceUpdate( false ), - mOpenLinksInExternalBrowser( false ), - mOpenLinksInInternalBrowser( false ), mHomePageUrl( "" ), mTrusted(false), mIgnoreUIScale( true ), @@ -167,20 +165,6 @@ void LLMediaCtrl::setTakeFocusOnClick( bool take_focus ) } //////////////////////////////////////////////////////////////////////////////// -// set flag that forces the embedded browser to open links in the external system browser -void LLMediaCtrl::setOpenInExternalBrowser( bool valIn ) -{ - mOpenLinksInExternalBrowser = valIn; -}; - -//////////////////////////////////////////////////////////////////////////////// -// set flag that forces the embedded browser to open links in the internal browser floater -void LLMediaCtrl::setOpenInInternalBrowser( bool valIn ) -{ - mOpenLinksInInternalBrowser = valIn; -}; - -//////////////////////////////////////////////////////////////////////////////// void LLMediaCtrl::setTrusted( bool valIn ) { if(mMediaSource) @@ -944,7 +928,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) case MEDIA_EVENT_CLICK_LINK_HREF: { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL; - onClickLinkHref(self); }; break; @@ -979,95 +962,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) //////////////////////////////////////////////////////////////////////////////// // -void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self ) -{ - // retrieve the event parameters - std::string url = self->getClickURL(); - U32 target_type = self->getClickTargetType(); - - // is there is a target specified for the link? - if (target_type == LLPluginClassMedia::TARGET_EXTERNAL || - target_type == LLPluginClassMedia::TARGET_BLANK ) - { - if (gSavedSettings.getBOOL("UseExternalBrowser")) - { - LLSD payload; - payload["url"] = url; - payload["target_type"] = LLSD::Integer(target_type); - LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget); - } - else - { - clickLinkWithTarget(url, target_type); - } - } - else { - const std::string protocol1( "http://" ); - const std::string protocol2( "https://" ); - if( mOpenLinksInExternalBrowser ) - { - if ( !url.empty() ) - { - if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 || - LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 ) - { - LLWeb::loadURLExternal( url ); - } - } - } - else - if( mOpenLinksInInternalBrowser ) - { - if ( !url.empty() ) - { - if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 || - LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 ) - { - llwarns << "Dead, unimplemented path that we used to send to the built-in browser long ago." << llendl; - } - } - } - } -} - -//////////////////////////////////////////////////////////////////////////////// -// static -bool LLMediaCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response ) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if ( 0 == option ) - { - LLSD payload = notification["payload"]; - std::string url = payload["url"].asString(); - S32 target_type = payload["target_type"].asInteger(); - clickLinkWithTarget(url, target_type); - } - return false; -} - - -//////////////////////////////////////////////////////////////////////////////// -// static -void LLMediaCtrl::clickLinkWithTarget(const std::string& url, const S32& target_type ) -{ - if (target_type == LLPluginClassMedia::TARGET_EXTERNAL) - { - // load target in an external browser - LLWeb::loadURLExternal(url); - } - else if (target_type == LLPluginClassMedia::TARGET_BLANK) - { - // load target in the user's preferred browser - LLWeb::loadURL(url); - } - else { - // unsupported link target - shouldn't happen - LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL; - } -} - -//////////////////////////////////////////////////////////////////////////////// -// std::string LLMediaCtrl::getCurrentNavUrl() { return mCurrentNavUrl; diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h index e55d2f7cd0..310492fe02 100644 --- a/indra/newview/llmediactrl.h +++ b/indra/newview/llmediactrl.h @@ -99,8 +99,6 @@ public: void navigateToLocalPage( const std::string& subdir, const std::string& filename_in ); bool canNavigateBack(); bool canNavigateForward(); - void setOpenInExternalBrowser( bool valIn ); - void setOpenInInternalBrowser( bool valIn ); std::string getCurrentNavUrl(); // By default, we do not handle "secondlife:///app/" SLURLs, because @@ -162,24 +160,17 @@ public: // Incoming media event dispatcher virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); - // handlers for individual events (could be done inside the switch in handleMediaEvent, they're just individual functions for clarity) - void onClickLinkHref( LLPluginClassMedia* self ); - protected: void convertInputCoords(S32& x, S32& y); private: void onVisibilityChange ( const LLSD& new_visibility ); - static bool onClickLinkExternalTarget( const LLSD&, const LLSD& ); - static void clickLinkWithTarget(const std::string& url, const S32& target_type ); const S32 mTextureDepthBytes; LLUUID mMediaTextureID; LLViewBorder* mBorder; bool mFrequentUpdates; bool mForceUpdate; - bool mOpenLinksInExternalBrowser; - bool mOpenLinksInInternalBrowser; bool mTrusted; std::string mHomePageUrl; std::string mCurrentNavUrl; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 508a58e74f..0009f7203a 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -270,20 +270,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, web_browser->setTabStop(FALSE); // web_browser->navigateToLocalPage( "loading", "loading.html" ); - if (gSavedSettings.getBOOL("RegInClient")) - { - // need to follow links in the internal browser - web_browser->setOpenInExternalBrowser( false ); - - getChild<LLView>("login_widgets")->setVisible(false); - } - else - { - // make links open in external browser - web_browser->setOpenInExternalBrowser( true ); - - reshapeBrowser(); - } + reshapeBrowser(); // kick off a request to grab the url manually gResponsePtr = LLIamHereLogin::build( this ); @@ -487,7 +474,6 @@ void LLPanelLogin::showLoginWidgets() { sInstance->childSetVisible("login_widgets", true); LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html"); - web_browser->setOpenInExternalBrowser( true ); sInstance->reshapeBrowser(); // *TODO: Append all the usual login parameters, like first_login=Y etc. std::string splash_screen_url = sInstance->getString("real_url"); diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 4db05e8a98..7429a49ccf 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -2795,6 +2795,42 @@ bool LLViewerMediaImpl::isPlayable() const return false; } +//////////////////////////////////////////////////////////////////////////////// +// static +bool LLViewerMediaImpl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response ) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if ( 0 == option ) + { + LLSD payload = notification["payload"]; + std::string url = payload["url"].asString(); + S32 target_type = payload["target_type"].asInteger(); + clickLinkWithTarget(url, target_type); + } + return false; +} + + +//////////////////////////////////////////////////////////////////////////////// +// static +void LLViewerMediaImpl::clickLinkWithTarget(const std::string& url, const S32& target_type ) +{ + if (target_type == LLPluginClassMedia::TARGET_EXTERNAL) + { + // load target in an external browser + LLWeb::loadURLExternal(url); + } + else if (target_type == LLPluginClassMedia::TARGET_BLANK) + { + // load target in the user's preferred browser + LLWeb::loadURL(url); + } + else { + // unsupported link target - shouldn't happen + LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL; + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent event) { @@ -2808,6 +2844,31 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla } break; + case MEDIA_EVENT_CLICK_LINK_HREF: + { + 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(); + U32 target_type = plugin->getClickTargetType(); + + // is there is a target specified for the link? + if (target_type == LLPluginClassMedia::TARGET_EXTERNAL || + target_type == LLPluginClassMedia::TARGET_BLANK ) + { + if (gSavedSettings.getBOOL("UseExternalBrowser")) + { + LLSD payload; + payload["url"] = url; + payload["target_type"] = LLSD::Integer(target_type); + LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget); + } + else + { + clickLinkWithTarget(url, target_type); + } + } + }; + break; case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH: { // The plugin failed to load properly. Make sure the timer doesn't retry. diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index 8626f4469e..754d0851c3 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -391,6 +391,8 @@ private: bool shouldShowBasedOnClass() const; static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj); static bool isObjectInAgentParcel(LLVOVolume *obj); + static bool onClickLinkExternalTarget( const LLSD&, const LLSD& ); + static void clickLinkWithTarget(const std::string& url, const S32& target_type ); private: // a single media url with some data and an impl. |