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

Unified Diff: chrome/browser/ui/webui/options2/content_settings_handler2.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
« no previous file with comments | « chrome/browser/ui/webui/options2/content_settings_handler2.h ('k') | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options2/content_settings_handler2.cc
diff --git a/chrome/browser/ui/webui/options2/content_settings_handler2.cc b/chrome/browser/ui/webui/options2/content_settings_handler2.cc
index 8b58deed3a8c616319aab73e6b34e6245d8e4f02..a172e0c9d685269528d82f80e6295c6d8bb46bd8 100644
--- a/chrome/browser/ui/webui/options2/content_settings_handler2.cc
+++ b/chrome/browser/ui/webui/options2/content_settings_handler2.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"
@@ -671,6 +672,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;
@@ -687,8 +715,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:
« no previous file with comments | « chrome/browser/ui/webui/options2/content_settings_handler2.h ('k') | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698