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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 2237823003: Site Settings Desktop: Implement USB devices section. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more fix Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 <utility> 10 #include <utility>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #include "components/user_manager/user_manager.h" 77 #include "components/user_manager/user_manager.h"
78 #endif 78 #endif
79 79
80 using base::UserMetricsAction; 80 using base::UserMetricsAction;
81 using content_settings::ContentSettingToString; 81 using content_settings::ContentSettingToString;
82 using content_settings::ContentSettingFromString; 82 using content_settings::ContentSettingFromString;
83 using extensions::APIPermission; 83 using extensions::APIPermission;
84 84
85 namespace options { 85 namespace options {
86 86
87 // This struct is declared early so that it can used by functions below.
88 struct ContentSettingsHandler::ChooserTypeNameEntry {
89 ContentSettingsType type;
90 ChooserContextBase* (*get_context)(Profile*);
91 const char* name;
92 const char* ui_name_key;
93 };
94
95 namespace { 87 namespace {
96 88
97 struct ContentSettingWithExceptions { 89 struct ContentSettingWithExceptions {
98 ContentSettingWithExceptions(bool otr, UserMetricsAction action) 90 ContentSettingWithExceptions(bool otr, UserMetricsAction action)
99 : has_otr_exceptions(otr), uma(action) {} 91 : has_otr_exceptions(otr), uma(action) {}
100 bool has_otr_exceptions; 92 bool has_otr_exceptions;
101 UserMetricsAction uma; 93 UserMetricsAction uma;
102 }; 94 };
103 95
104 // Maps from the UI string to the object it represents (for sorting purposes). 96 // Maps from the UI string to the object it represents (for sorting purposes).
105 typedef std::multimap<std::string, const base::DictionaryValue*> SortedObjects; 97 typedef std::multimap<std::string, const base::DictionaryValue*> SortedObjects;
106 // Maps from a secondary URL to the set of objects it has permission to access. 98 // Maps from a secondary URL to the set of objects it has permission to access.
107 typedef std::map<GURL, SortedObjects> OneOriginObjects; 99 typedef std::map<GURL, SortedObjects> OneOriginObjects;
108 // Maps from a primary URL/source pair to a OneOriginObjects. All the mappings 100 // Maps from a primary URL/source pair to a OneOriginObjects. All the mappings
109 // in OneOriginObjects share the given primary URL and source. 101 // in OneOriginObjects share the given primary URL and source.
110 typedef std::map<std::pair<GURL, std::string>, OneOriginObjects> 102 typedef std::map<std::pair<GURL, std::string>, OneOriginObjects>
111 AllOriginObjects; 103 AllOriginObjects;
Bernhard Bauer 2016/08/15 14:14:54 Do we still need these?
Finnur 2016/08/16 10:13:55 Good catch. Nope.
112 104
113 // The AppFilter is used in AddExceptionsGrantedByHostedApps() to choose 105 // The AppFilter is used in AddExceptionsGrantedByHostedApps() to choose
114 // extensions which should have their extent displayed. 106 // extensions which should have their extent displayed.
115 typedef bool (*AppFilter)(const extensions::Extension& app, 107 typedef bool (*AppFilter)(const extensions::Extension& app,
116 content::BrowserContext* profile); 108 content::BrowserContext* profile);
117 109
118 const char kExceptionsLearnMoreUrl[] = 110 const char kExceptionsLearnMoreUrl[] =
119 "https://support.google.com/chrome/?p=settings_manage_exceptions"; 111 "https://support.google.com/chrome/?p=settings_manage_exceptions";
120 112
121 const char kAppName[] = "appName"; 113 const char kAppName[] = "appName";
122 const char kAppId[] = "appId"; 114 const char kAppId[] = "appId";
123 const char kZoom[] = "zoom"; 115 const char kZoom[] = "zoom";
124 const char kObject[] = "object";
125 const char kObjectName[] = "objectName";
126
127 ChooserContextBase* GetUsbChooserContext(Profile* profile) {
128 return UsbChooserContextFactory::GetForProfile(profile);
129 }
130
131 const ContentSettingsHandler::ChooserTypeNameEntry kChooserTypeGroupNames[] = {
132 {CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, &GetUsbChooserContext,
133 "usb-devices", "name"},
134 };
135 116
136 // A pseudo content type. We use it to display data like a content setting even 117 // A pseudo content type. We use it to display data like a content setting even
137 // though it is not a real content setting. 118 // though it is not a real content setting.
138 const char kZoomContentType[] = "zoomlevels"; 119 const char kZoomContentType[] = "zoomlevels";
139 120
140 // Maps from a content settings type to a content setting with exceptions 121 // Maps from a content settings type to a content setting with exceptions
141 // struct. 122 // struct.
142 typedef std::map<ContentSettingsType, ContentSettingWithExceptions> 123 typedef std::map<ContentSettingsType, ContentSettingWithExceptions>
143 ExceptionsInfoMap; 124 ExceptionsInfoMap;
144 125
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 UserMetricsAction("Options_DefaultBackgroundSyncSettingChanged")))); 214 UserMetricsAction("Options_DefaultBackgroundSyncSettingChanged"))));
234 } 215 }
235 216
236 return exceptions_info_map; 217 return exceptions_info_map;
237 } 218 }
238 219
239 content::BrowserContext* GetBrowserContext(content::WebUI* web_ui) { 220 content::BrowserContext* GetBrowserContext(content::WebUI* web_ui) {
240 return web_ui->GetWebContents()->GetBrowserContext(); 221 return web_ui->GetWebContents()->GetBrowserContext();
241 } 222 }
242 223
243 const ContentSettingsHandler::ChooserTypeNameEntry* ChooserTypeFromGroupName(
244 const std::string& name) {
245 for (const auto& chooser_type : kChooserTypeGroupNames) {
246 if (chooser_type.name == name)
247 return &chooser_type;
248 }
249 return nullptr;
250 }
251
252 // Create a DictionaryValue* that will act as a data source for a single row 224 // Create a DictionaryValue* that will act as a data source for a single row
253 // in the Geolocation exceptions table. 225 // in the Geolocation exceptions table.
254 std::unique_ptr<base::DictionaryValue> GetGeolocationExceptionForPage( 226 std::unique_ptr<base::DictionaryValue> GetGeolocationExceptionForPage(
255 const ContentSettingsPattern& origin, 227 const ContentSettingsPattern& origin,
256 const ContentSettingsPattern& embedding_origin, 228 const ContentSettingsPattern& embedding_origin,
257 ContentSetting setting) { 229 ContentSetting setting) {
258 base::DictionaryValue* exception = new base::DictionaryValue(); 230 base::DictionaryValue* exception = new base::DictionaryValue();
259 231
260 std::string setting_string = 232 std::string setting_string =
261 content_settings::ContentSettingToString(setting); 233 content_settings::ContentSettingToString(setting);
(...skipping 23 matching lines...) Expand all
285 content_settings::ContentSettingToString(setting); 257 content_settings::ContentSettingToString(setting);
286 DCHECK(!setting_string.empty()); 258 DCHECK(!setting_string.empty());
287 259
288 exception->SetString(site_settings::kSetting, setting_string); 260 exception->SetString(site_settings::kSetting, setting_string);
289 exception->SetString(site_settings::kOrigin, primary_pattern.ToString()); 261 exception->SetString(site_settings::kOrigin, primary_pattern.ToString());
290 exception->SetString(site_settings::kEmbeddingOrigin, embedding_origin); 262 exception->SetString(site_settings::kEmbeddingOrigin, embedding_origin);
291 exception->SetString(site_settings::kSource, provider_name); 263 exception->SetString(site_settings::kSource, provider_name);
292 return base::WrapUnique(exception); 264 return base::WrapUnique(exception);
293 } 265 }
294 266
295 // Create a DictionaryValue* that will act as a data source for a single row
296 // in a chooser permission exceptions table.
297 std::unique_ptr<base::DictionaryValue> GetChooserExceptionForPage(
298 const GURL& requesting_origin,
299 const GURL& embedding_origin,
300 const std::string& provider_name,
301 const std::string& name,
302 const base::DictionaryValue* object) {
303 std::unique_ptr<base::DictionaryValue> exception(new base::DictionaryValue());
304
305 std::string setting_string =
306 content_settings::ContentSettingToString(CONTENT_SETTING_DEFAULT);
307 DCHECK(!setting_string.empty());
308
309 exception->SetString(site_settings::kSetting, setting_string);
310 exception->SetString(site_settings::kOrigin, requesting_origin.spec());
311 exception->SetString(
312 site_settings::kEmbeddingOrigin, embedding_origin.spec());
313 exception->SetString(site_settings::kSource, provider_name);
314 if (object) {
315 exception->SetString(kObjectName, name);
316 exception->Set(kObject, object->CreateDeepCopy());
317 }
318 return exception;
319 }
320
321 // Returns true whenever the |extension| is hosted and has |permission|. 267 // Returns true whenever the |extension| is hosted and has |permission|.
322 // Must have the AppFilter signature. 268 // Must have the AppFilter signature.
323 template <APIPermission::ID permission> 269 template <APIPermission::ID permission>
324 bool HostedAppHasPermission(const extensions::Extension& extension, 270 bool HostedAppHasPermission(const extensions::Extension& extension,
325 content::BrowserContext* /* context */) { 271 content::BrowserContext* /* context */) {
326 return extension.is_hosted_app() && 272 return extension.is_hosted_app() &&
327 extension.permissions_data()->HasAPIPermission(permission); 273 extension.permissions_data()->HasAPIPermission(permission);
328 } 274 }
329 275
330 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from 276 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 UpdateFlashMediaLinksVisibility(type); 989 UpdateFlashMediaLinksVisibility(type);
1044 } 990 }
1045 991
1046 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() { 992 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() {
1047 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); 993 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MIDI_SYSEX);
1048 UpdateExceptionsViewFromHostContentSettingsMap( 994 UpdateExceptionsViewFromHostContentSettingsMap(
1049 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); 995 CONTENT_SETTINGS_TYPE_MIDI_SYSEX);
1050 } 996 }
1051 997
1052 void ContentSettingsHandler::UpdateAllChooserExceptionsViewsFromModel() { 998 void ContentSettingsHandler::UpdateAllChooserExceptionsViewsFromModel() {
1053 for (const ChooserTypeNameEntry& chooser_type : kChooserTypeGroupNames) 999 for (const site_settings::ChooserTypeNameEntry& chooser_type :
1000 site_settings::kChooserTypeGroupNames)
1054 UpdateChooserExceptionsViewFromModel(chooser_type); 1001 UpdateChooserExceptionsViewFromModel(chooser_type);
1055 } 1002 }
1056 1003
1057 void ContentSettingsHandler::UpdateAllOTRChooserExceptionsViewsFromModel() { 1004 void ContentSettingsHandler::UpdateAllOTRChooserExceptionsViewsFromModel() {
1058 for (const ChooserTypeNameEntry& chooser_type : kChooserTypeGroupNames) 1005 for (const site_settings::ChooserTypeNameEntry& chooser_type :
1006 site_settings::kChooserTypeGroupNames)
1059 UpdateOTRChooserExceptionsViewFromModel(chooser_type); 1007 UpdateOTRChooserExceptionsViewFromModel(chooser_type);
1060 } 1008 }
1061 1009
1062 void ContentSettingsHandler::UpdateChooserExceptionsViewFromModel( 1010 void ContentSettingsHandler::UpdateChooserExceptionsViewFromModel(
1063 const ChooserTypeNameEntry& chooser_type) { 1011 const site_settings::ChooserTypeNameEntry& chooser_type) {
1064 base::ListValue exceptions; 1012 base::ListValue exceptions;
1065 GetChooserExceptionsFromProfile(false, chooser_type, &exceptions); 1013 site_settings::GetChooserExceptionsFromProfile(
1014 Profile::FromWebUI(web_ui()), false, chooser_type, &exceptions);
1066 base::StringValue type_string(chooser_type.name); 1015 base::StringValue type_string(chooser_type.name);
1067 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", 1016 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions",
1068 type_string, exceptions); 1017 type_string, exceptions);
1069 1018
1070 UpdateOTRChooserExceptionsViewFromModel(chooser_type); 1019 UpdateOTRChooserExceptionsViewFromModel(chooser_type);
1071 } 1020 }
1072 1021
1073 void ContentSettingsHandler::UpdateOTRChooserExceptionsViewFromModel( 1022 void ContentSettingsHandler::UpdateOTRChooserExceptionsViewFromModel(
1074 const ChooserTypeNameEntry& chooser_type) { 1023 const site_settings::ChooserTypeNameEntry& chooser_type) {
1075 if (!Profile::FromWebUI(web_ui())->HasOffTheRecordProfile()) 1024 if (!Profile::FromWebUI(web_ui())->HasOffTheRecordProfile())
1076 return; 1025 return;
1077 1026
1078 base::ListValue exceptions; 1027 base::ListValue exceptions;
1079 GetChooserExceptionsFromProfile(true, chooser_type, &exceptions); 1028 site_settings::GetChooserExceptionsFromProfile(
1029 Profile::FromWebUI(web_ui()), true, chooser_type, &exceptions);
1080 base::StringValue type_string(chooser_type.name); 1030 base::StringValue type_string(chooser_type.name);
1081 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setOTRExceptions", 1031 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setOTRExceptions",
1082 type_string, exceptions); 1032 type_string, exceptions);
1083 } 1033 }
1084 1034
1085 void ContentSettingsHandler::UpdateZoomLevelsExceptionsView() { 1035 void ContentSettingsHandler::UpdateZoomLevelsExceptionsView() {
1086 base::ListValue zoom_levels_exceptions; 1036 base::ListValue zoom_levels_exceptions;
1087 1037
1088 content::HostZoomMap* host_zoom_map = 1038 content::HostZoomMap* host_zoom_map =
1089 content::HostZoomMap::GetDefaultForBrowserContext( 1039 content::HostZoomMap::GetDefaultForBrowserContext(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 return; 1139 return;
1190 base::ListValue exceptions; 1140 base::ListValue exceptions;
1191 site_settings::GetExceptionsFromHostContentSettingsMap( 1141 site_settings::GetExceptionsFromHostContentSettingsMap(
1192 otr_settings_map, type, web_ui(), &exceptions); 1142 otr_settings_map, type, web_ui(), &exceptions);
1193 base::StringValue type_string( 1143 base::StringValue type_string(
1194 site_settings::ContentSettingsTypeToGroupName(type)); 1144 site_settings::ContentSettingsTypeToGroupName(type));
1195 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setOTRExceptions", 1145 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setOTRExceptions",
1196 type_string, exceptions); 1146 type_string, exceptions);
1197 } 1147 }
1198 1148
1199 void ContentSettingsHandler::GetChooserExceptionsFromProfile(
1200 bool incognito,
1201 const ChooserTypeNameEntry& chooser_type,
1202 base::ListValue* exceptions) {
1203 Profile* profile = Profile::FromWebUI(web_ui());
1204 if (incognito) {
1205 if (profile->HasOffTheRecordProfile())
1206 profile = profile->GetOffTheRecordProfile();
1207 else
1208 return;
1209 }
1210
1211 ChooserContextBase* chooser_context = chooser_type.get_context(profile);
1212 std::vector<std::unique_ptr<ChooserContextBase::Object>> objects =
1213 chooser_context->GetAllGrantedObjects();
1214 AllOriginObjects all_origin_objects;
1215 for (const auto& object : objects) {
1216 std::string name;
1217 bool found = object->object.GetString(chooser_type.ui_name_key, &name);
1218 DCHECK(found);
1219 // It is safe for this structure to hold references into |objects| because
1220 // they are both destroyed at the end of this function.
1221 all_origin_objects[make_pair(object->requesting_origin,
1222 object->source)][object->embedding_origin]
1223 .insert(make_pair(name, &object->object));
1224 }
1225
1226 // Keep the exceptions sorted by provider so they will be displayed in
1227 // precedence order.
1228 std::vector<std::unique_ptr<base::DictionaryValue>>
1229 all_provider_exceptions[HostContentSettingsMap::NUM_PROVIDER_TYPES];
1230
1231 for (const auto& all_origin_objects_entry : all_origin_objects) {
1232 const GURL& requesting_origin = all_origin_objects_entry.first.first;
1233 const std::string& source = all_origin_objects_entry.first.second;
1234 const OneOriginObjects& one_origin_objects =
1235 all_origin_objects_entry.second;
1236
1237 auto& this_provider_exceptions = all_provider_exceptions
1238 [HostContentSettingsMap::GetProviderTypeFromSource(source)];
1239
1240 // Add entries for any non-embedded origins.
1241 bool has_embedded_entries = false;
1242 for (const auto& one_origin_objects_entry : one_origin_objects) {
1243 const GURL& embedding_origin = one_origin_objects_entry.first;
1244 const SortedObjects& sorted_objects = one_origin_objects_entry.second;
1245
1246 // Skip the embedded settings which will be added below.
1247 if (requesting_origin != embedding_origin) {
1248 has_embedded_entries = true;
1249 continue;
1250 }
1251
1252 for (const auto& sorted_objects_entry : sorted_objects) {
1253 this_provider_exceptions.push_back(GetChooserExceptionForPage(
1254 requesting_origin, embedding_origin, source,
1255 sorted_objects_entry.first, sorted_objects_entry.second));
1256 }
1257 }
1258
1259 if (has_embedded_entries) {
1260 // Add a "parent" entry that simply acts as a heading for all entries
1261 // where |requesting_origin| has been embedded.
1262 this_provider_exceptions.push_back(
1263 GetChooserExceptionForPage(requesting_origin, requesting_origin,
1264 source, std::string(), nullptr));
1265
1266 // Add the "children" for any embedded settings.
1267 for (const auto& one_origin_objects_entry : one_origin_objects) {
1268 const GURL& embedding_origin = one_origin_objects_entry.first;
1269 const SortedObjects& sorted_objects = one_origin_objects_entry.second;
1270
1271 // Skip the non-embedded setting which we already added above.
1272 if (requesting_origin == embedding_origin)
1273 continue;
1274
1275 for (const auto& sorted_objects_entry : sorted_objects) {
1276 this_provider_exceptions.push_back(GetChooserExceptionForPage(
1277 requesting_origin, embedding_origin, source,
1278 sorted_objects_entry.first, sorted_objects_entry.second));
1279 }
1280 }
1281 }
1282 }
1283
1284 for (auto& one_provider_exceptions : all_provider_exceptions) {
1285 for (auto& exception : one_provider_exceptions)
1286 exceptions->Append(std::move(exception));
1287 }
1288 }
1289
1290 void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap( 1149 void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap(
1291 const base::ListValue* args, 1150 const base::ListValue* args,
1292 ContentSettingsType type) { 1151 ContentSettingsType type) {
1293 std::string mode; 1152 std::string mode;
1294 bool rv = args->GetString(1, &mode); 1153 bool rv = args->GetString(1, &mode);
1295 DCHECK(rv); 1154 DCHECK(rv);
1296 1155
1297 std::string pattern; 1156 std::string pattern;
1298 rv = args->GetString(2, &pattern); 1157 rv = args->GetString(2, &pattern);
1299 DCHECK(rv); 1158 DCHECK(rv);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 1202
1344 content::HostZoomMap* host_zoom_map; 1203 content::HostZoomMap* host_zoom_map;
1345 host_zoom_map = 1204 host_zoom_map =
1346 content::HostZoomMap::GetDefaultForBrowserContext( 1205 content::HostZoomMap::GetDefaultForBrowserContext(
1347 GetBrowserContext(web_ui())); 1206 GetBrowserContext(web_ui()));
1348 double default_level = host_zoom_map->GetDefaultZoomLevel(); 1207 double default_level = host_zoom_map->GetDefaultZoomLevel();
1349 host_zoom_map->SetZoomLevelForHost(pattern, default_level); 1208 host_zoom_map->SetZoomLevelForHost(pattern, default_level);
1350 } 1209 }
1351 1210
1352 void ContentSettingsHandler::RemoveChooserException( 1211 void ContentSettingsHandler::RemoveChooserException(
1353 const ChooserTypeNameEntry* chooser_type, 1212 const site_settings::ChooserTypeNameEntry* chooser_type,
1354 const base::ListValue* args) { 1213 const base::ListValue* args) {
1355 std::string mode; 1214 std::string mode;
1356 bool rv = args->GetString(1, &mode); 1215 bool rv = args->GetString(1, &mode);
1357 DCHECK(rv); 1216 DCHECK(rv);
1358 1217
1359 std::string requesting_origin_string; 1218 std::string requesting_origin_string;
1360 rv = args->GetString(2, &requesting_origin_string); 1219 rv = args->GetString(2, &requesting_origin_string);
1361 DCHECK(rv); 1220 DCHECK(rv);
1362 GURL requesting_origin(requesting_origin_string); 1221 GURL requesting_origin(requesting_origin_string);
1363 DCHECK(requesting_origin.is_valid()); 1222 DCHECK(requesting_origin.is_valid());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 CHECK(args->GetString(0, &type_string)); 1297 CHECK(args->GetString(0, &type_string));
1439 1298
1440 // Zoom levels are no actual content type so we need to handle them 1299 // Zoom levels are no actual content type so we need to handle them
1441 // separately. They would not be recognized by 1300 // separately. They would not be recognized by
1442 // ContentSettingsTypeFromGroupName. 1301 // ContentSettingsTypeFromGroupName.
1443 if (type_string == kZoomContentType) { 1302 if (type_string == kZoomContentType) {
1444 RemoveZoomLevelException(args); 1303 RemoveZoomLevelException(args);
1445 return; 1304 return;
1446 } 1305 }
1447 1306
1448 const ChooserTypeNameEntry* chooser_type = 1307 const site_settings::ChooserTypeNameEntry* chooser_type =
1449 ChooserTypeFromGroupName(type_string); 1308 site_settings::ChooserTypeFromGroupName(type_string);
1450 if (chooser_type) { 1309 if (chooser_type) {
1451 RemoveChooserException(chooser_type, args); 1310 RemoveChooserException(chooser_type, args);
1452 return; 1311 return;
1453 } 1312 }
1454 1313
1455 ContentSettingsType type = 1314 ContentSettingsType type =
1456 site_settings::ContentSettingsTypeFromGroupName(type_string); 1315 site_settings::ContentSettingsTypeFromGroupName(type_string);
1457 RemoveExceptionFromHostContentSettingsMap(args, type); 1316 RemoveExceptionFromHostContentSettingsMap(args, type);
1458 1317
1459 WebSiteSettingsUmaUtil::LogPermissionChange( 1318 WebSiteSettingsUmaUtil::LogPermissionChange(
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 1514
1656 // Exceptions apply only when the feature is enabled. 1515 // Exceptions apply only when the feature is enabled.
1657 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1516 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1658 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1517 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1659 web_ui()->CallJavascriptFunctionUnsafe( 1518 web_ui()->CallJavascriptFunctionUnsafe(
1660 "ContentSettings.enableProtectedContentExceptions", 1519 "ContentSettings.enableProtectedContentExceptions",
1661 base::FundamentalValue(enable_exceptions)); 1520 base::FundamentalValue(enable_exceptions));
1662 } 1521 }
1663 1522
1664 } // namespace options 1523 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698