summaryrefslogtreecommitdiff
path: root/indra/newview/llweb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llweb.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llweb.cpp68
1 files changed, 36 insertions, 32 deletions
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index b73017a51a..0be6e49834 100644..100755
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -34,7 +34,6 @@
#include "llagent.h"
#include "llappviewer.h"
-#include "llfloatermediabrowser.h"
#include "llfloaterwebcontent.h"
#include "llfloaterreg.h"
#include "lllogininstance.h"
@@ -50,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 );
@@ -78,6 +81,8 @@ void LLWeb::initClass()
}
+
+
// static
void LLWeb::loadURL(const std::string& url, const std::string& target, const std::string& uuid)
{
@@ -86,55 +91,32 @@ 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"))
- {
- loadURLExternal(url);
- }
- else
- {
- loadURLInternal(url, target, uuid);
- }
-}
-// static
-void LLWeb::loadWebURL(const std::string& url, const std::string& target, const std::string& uuid)
-{
- if(target == "_internal")
- {
- // Force load in the internal browser, as if with a blank target.
- loadWebURLInternal(url, "", uuid);
- }
- else if (gSavedSettings.getBOOL("UseExternalBrowser") || (target == "_external"))
+ else if (useExternalBrowser(url) || (target == "_external"))
{
loadURLExternal(url);
}
else
{
- loadWebURLInternal(url, target, uuid);
+ loadURLInternal(url, target, uuid);
}
}
// static
-void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
-{
- LLFloaterMediaBrowser::create(url, target, uuid);
-}
-
-// static
// Explicitly open a Web URL using the Web content floater
-void LLWeb::loadWebURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
+void LLWeb::loadURLInternal(const std::string &url, const std::string& target, const std::string& uuid)
{
- LLFloaterWebContent::create(url, target, uuid);
+ LLFloaterWebContent::Params p;
+ p.url(url).target(target).id(uuid);
+ LLFloaterReg::showInstance("web_content", p);
}
-
// static
void LLWeb::loadURLExternal(const std::string& url, const std::string& uuid)
{
loadURLExternal(url, true, uuid);
}
-
// static
void LLWeb::loadURLExternal(const std::string& url, bool async, const std::string& uuid)
{
@@ -144,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;
}
@@ -208,7 +190,8 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
substitution["VERSION_PATCH"] = LLVersionInfo::getPatch();
substitution["VERSION_BUILD"] = LLVersionInfo::getBuild();
substitution["CHANNEL"] = LLVersionInfo::getChannel();
- substitution["GRID"] = LLGridManager::getInstance()->getGridLabel();
+ substitution["GRID"] = LLGridManager::getInstance()->getGridId();
+ substitution["GRID_LOWERCASE"] = utf8str_tolower(LLGridManager::getInstance()->getGridId());
substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
substitution["SESSION_ID"] = gAgent.getSessionID();
substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
@@ -247,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;
+}