diff options
Diffstat (limited to 'indra/newview/llweb.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/newview/llweb.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp index 83337b386d..0be6e49834 100644..100755 --- a/indra/newview/llweb.cpp +++ b/indra/newview/llweb.cpp @@ -49,6 +49,10 @@ #include "llviewerregion.h" #include "llviewerwindow.h" #include "llnotificationsutil.h" +#include "lluriparser.h" +#include "uriparser/Uri.h" + +#include <boost/regex.hpp> bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async ); @@ -87,7 +91,8 @@ void LLWeb::loadURL(const std::string& url, const std::string& target, const std // Force load in the internal browser, as if with a blank target. loadURLInternal(url, "", uuid); } - else if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external")) + + else if (useExternalBrowser(url) || (target == "_external")) { loadURLExternal(url); } @@ -121,7 +126,7 @@ void LLWeb::loadURLExternal(const std::string& url, bool async, const std::strin if(gSavedSettings.getBOOL("DisableExternalBrowser")) { // Don't open an external browser under any circumstances. - llwarns << "Blocked attempt to open external browser." << llendl; + LL_WARNS() << "Blocked attempt to open external browser." << LL_ENDL; return; } @@ -225,3 +230,24 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url, return LLWeb::escapeURL(expanded_url); } + +//static +bool LLWeb::useExternalBrowser(const std::string &url) +{ + if (gSavedSettings.getU32("PreferredBrowserBehavior") == BROWSER_EXTERNAL_ONLY) + { + return true; + } + else if (gSavedSettings.getU32("PreferredBrowserBehavior") == BROWSER_INT_LL_EXT_OTHERS) + { + LLUriParser up(url); + up.normalize(); + up.extractParts(); + std::string uri_string = up.host(); + + boost::regex pattern = boost::regex("\\b(lindenlab.com|secondlife.com)$", boost::regex::perl|boost::regex::icase); + boost::match_results<std::string::const_iterator> matches; + return !(boost::regex_search(uri_string, matches, pattern)); + } + return false; +} |