summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndreyL ProductEngine <andreylproductengine@lindenlab.com>2014-06-23 23:16:36 +0300
committerAndreyL ProductEngine <andreylproductengine@lindenlab.com>2014-06-23 23:16:36 +0300
commita23ec5ffa84c1122af3cbb416363a0eb564ad65c (patch)
treeb8541c3c5266028ef57add9749d80668838ea6d0 /indra
parente5b930c92a4ece0ca6c830c21b4b321833d9239f (diff)
MAINT-4127: New default mode when clicking links: Linden links open in viewer, third-party links open in user's browser
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/app_settings/settings.xml13
-rwxr-xr-xindra/newview/llviewermenu.cpp4
-rwxr-xr-xindra/newview/llweb.cpp21
-rwxr-xr-xindra/newview/llweb.h8
-rwxr-xr-xindra/newview/skins/default/xui/en/panel_preferences_setup.xml44
5 files changed, 85 insertions, 5 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 2e49357d6f..b92751c448 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -13256,7 +13256,7 @@
<key>Value</key>
<string>Default</string>
</map>
- <key>UseExternalBrowser</key>
+ <key>UseExternalBrowser</key> <!-- deprecated (see MAINT-4127) -->
<map>
<key>Comment</key>
<string>Use default browser when opening web pages instead of in-world browser.</string>
@@ -13267,6 +13267,17 @@
<key>Value</key>
<boolean>1</boolean>
</map>
+ <key>PreferredBrowserBehavior</key>
+ <map>
+ <key>Comment</key>
+ <string>Use system browser for any links (0), use builtin browser for SL links and system one for others (1) or use builtin browser only (2).</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
<key>UseFreezeFrame</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 8b9b9ed172..01e6c8a5d0 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6196,7 +6196,7 @@ class LLPromptShowURL : public view_listener_t
std::string alert = param.substr(0, offset);
std::string url = param.substr(offset+1);
- if(gSavedSettings.getBOOL("UseExternalBrowser"))
+ if (LLWeb::useExternalBrowser(url))
{
LLSD payload;
payload["url"] = url;
@@ -7816,7 +7816,7 @@ void handle_web_content_test(const LLSD& param)
void handle_show_url(const LLSD& param)
{
std::string url = param.asString();
- if(gSavedSettings.getBOOL("UseExternalBrowser"))
+ if (LLWeb::useExternalBrowser(url))
{
LLWeb::loadURLExternal(url);
}
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 665671a38f..0312972a22 100755
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -50,6 +50,8 @@
#include "llviewerwindow.h"
#include "llnotificationsutil.h"
+#include <boost/regex.hpp>
+
bool on_load_url_external_response(const LLSD& notification, const LLSD& response, bool async );
@@ -87,7 +89,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);
}
@@ -225,3 +228,19 @@ 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)
+ {
+ boost::regex pattern = boost::regex("\\b(lindenlab.com|secondlife.com)\\b", boost::regex::perl|boost::regex::icase);
+ boost::match_results<std::string::const_iterator> matches;
+ return !(boost::regex_search(url, matches, pattern));
+ }
+ return false;
+}
diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h
index 0b95f664d6..7c90badbfe 100755
--- a/indra/newview/llweb.h
+++ b/indra/newview/llweb.h
@@ -40,6 +40,13 @@
class LLWeb
{
public:
+ enum PreferredBrowser
+ {
+ BROWSER_EXTERNAL_ONLY = 0,
+ BROWSER_INT_LL_EXT_OTHERS = 1,
+ BROWSER_INTERNAL_ONLY = 2
+ };
+
static void initClass();
/// Load the given url in the operating system's web browser, async if we want to return immediately
@@ -57,6 +64,7 @@ public:
/// Expands various strings like [LANG], [VERSION], etc. in a URL
static std::string expandURLSubstitutions(const std::string &url,
const LLSD &default_subs);
+ static bool useExternalBrowser(const std::string &url);
};
#endif
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index dd4533ae74..1e9a1aa27c 100755
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -106,7 +106,7 @@
width="300">
Web:
</text>
- <radio_group
+ <!-- <radio_group
control_name="UseExternalBrowser"
draw_border="false"
follows="top|left"
@@ -136,6 +136,48 @@
tool_tip="Use the built-in web browser for help, web links, etc. This browser opens as a new window inside [APP_NAME]."
top_delta="20"
width="480" />
+ </radio_group> -->
+
+ <radio_group
+ control_name="PreferredBrowserBehavior"
+ draw_border="false"
+ follows="left|top"
+ height="60"
+ layout="topleft"
+ left_delta="50"
+ name="preferred_browser_behavior"
+ top_pad="0"
+ width="480">
+ <radio_item
+ height="20"
+ label="Use my browser (Chrome, Firefox, IE) for all links"
+ layout="topleft"
+ left="0"
+ name="internal"
+ value="0"
+ tool_tip="Use the default system web browser for help, web links, etc. Not recommended if running full screen."
+ top="0"
+ width="480" />
+ <radio_item
+ height="20"
+ label="Use built-in browser for Second Life links only"
+ layout="topleft"
+ left_delta="0"
+ name="external"
+ value="1"
+ tool_tip="Use the default system web browser for help, web links, etc. Builtin browser will be used only for LindenLab/SecondLife links."
+ top_delta="20"
+ width="480" />
+ <radio_item
+ height="20"
+ label="Use built-in browser for all links"
+ layout="topleft"
+ left="0"
+ name="internal"
+ value="2"
+ tool_tip="Use the built-in web browser for help, web links, etc. This browser opens as a new window inside [APP_NAME]."
+ top_delta="20"
+ width="480" />
</radio_group>
<check_box