diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/content_settings/content_settings_pref_provider.cc | 13 | ||||
-rw-r--r-- | chrome/browser/resources/plugins.css | 6 | ||||
-rw-r--r-- | chrome/browser/resources/plugins.html | 6 | ||||
-rw-r--r-- | chrome/browser/resources/plugins.js | 20 | ||||
-rw-r--r-- | chrome/browser/ui/webui/plugins_ui.cc | 70 |
6 files changed, 18 insertions, 100 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 9a7d8c0..bcc60a2 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4443,9 +4443,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_PLUGINS_ENABLE" desc="The link for enabling a plug-in."> Enable </message> - <message name="IDS_PLUGINS_ALWAYS_ALLOWED" desc="The checkbox label for whitelisting a plug-in for content settings."> - Always allowed - </message> <message name="IDS_PLUGINS_DOWNLOAD" desc="The link label to download the latest version of this plug-in"> Download Critical Security Update </message> diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc index 2ac81b1..8b4cd74 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider.cc @@ -70,7 +70,9 @@ void ClearSettings(ContentSettingsType type, // Otherwise, returns false. bool GetResourceTypeName(ContentSettingsType content_type, std::string* pref_key) { - if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS) { + if (content_type == CONTENT_SETTINGS_TYPE_PLUGINS && + CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableResourceContentSettings)) { *pref_key = kPerPluginPrefName; return true; } @@ -164,8 +166,7 @@ bool PrefProvider::SetWebsiteSetting( // sites/origins defined by the |primary_pattern| and the |secondary_pattern|. // Default settings are handled by the |DefaultProvider|. if (primary_pattern == ContentSettingsPattern::Wildcard() && - secondary_pattern == ContentSettingsPattern::Wildcard() && - resource_identifier.empty()) { + secondary_pattern == ContentSettingsPattern::Wildcard()) { return false; } @@ -470,8 +471,7 @@ void PrefProvider::UpdateObsoletePatternsPref( if (settings_dictionary) { std::string res_dictionary_path; - if (GetResourceTypeName(content_type, &res_dictionary_path) && - !resource_identifier.empty()) { + if (GetResourceTypeName(content_type, &res_dictionary_path)) { DictionaryValue* resource_dictionary = NULL; found = settings_dictionary->GetDictionary( res_dictionary_path, &resource_dictionary); @@ -534,8 +534,7 @@ void PrefProvider::UpdatePatternPairsSettings( if (settings_dictionary) { std::string res_dictionary_path; - if (GetResourceTypeName(content_type, &res_dictionary_path) && - !resource_identifier.empty()) { + if (GetResourceTypeName(content_type, &res_dictionary_path)) { DictionaryValue* resource_dictionary = NULL; found = settings_dictionary->GetDictionary( res_dictionary_path, &resource_dictionary); diff --git a/chrome/browser/resources/plugins.css b/chrome/browser/resources/plugins.css index 398d5e7..ab61cee 100644 --- a/chrome/browser/resources/plugins.css +++ b/chrome/browser/resources/plugins.css @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Copyright (c) 2011 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -249,10 +249,6 @@ body.showTmiMode .showInTmiMode { margin-bottom: 0.2em; } -.always-allow { - -webkit-margin-start: 30px; -} - button { font-size: 104%; } diff --git a/chrome/browser/resources/plugins.html b/chrome/browser/resources/plugins.html index 9f6b195..b5db675 100644 --- a/chrome/browser/resources/plugins.html +++ b/chrome/browser/resources/plugins.html @@ -181,12 +181,6 @@ i18n-content="enable" >ENABLE</a> </span> - <input - class="always-allow" type="checkbox" - jsvalues= - ".identifier:id; id:id + '-always-allowed'; .checked:alwaysAllowed"> - <label jsvalues="for:id + '-always-allowed'" - i18n-content="alwaysAllowed"></label> </div> </td> </tr> diff --git a/chrome/browser/resources/plugins.js b/chrome/browser/resources/plugins.js index 77ec1ae..97f1e26 100644 --- a/chrome/browser/resources/plugins.js +++ b/chrome/browser/resources/plugins.js @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -125,39 +125,33 @@ function returnPluginsData(pluginsData){ // Add handlers to dynamically created HTML elements. var links = document.getElementsByClassName('disable-plugin-link'); - for (var i = 0; i < links.length; i++) { + for (var i = 0; i < links.length; ++i) { links[i].onclick = function () { handleEnablePlugin(this, false, false); return false; }; } links = document.getElementsByClassName('enable-plugin-link'); - for (var i = 0; i < links.length; i++) { + for (var i = 0; i < links.length; ++i) { links[i].onclick = function () { handleEnablePlugin(this, true, false); return false; }; } links = document.getElementsByClassName('disable-group-link'); - for (var i = 0; i < links.length; i++) { + for (var i = 0; i < links.length; ++i) { links[i].onclick = function () { handleEnablePlugin(this, false, true); return false; }; } links = document.getElementsByClassName('enable-group-link'); - for (var i = 0; i < links.length; i++) { + for (var i = 0; i < links.length; ++i) { links[i].onclick = function () { handleEnablePlugin(this, true, true); return false; }; } - var checkboxes = document.getElementsByClassName('always-allow'); - for (var i = 0; i < checkboxes.length; i++) { - checkboxes[i].onclick = function () { - handleSetPluginAlwaysAllowed(this) - }; - }; // Make sure the left column (with "Description:", "Location:", etc.) is the // same size for all plugins. @@ -215,10 +209,6 @@ function toggleTmiMode() { chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]); } -function handleSetPluginAlwaysAllowed(el) { - chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]); -} - /** * Determines whether a plugin's version should be displayed. */ diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index a73bc4b..f2e8126 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,6 @@ #include "base/path_service.h" #include "base/utf_string_conversions.h" #include "base/values.h" -#include "chrome/browser/content_settings/host_content_settings_map.h" #include "chrome/browser/plugin_prefs.h" #include "chrome/browser/prefs/pref_member.h" #include "chrome/browser/prefs/pref_service.h" @@ -80,7 +79,6 @@ ChromeWebUIDataSource* CreatePluginsUIHTMLSource() { IDS_PLUGINS_MIME_TYPES_FILE_EXTENSIONS); source->AddLocalizedString("disable", IDS_PLUGINS_DISABLE); source->AddLocalizedString("enable", IDS_PLUGINS_ENABLE); - source->AddLocalizedString("alwaysAllowed", IDS_PLUGINS_ALWAYS_ALLOWED); source->AddLocalizedString("noPlugins", IDS_PLUGINS_NO_PLUGINS); source->set_json_path("strings.js"); @@ -138,9 +136,6 @@ class PluginsDOMHandler : public WebUIMessageHandler, // Calback for the "getShowDetails" message. void HandleGetShowDetails(const ListValue* args); - // Callback for the "setPluginAlwaysAllowed" message. - void HandleSetPluginAlwaysAllowed(const ListValue* args); - // content::NotificationObserver method overrides virtual void Observe(int type, const content::NotificationSource& source, @@ -184,9 +179,6 @@ void PluginsDOMHandler::RegisterMessages() { web_ui()->RegisterMessageCallback("enablePlugin", base::Bind(&PluginsDOMHandler::HandleEnablePluginMessage, base::Unretained(this))); - web_ui()->RegisterMessageCallback("setPluginAlwaysAllowed", - base::Bind(&PluginsDOMHandler::HandleSetPluginAlwaysAllowed, - base::Unretained(this))); web_ui()->RegisterMessageCallback("saveShowDetailsToPrefs", base::Bind(&PluginsDOMHandler::HandleSaveShowDetailsToPrefs, base::Unretained(this))); @@ -204,26 +196,20 @@ void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) { // Be robust in accepting badness since plug-ins display HTML (hence // JavaScript). - if (args->GetSize() != 3) { - NOTREACHED(); + if (args->GetSize() != 3) return; - } std::string enable_str; std::string is_group_str; - if (!args->GetString(1, &enable_str) || !args->GetString(2, &is_group_str)) { - NOTREACHED(); + if (!args->GetString(1, &enable_str) || !args->GetString(2, &is_group_str)) return; - } bool enable = enable_str == "true"; PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); if (is_group_str == "true") { string16 group_name; - if (!args->GetString(0, &group_name)) { - NOTREACHED(); + if (!args->GetString(0, &group_name)) return; - } plugin_prefs->EnablePluginGroup(enable, group_name); if (enable) { @@ -239,10 +225,8 @@ void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) { } } else { FilePath::StringType file_path; - if (!args->GetString(0, &file_path)) { - NOTREACHED(); + if (!args->GetString(0, &file_path)) return; - } bool result = plugin_prefs->EnablePlugin(enable, FilePath(file_path)); DCHECK(result); } @@ -262,27 +246,6 @@ void PluginsDOMHandler::HandleGetShowDetails(const ListValue* args) { web_ui()->CallJavascriptFunction("loadShowDetailsFromPrefs", show_details); } -void PluginsDOMHandler::HandleSetPluginAlwaysAllowed(const ListValue* args) { - // Be robust in the input parameters, but crash in a Debug build. - if (args->GetSize() != 2) { - NOTREACHED(); - return; - } - - std::string plugin; - bool allowed = false; - if (!args->GetString(0, &plugin) || !args->GetBoolean(1, &allowed)) { - NOTREACHED(); - return; - } - Profile::FromWebUI(web_ui())->GetHostContentSettingsMap()->SetContentSetting( - ContentSettingsPattern::Wildcard(), - ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_PLUGINS, - plugin, - allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_DEFAULT); -} - void PluginsDOMHandler::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -300,12 +263,8 @@ void PluginsDOMHandler::LoadPlugins() { } void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) { - Profile* profile = Profile::FromWebUI(web_ui()); PluginPrefs* plugin_prefs = - PluginPrefs::GetForProfile(profile); - - HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); - ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); + PluginPrefs::GetForProfile(Profile::FromWebUI(web_ui())); // Construct DictionaryValues to return to the UI ListValue* plugin_groups_data = new ListValue(); @@ -384,7 +343,6 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) { group_data->Set("plugin_files", plugin_files); group_data->SetString("name", group_name); - group_data->SetString("id", group.identifier()); group_data->SetString("description", active_plugin->desc); group_data->SetString("version", active_plugin->version); group_data->SetBoolean("critical", group.IsVulnerable(*active_plugin)); @@ -402,22 +360,6 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) { } group_data->SetString("enabledMode", enabled_mode); - // TODO(bauerb): We should have a method on HostContentSettinsMap for this. - bool always_allowed = false; - ContentSettingsForOneType settings; - map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_PLUGINS, - group.identifier(), &settings); - for (ContentSettingsForOneType::const_iterator it = settings.begin(); - it != settings.end(); ++it) { - if (it->primary_pattern == wildcard && - it->secondary_pattern == wildcard && - it->setting == CONTENT_SETTING_ALLOW) { - always_allowed = true; - break; - } - } - group_data->SetBoolean("alwaysAllowed", always_allowed); - plugin_groups_data->Append(group_data); } DictionaryValue results; |