diff options
author | Callum Prentice <callum@lindenlab.com> | 2010-03-18 16:53:27 -0700 |
---|---|---|
committer | Callum Prentice <callum@lindenlab.com> | 2010-03-18 16:53:27 -0700 |
commit | cb7fbc8a2093fd1ed5440d0f3184d9080cecad48 (patch) | |
tree | c2c5c95acb4224d12b0a95aa5f52778a31fc4402 | |
parent | fabae99883ff724f0f46336cf787d99997ec9f33 (diff) |
EXT-6466 "Move "Enable Cookies" checkbox...", EXT-6402 "Add feature to disable Web plugins via prefs" and EXT-6401 "Add feature to disable Javascript via prefs"
Apologies for the multiple commit of Jiras - these changes are closely related and impossible to commit deparately
Reviewed by Monroe
-rw-r--r-- | indra/llplugin/llpluginclassmedia.cpp | 15 | ||||
-rw-r--r-- | indra/llplugin/llpluginclassmedia.h | 2 | ||||
-rw-r--r-- | indra/media_plugins/webkit/media_plugin_webkit.cpp | 50 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 22 | ||||
-rw-r--r-- | indra/newview/llviewermedia.cpp | 13 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_privacy.xml | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_setup.xml | 75 | ||||
-rw-r--r-- | install.xml | 4 |
8 files changed, 150 insertions, 40 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index cb62e46271..bf0e19473e 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -696,6 +696,20 @@ void LLPluginClassMedia::setLanguageCode(const std::string &language_code) sendMessage(message); } +void LLPluginClassMedia::setPluginsEnabled(const bool enabled) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "plugins_enabled"); + message.setValueBoolean("enable", enabled); + sendMessage(message); +} + +void LLPluginClassMedia::setJavascriptEnabled(const bool enabled) +{ + LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "javascript_enabled"); + message.setValueBoolean("enable", enabled); + sendMessage(message); +} + LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) { // convert a LinkTargetType value from llqtwebkit to an ETargetType @@ -1065,6 +1079,7 @@ void LLPluginClassMedia::clear_cookies() void LLPluginClassMedia::enable_cookies(bool enable) { LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "enable_cookies"); + message.setValueBoolean("enable", enable); sendMessage(message); } diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h index 6318c67f12..79356beb68 100644 --- a/indra/llplugin/llpluginclassmedia.h +++ b/indra/llplugin/llpluginclassmedia.h @@ -179,6 +179,8 @@ public: // These can be called before init(), and they will be queued and sent before the media init message. void setUserDataPath(const std::string &user_data_path); void setLanguageCode(const std::string &language_code); + void setPluginsEnabled(const bool enabled); + void setJavascriptEnabled(const bool enabled); /////////////////////////////////// // media browser class functions diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 24c53638d2..0462fce236 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -89,6 +89,9 @@ private: std::string mProfileDir; std::string mHostLanguage; + bool mCookiesEnabled; + bool mJavascriptEnabled; + bool mPluginsEnabled; enum { @@ -277,21 +280,18 @@ private: { LLQtWebKit::getInstance()->setHostLanguage(mHostLanguage); } + + // turn on/off cookies based on what host app tells us + LLQtWebKit::getInstance()->enableCookies( mCookiesEnabled ); + + // turn on/off plugins based on what host app tells us + LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled ); + + // turn on/off Javascript based on what host app tells us + LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); // create single browser window mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight ); -#if LL_WINDOWS - // Enable plugins - LLQtWebKit::getInstance()->enablePlugins(true); -#elif LL_DARWIN - // Enable plugins - LLQtWebKit::getInstance()->enablePlugins(true); -#elif LL_LINUX - // Enable plugins - LLQtWebKit::getInstance()->enablePlugins(true); -#endif - // Enable cookies - LLQtWebKit::getInstance()->enableCookies( true ); // tell LLQtWebKit about the size of the browser window LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight ); @@ -671,6 +671,10 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction host_ mBackgroundR = 0.0f; mBackgroundG = 0.0f; mBackgroundB = 0.0f; + + mHostLanguage = "en"; // default to english + mJavascriptEnabled = true; // default to on + mPluginsEnabled = true; // default to on } MediaPluginWebKit::~MediaPluginWebKit() @@ -825,6 +829,14 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) // FIXME: Should we do anything with this if it comes in after the browser has been initialized? } + else if(message_name == "plugins_enabled") + { + mPluginsEnabled = message_in.getValueBoolean("enable"); + } + else if(message_name == "javascript_enabled") + { + mJavascriptEnabled = message_in.getValueBoolean("enable"); + } else if(message_name == "size_change") { std::string name = message_in.getValue("name"); @@ -1026,8 +1038,18 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) } else if(message_name == "enable_cookies") { - bool val = message_in.getValueBoolean("enable"); - LLQtWebKit::getInstance()->enableCookies( val ); + mCookiesEnabled = message_in.getValueBoolean("enable"); + LLQtWebKit::getInstance()->enableCookies( mCookiesEnabled ); + } + else if(message_name == "enable_plugins") + { + mPluginsEnabled = message_in.getValueBoolean("enable"); + LLQtWebKit::getInstance()->enablePlugins( mPluginsEnabled ); + } + else if(message_name == "enable_javascript") + { + mJavascriptEnabled = message_in.getValueBoolean("enable"); + //LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled ); } else if(message_name == "proxy_setup") { diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 8edf766132..f8d556bb80 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1563,6 +1563,28 @@ <key>Value</key> <integer>1</integer> </map> + <key>BrowserJavascriptEnabled</key> + <map> + <key>Comment</key> + <string>Enable Javascript in the built-in Web browser?</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>BrowserPluginsEnabled</key> + <map> + <key>Comment</key> + <string>Enable Web plugins in the built-in Web browser?</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>CreateToolCopyCenters</key> <map> <key>Comment</key> diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index b9509a98f5..99bfad9b45 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1260,6 +1260,19 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_ media_source->setSize(default_width, default_height); media_source->setUserDataPath(user_data_path); media_source->setLanguageCode(LLUI::getLanguage()); + + // collect 'cookies enabled' setting from prefs and send to embedded browser + bool cookies_enabled = gSavedSettings.getBOOL( "CookiesEnabled" ); + media_source->enable_cookies( cookies_enabled ); + + // collect 'plugins enabled' setting from prefs and send to embedded browser + bool plugins_enabled = gSavedSettings.getBOOL( "BrowserPluginsEnabled" ); + media_source->setPluginsEnabled( plugins_enabled ); + + // collect 'javascript enabled' setting from prefs and send to embedded browser + bool javascript_enabled = gSavedSettings.getBOOL( "BrowserJavascriptEnabled" ); + media_source->setJavascriptEnabled( javascript_enabled ); + if (media_source->init(launcher_name, plugin_name, gSavedSettings.getBOOL("PluginAttachDebuggerToPlugins"))) { return media_source; diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml index f232a69482..3d7f392404 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml @@ -69,15 +69,6 @@ name="auto_disengage_mic_check" top_pad="10" width="350" /> - <check_box - control_name="CookiesEnabled" - height="16" - label="Accept cookies" - layout="topleft" - left="30" - name="cookies_enabled" - top_pad="10" - width="350" /> <text type="string" length="1" 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 fe882730f4..96b9b459dd 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml @@ -265,35 +265,80 @@ layout="topleft" left_delta="50" name="use_external_browser" - top_pad="4" + top_pad="-2" width="480"> <radio_item height="20" - label="Use built-in browser" - layout="topleft" - left="0" - name="internal" - value="" - tool_tip="Use the built-in web browser for help, web links, etc. This browser opens as a new window inside [APP_NAME]." - top="0" - width="480" /> - <radio_item - height="20" label="Use my browser (IE, Firefox, Safari)" layout="topleft" left_delta="0" name="external" value="1" + top="0" tool_tip="Use the default system web browser for help, web links, etc. Not recommended if running full screen." + width="480" /> + <radio_item + height="20" + label="Use built-in browser" + layout="topleft" + left="0" + name="internal" + value="" + 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 + top_delta="2" + enabled="true" + follows="left|top" + height="18" + initial_value="true" + control_name="BrowserPluginsEnabled" + label="Enable plugins" + left_delta="20" + mouse_opaque="true" + name="browser_plugins_enabled" + radio_style="false" + width="400" + top_pad="5"/> + + <check_box + top_delta="4" + enabled="true" + follows="left|top" + height="14" + initial_value="true" + control_name="CookiesEnabled" + label="Accept cookies" + left_delta="0" + mouse_opaque="true" + name="cookies_enabled" + radio_style="false" + width="400" + top_pad="5"/> + + <check_box top_delta="4" enabled="true" follows="left|top" - height="16" + height="14" + initial_value="true" + control_name="BrowserJavascriptEnabled" + label="Enable Javascript" + left_delta="0" + mouse_opaque="true" + name="browser_javascript_enabled" + radio_style="false" + width="400" + top_pad="5"/> + + <check_box + top_delta="4" + enabled="true" + follows="left|top" + height="14" initial_value="false" control_name="BrowserProxyEnabled" label="Enable Web Proxy" @@ -308,9 +353,9 @@ follows="left|top" height="10" layout="topleft" - left_delta="1" + left_delta="20" name="Proxy location" - top_delta="20" + top_delta="16" width="300"> Proxy location: </text> @@ -335,7 +380,7 @@ increment="1" initial_value="80" label="Port number:" - label_width="75" + label_width="70" layout="topleft" left_delta="230" max_val="12000" diff --git a/install.xml b/install.xml index 7337241cf8..e8f0e5d318 100644 --- a/install.xml +++ b/install.xml @@ -962,9 +962,9 @@ anguage Infrstructure (CLI) international standard</string> <key>windows</key> <map> <key>md5sum</key> - <string>ee5d242ea468ba9a82d2bf8581aa308d</string> + <string>93b49cfea365fe082eda3e466a9beec3</string> <key>url</key> - <uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-20100312.tar.bz2</uri> + <uri>http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-20100318.tar.bz2</uri> </map> </map> </map> |