summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 08:32:43 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 08:32:43 +0000
commitd95eb17ad28fdc10b5952b7fcc2b6d5f7ef62b88 (patch)
tree381ed55e2bedeb11babd759b9f6a94183b533d08 /chrome
parenta16a421b3959938bd40e9101b2bc86f4ad46e454 (diff)
downloadchromium_src-d95eb17ad28fdc10b5952b7fcc2b6d5f7ef62b88.zip
chromium_src-d95eb17ad28fdc10b5952b7fcc2b6d5f7ef62b88.tar.gz
chromium_src-d95eb17ad28fdc10b5952b7fcc2b6d5f7ef62b88.tar.bz2
Show option to block non-sandboxed plugins. (Gtk/Views/tabbed part)
BUG=53812 TEST=none Review URL: http://codereview.chromium.org/3231008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/dom_ui/content_settings_handler.cc19
-rw-r--r--chrome/browser/gtk/options/content_filter_page_gtk.cc21
-rw-r--r--chrome/browser/resources/options/content_settings.html6
-rw-r--r--chrome/browser/views/options/content_filter_page_view.cc21
4 files changed, 61 insertions, 6 deletions
diff --git a/chrome/browser/dom_ui/content_settings_handler.cc b/chrome/browser/dom_ui/content_settings_handler.cc
index 2bdb915..4c28834 100644
--- a/chrome/browser/dom_ui/content_settings_handler.cc
+++ b/chrome/browser/dom_ui/content_settings_handler.cc
@@ -175,6 +175,8 @@ void ContentSettingsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_PLUGIN_TAB_LABEL));
localized_strings->SetString("plugins_setting",
l10n_util::GetStringUTF16(IDS_PLUGIN_SETTING_LABEL));
+ localized_strings->SetString("plugins_allow_sandboxed",
+ l10n_util::GetStringUTF16(IDS_PLUGIN_LOAD_SANDBOXED_RADIO));
localized_strings->SetString("plugins_allow",
l10n_util::GetStringUTF16(IDS_PLUGIN_LOAD_RADIO));
localized_strings->SetString("plugins_block",
@@ -235,6 +237,12 @@ void ContentSettingsHandler::Initialize() {
ContentSettingToString(default_setting));
}
+ if (settings_map->GetBlockNonsandboxedPlugins()) {
+ filter_settings.SetString(
+ ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_PLUGINS),
+ ContentSettingToString(CONTENT_SETTING_ASK));
+ }
+
dom_ui_->CallJavascriptFunction(
L"ContentSettings.setInitialContentFilterSettingsValue", filter_settings);
@@ -326,6 +334,17 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) {
return;
}
+ if (ContentSettingsTypeFromGroupName(group) ==
+ CONTENT_SETTINGS_TYPE_PLUGINS) {
+ bool block_nonsandboxed_plugins = false;
+ if (ContentSettingFromString(setting) == CONTENT_SETTING_ASK) {
+ setting = ContentSettingToString(CONTENT_SETTING_ALLOW);
+ block_nonsandboxed_plugins = true;
+ }
+ dom_ui_->GetProfile()->GetHostContentSettingsMap()->
+ SetBlockNonsandboxedPlugins(block_nonsandboxed_plugins);
+ }
+
dom_ui_->GetProfile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
ContentSettingsTypeFromGroupName(group),
ContentSettingFromString(setting));
diff --git a/chrome/browser/gtk/options/content_filter_page_gtk.cc b/chrome/browser/gtk/options/content_filter_page_gtk.cc
index 1f0b719..7253160b 100644
--- a/chrome/browser/gtk/options/content_filter_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_filter_page_gtk.cc
@@ -72,7 +72,7 @@ GtkWidget* ContentFilterPageGtk::InitGroup() {
0, // This dialog isn't used for cookies.
0,
0,
- 0,
+ IDS_PLUGIN_LOAD_SANDBOXED_RADIO,
0,
IDS_GEOLOCATION_ASK_RADIO,
IDS_NOTIFICATIONS_ASK_RADIO,
@@ -103,7 +103,12 @@ GtkWidget* ContentFilterPageGtk::InitGroup() {
gtk_box_pack_start(GTK_BOX(vbox), block_radio_, FALSE, FALSE, 0);
ContentSetting default_setting;
- if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ if (content_type_ == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ default_setting = profile()->GetHostContentSettingsMap()->
+ GetDefaultContentSetting(content_type_);
+ if (profile()->GetHostContentSettingsMap()->GetBlockNonsandboxedPlugins())
+ default_setting = CONTENT_SETTING_ASK;
+ } else if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
default_setting = profile()->GetGeolocationContentSettingsMap()->
GetDefaultContentSetting();
} else if (content_type_ == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
@@ -170,7 +175,17 @@ void ContentFilterPageGtk::OnAllowToggled(GtkWidget* toggle_button) {
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(block_radio_)) ?
CONTENT_SETTING_BLOCK : CONTENT_SETTING_ASK;
DCHECK(ask_radio_ || default_setting != CONTENT_SETTING_ASK);
- if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ if (content_type_ == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ if (default_setting == CONTENT_SETTING_ASK) {
+ default_setting = CONTENT_SETTING_ALLOW;
+ profile()->GetHostContentSettingsMap()->SetBlockNonsandboxedPlugins(true);
+ } else {
+ profile()->GetHostContentSettingsMap()->
+ SetBlockNonsandboxedPlugins(false);
+ }
+ profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
+ content_type_, default_setting);
+ } else if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
profile()->GetGeolocationContentSettingsMap()->SetDefaultContentSetting(
default_setting);
} else if (content_type_ == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
diff --git a/chrome/browser/resources/options/content_settings.html b/chrome/browser/resources/options/content_settings.html
index 8fdebb7..b8fb8e0 100644
--- a/chrome/browser/resources/options/content_settings.html
+++ b/chrome/browser/resources/options/content_settings.html
@@ -128,6 +128,12 @@
</tr>
<tr>
<td class="option-name"><label>
+ <input type="radio" name="plugins" value="ask">
+ <span i18n-content="plugins_allow_sandboxed"></span>
+ </label></td>
+ </tr>
+ <tr>
+ <td class="option-name"><label>
<input type="radio" name="plugins" value="block">
<span i18n-content="plugins_block"></span>
</label></td>
diff --git a/chrome/browser/views/options/content_filter_page_view.cc b/chrome/browser/views/options/content_filter_page_view.cc
index 222f0b0..c017558 100644
--- a/chrome/browser/views/options/content_filter_page_view.cc
+++ b/chrome/browser/views/options/content_filter_page_view.cc
@@ -93,7 +93,7 @@ void ContentFilterPageView::InitControlLayout() {
IDS_COOKIES_ASK_EVERY_TIME_RADIO,
0,
0,
- 0,
+ IDS_PLUGIN_LOAD_SANDBOXED_RADIO,
0,
IDS_GEOLOCATION_ASK_RADIO,
IDS_NOTIFICATIONS_ASK_RADIO,
@@ -136,7 +136,12 @@ void ContentFilterPageView::InitControlLayout() {
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
ContentSetting default_setting;
- if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ if (content_type_ == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ default_setting = profile()->GetHostContentSettingsMap()->
+ GetDefaultContentSetting(content_type_);
+ if (profile()->GetHostContentSettingsMap()->GetBlockNonsandboxedPlugins())
+ default_setting = CONTENT_SETTING_ASK;
+ } else if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
default_setting = profile()->GetGeolocationContentSettingsMap()->
GetDefaultContentSetting();
} else if (content_type_ == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
@@ -200,7 +205,17 @@ void ContentFilterPageView::ButtonPressed(views::Button* sender,
ContentSetting default_setting = allow_radio_->checked() ?
CONTENT_SETTING_ALLOW :
(block_radio_->checked() ? CONTENT_SETTING_BLOCK : CONTENT_SETTING_ASK);
- if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
+ if (content_type_ == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ if (default_setting == CONTENT_SETTING_ASK) {
+ default_setting = CONTENT_SETTING_ALLOW;
+ profile()->GetHostContentSettingsMap()->SetBlockNonsandboxedPlugins(true);
+ } else {
+ profile()->GetHostContentSettingsMap()->
+ SetBlockNonsandboxedPlugins(false);
+ }
+ profile()->GetHostContentSettingsMap()->SetDefaultContentSetting(
+ content_type_, default_setting);
+ } else if (content_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
profile()->GetGeolocationContentSettingsMap()->SetDefaultContentSetting(
default_setting);
} else if (content_type_ == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {