|
|
|
|
@ -869,38 +869,6 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y)
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// inherited from LLViewerMediaObserver
|
|
|
|
|
//virtual
|
|
|
|
|
@ -1014,40 +982,79 @@ void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self )
|
|
|
|
|
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") || target_type == LLPluginClassMedia::TARGET_EXTERNAL)
|
|
|
|
|
{
|
|
|
|
|
LLSD payload;
|
|
|
|
|
payload["url"] = url;
|
|
|
|
|
payload["target_type"] = LLSD::Integer(target_type);
|
|
|
|
|
LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if (target_type == LLPluginClassMedia::TARGET_BLANK)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::string protocol1( "http://" );
|
|
|
|
|
const std::string protocol2( "https://" );
|
|
|
|
|
if( mOpenLinksInExternalBrowser )
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// static
|
|
|
|
|
bool LLMediaCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response )
|
|
|
|
|
{
|
|
|
|
|
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
|
|
|
|
if ( 0 == option )
|
|
|
|
|
{
|
|
|
|
|
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 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
LLSD payload = notification["payload"];
|
|
|
|
|
std::string url = payload["url"].asString();
|
|
|
|
|
S32 target_type = payload["target_type"].asInteger();
|
|
|
|
|
clickLinkWithTarget(url, target_type);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if( mOpenLinksInInternalBrowser )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// static
|
|
|
|
|
void LLMediaCtrl::clickLinkWithTarget(const std::string& url, const S32& target_type )
|
|
|
|
|
{
|
|
|
|
|
if (gSavedSettings.getBOOL("UseExternalBrowser") || target_type == LLPluginClassMedia::TARGET_EXTERNAL)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|