| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 UserMetricsAction("Options_DefaultJavaScriptSettingChanged")))); | 136 UserMetricsAction("Options_DefaultJavaScriptSettingChanged")))); |
| 137 exceptions_info_map.insert(std::make_pair( | 137 exceptions_info_map.insert(std::make_pair( |
| 138 CONTENT_SETTINGS_TYPE_PLUGINS, | 138 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 139 ContentSettingWithExceptions( | 139 ContentSettingWithExceptions( |
| 140 true, UserMetricsAction("Options_DefaultPluginsSettingChanged")))); | 140 true, UserMetricsAction("Options_DefaultPluginsSettingChanged")))); |
| 141 exceptions_info_map.insert(std::make_pair( | 141 exceptions_info_map.insert(std::make_pair( |
| 142 CONTENT_SETTINGS_TYPE_POPUPS, | 142 CONTENT_SETTINGS_TYPE_POPUPS, |
| 143 ContentSettingWithExceptions( | 143 ContentSettingWithExceptions( |
| 144 true, UserMetricsAction("Options_DefaultPopupsSettingChanged")))); | 144 true, UserMetricsAction("Options_DefaultPopupsSettingChanged")))); |
| 145 exceptions_info_map.insert(std::make_pair( | 145 exceptions_info_map.insert(std::make_pair( |
| 146 CONTENT_SETTINGS_TYPE_FULLSCREEN, | |
| 147 ContentSettingWithExceptions( | |
| 148 true, | |
| 149 UserMetricsAction("Options_DefaultFullScreenSettingChanged")))); | |
| 150 exceptions_info_map.insert(std::make_pair( | |
| 151 CONTENT_SETTINGS_TYPE_MOUSELOCK, | |
| 152 ContentSettingWithExceptions( | |
| 153 true, | |
| 154 UserMetricsAction("Options_DefaultMouseLockSettingChanged")))); | |
| 155 exceptions_info_map.insert(std::make_pair( | |
| 156 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, | 146 CONTENT_SETTINGS_TYPE_PPAPI_BROKER, |
| 157 ContentSettingWithExceptions( | 147 ContentSettingWithExceptions( |
| 158 true, | 148 true, |
| 159 UserMetricsAction("Options_DefaultPPAPIBrokerSettingChanged")))); | 149 UserMetricsAction("Options_DefaultPPAPIBrokerSettingChanged")))); |
| 160 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 150 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 161 exceptions_info_map.insert(std::make_pair( | 151 exceptions_info_map.insert(std::make_pair( |
| 162 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, | 152 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, |
| 163 ContentSettingWithExceptions( | 153 ContentSettingWithExceptions( |
| 164 true, | 154 true, |
| 165 UserMetricsAction( | 155 UserMetricsAction( |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 zoom_levels_exceptions.Append(std::move(exception)); | 1079 zoom_levels_exceptions.Append(std::move(exception)); |
| 1090 } | 1080 } |
| 1091 | 1081 |
| 1092 base::StringValue type_string(kZoomContentType); | 1082 base::StringValue type_string(kZoomContentType); |
| 1093 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", | 1083 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", |
| 1094 type_string, zoom_levels_exceptions); | 1084 type_string, zoom_levels_exceptions); |
| 1095 } | 1085 } |
| 1096 | 1086 |
| 1097 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( | 1087 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( |
| 1098 ContentSettingsType type) { | 1088 ContentSettingsType type) { |
| 1099 // Fullscreen and mouse lock have no global settings to update. | |
| 1100 // TODO(mgiuca): Delete this after removing these content settings entirely | |
| 1101 // (https://crbug.com/591896). | |
| 1102 if (type == CONTENT_SETTINGS_TYPE_FULLSCREEN || | |
| 1103 type == CONTENT_SETTINGS_TYPE_MOUSELOCK) { | |
| 1104 return; | |
| 1105 } | |
| 1106 | |
| 1107 base::ListValue exceptions; | 1089 base::ListValue exceptions; |
| 1108 HostContentSettingsMap* settings_map = | 1090 HostContentSettingsMap* settings_map = |
| 1109 HostContentSettingsMapFactory::GetForProfile(GetProfile()); | 1091 HostContentSettingsMapFactory::GetForProfile(GetProfile()); |
| 1110 site_settings::GetExceptionsFromHostContentSettingsMap(settings_map, type, | 1092 site_settings::GetExceptionsFromHostContentSettingsMap(settings_map, type, |
| 1111 web_ui(), /*incognito=*/false, /*filter=*/nullptr, &exceptions); | 1093 web_ui(), /*incognito=*/false, /*filter=*/nullptr, &exceptions); |
| 1112 base::StringValue type_string( | 1094 base::StringValue type_string( |
| 1113 site_settings::ContentSettingsTypeToGroupName(type)); | 1095 site_settings::ContentSettingsTypeToGroupName(type)); |
| 1114 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", | 1096 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", |
| 1115 type_string, exceptions); | 1097 type_string, exceptions); |
| 1116 | 1098 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 | 1492 |
| 1511 // Exceptions apply only when the feature is enabled. | 1493 // Exceptions apply only when the feature is enabled. |
| 1512 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1494 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1513 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1495 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1514 web_ui()->CallJavascriptFunctionUnsafe( | 1496 web_ui()->CallJavascriptFunctionUnsafe( |
| 1515 "ContentSettings.enableProtectedContentExceptions", | 1497 "ContentSettings.enableProtectedContentExceptions", |
| 1516 base::FundamentalValue(enable_exceptions)); | 1498 base::FundamentalValue(enable_exceptions)); |
| 1517 } | 1499 } |
| 1518 | 1500 |
| 1519 } // namespace options | 1501 } // namespace options |
| OLD | NEW |