Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1676)

Unified Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 9537014: Merge a bunch of CLs to whitelist the Google Talk plug-in when turning on click-to-play. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1025/src
Patch Set: sync Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/content_settings_handler.cc
diff --git a/chrome/browser/ui/webui/options/content_settings_handler.cc b/chrome/browser/ui/webui/options/content_settings_handler.cc
index d1de2d5582b5e705dcfaed33afa67c9af6b9471f..569cb45b25ffa6019fa8d71af843bfeb399fe0dd 100644
--- a/chrome/browser/ui/webui/options/content_settings_handler.cc
+++ b/chrome/browser/ui/webui/options/content_settings_handler.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/desktop_notification_service_factory.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_notification_types.h"
@@ -669,6 +670,33 @@ void ContentSettingsHandler::RegisterMessages() {
base::Unretained(this)));
}
+void ContentSettingsHandler::ApplyWhitelist(ContentSettingsType content_type,
+ ContentSetting default_setting) {
+ Profile* profile = Profile::FromWebUI(web_ui());
+ HostContentSettingsMap* map = GetContentSettingsMap();
+ if (content_type != CONTENT_SETTINGS_TYPE_PLUGINS)
+ return;
+ const int kDefaultWhitelistVersion = 1;
+ PrefService* prefs = profile->GetPrefs();
+ int version = prefs->GetInteger(
+ prefs::kContentSettingsDefaultWhitelistVersion);
+ if (version >= kDefaultWhitelistVersion)
+ return;
+ ContentSetting old_setting =
+ map->GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, NULL);
+ if (old_setting == CONTENT_SETTING_ALLOW &&
+ default_setting == CONTENT_SETTING_ASK) {
+ map->SetWebsiteSetting(
+ ContentSettingsPattern::Wildcard(),
+ ContentSettingsPattern::Wildcard(),
+ CONTENT_SETTINGS_TYPE_PLUGINS,
+ "google-talk",
+ Value::CreateIntegerValue(CONTENT_SETTING_ALLOW));
+ }
+ prefs->SetInteger(prefs::kContentSettingsDefaultWhitelistVersion,
+ kDefaultWhitelistVersion);
+}
+
void ContentSettingsHandler::SetContentFilter(const ListValue* args) {
DCHECK_EQ(2U, args->GetSize());
std::string group, setting;
@@ -685,8 +713,9 @@ void ContentSettingsHandler::SetContentFilter(const ListValue* args) {
DesktopNotificationServiceFactory::GetForProfile(profile)->
SetDefaultContentSetting(default_setting);
} else {
- GetContentSettingsMap()->
- SetDefaultContentSetting(content_type, default_setting);
+ HostContentSettingsMap* map = GetContentSettingsMap();
+ ApplyWhitelist(content_type, default_setting);
+ map->SetDefaultContentSetting(content_type, default_setting);
}
switch (content_type) {
case CONTENT_SETTINGS_TYPE_COOKIES:

Powered by Google App Engine
This is Rietveld 408576698