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

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

Issue 1372353004: Making structure for ContentSettings and its corresponding strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nits. Created 5 years, 2 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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 const ContentSettingsPattern& pattern, 179 const ContentSettingsPattern& pattern,
180 const ContentSettingsPattern& secondary_pattern, 180 const ContentSettingsPattern& secondary_pattern,
181 const ContentSetting& setting, 181 const ContentSetting& setting,
182 const std::string& provider_name) { 182 const std::string& provider_name) {
183 base::DictionaryValue* exception = new base::DictionaryValue(); 183 base::DictionaryValue* exception = new base::DictionaryValue();
184 exception->SetString(kOrigin, pattern.ToString()); 184 exception->SetString(kOrigin, pattern.ToString());
185 exception->SetString(kEmbeddingOrigin, 185 exception->SetString(kEmbeddingOrigin,
186 secondary_pattern == ContentSettingsPattern::Wildcard() ? 186 secondary_pattern == ContentSettingsPattern::Wildcard() ?
187 std::string() : 187 std::string() :
188 secondary_pattern.ToString()); 188 secondary_pattern.ToString());
189 exception->SetString(kSetting, ContentSettingToString(setting)); 189
190 std::string setting_string =
191 content_settings::ContentSettingToString(setting);
192 DCHECK(!setting_string.empty());
193
194 exception->SetString(kSetting, setting_string);
190 exception->SetString(kSource, provider_name); 195 exception->SetString(kSource, provider_name);
191 return make_scoped_ptr(exception); 196 return make_scoped_ptr(exception);
192 } 197 }
193 198
194 // Create a DictionaryValue* that will act as a data source for a single row 199 // Create a DictionaryValue* that will act as a data source for a single row
195 // in the Geolocation exceptions table. 200 // in the Geolocation exceptions table.
196 scoped_ptr<base::DictionaryValue> GetGeolocationExceptionForPage( 201 scoped_ptr<base::DictionaryValue> GetGeolocationExceptionForPage(
197 const ContentSettingsPattern& origin, 202 const ContentSettingsPattern& origin,
198 const ContentSettingsPattern& embedding_origin, 203 const ContentSettingsPattern& embedding_origin,
199 ContentSetting setting) { 204 ContentSetting setting) {
200 base::DictionaryValue* exception = new base::DictionaryValue(); 205 base::DictionaryValue* exception = new base::DictionaryValue();
201 exception->SetString(kSetting, ContentSettingToString(setting)); 206
207 std::string setting_string =
208 content_settings::ContentSettingToString(setting);
209 DCHECK(!setting_string.empty());
210
211 exception->SetString(kSetting, setting_string);
202 exception->SetString(kOrigin, origin.ToString()); 212 exception->SetString(kOrigin, origin.ToString());
203 exception->SetString(kEmbeddingOrigin, embedding_origin.ToString()); 213 exception->SetString(kEmbeddingOrigin, embedding_origin.ToString());
204 return make_scoped_ptr(exception); 214 return make_scoped_ptr(exception);
205 } 215 }
206 216
207 // Create a DictionaryValue* that will act as a data source for a single row 217 // Create a DictionaryValue* that will act as a data source for a single row
208 // in the desktop notifications exceptions table. 218 // in the desktop notifications exceptions table.
209 scoped_ptr<base::DictionaryValue> GetNotificationExceptionForPage( 219 scoped_ptr<base::DictionaryValue> GetNotificationExceptionForPage(
210 const ContentSettingsPattern& primary_pattern, 220 const ContentSettingsPattern& primary_pattern,
211 const ContentSettingsPattern& secondary_pattern, 221 const ContentSettingsPattern& secondary_pattern,
212 ContentSetting setting, 222 ContentSetting setting,
213 const std::string& provider_name) { 223 const std::string& provider_name) {
214 std::string embedding_origin; 224 std::string embedding_origin;
215 if (secondary_pattern != ContentSettingsPattern::Wildcard()) 225 if (secondary_pattern != ContentSettingsPattern::Wildcard())
216 embedding_origin = secondary_pattern.ToString(); 226 embedding_origin = secondary_pattern.ToString();
217 227
218 base::DictionaryValue* exception = new base::DictionaryValue(); 228 base::DictionaryValue* exception = new base::DictionaryValue();
219 exception->SetString(kSetting, ContentSettingToString(setting)); 229
230 std::string setting_string =
231 content_settings::ContentSettingToString(setting);
232 DCHECK(!setting_string.empty());
233
234 exception->SetString(kSetting, setting_string);
220 exception->SetString(kOrigin, primary_pattern.ToString()); 235 exception->SetString(kOrigin, primary_pattern.ToString());
221 exception->SetString(kEmbeddingOrigin, embedding_origin); 236 exception->SetString(kEmbeddingOrigin, embedding_origin);
222 exception->SetString(kSource, provider_name); 237 exception->SetString(kSource, provider_name);
223 return make_scoped_ptr(exception); 238 return make_scoped_ptr(exception);
224 } 239 }
225 240
226 // Returns true whenever the |extension| is hosted and has |permission|. 241 // Returns true whenever the |extension| is hosted and has |permission|.
227 // Must have the AppFilter signature. 242 // Must have the AppFilter signature.
228 template <APIPermission::ID permission> 243 template <APIPermission::ID permission>
229 bool HostedAppHasPermission(const extensions::Extension& extension, 244 bool HostedAppHasPermission(const extensions::Extension& extension,
230 content::BrowserContext* /* context */) { 245 content::BrowserContext* /* context */) {
231 return extension.is_hosted_app() && 246 return extension.is_hosted_app() &&
232 extension.permissions_data()->HasAPIPermission(permission); 247 extension.permissions_data()->HasAPIPermission(permission);
233 } 248 }
234 249
235 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from 250 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from
236 // the web extent of a hosted |app|. 251 // the web extent of a hosted |app|.
237 void AddExceptionForHostedApp(const std::string& url_pattern, 252 void AddExceptionForHostedApp(const std::string& url_pattern,
238 const extensions::Extension& app, base::ListValue* exceptions) { 253 const extensions::Extension& app, base::ListValue* exceptions) {
239 base::DictionaryValue* exception = new base::DictionaryValue(); 254 base::DictionaryValue* exception = new base::DictionaryValue();
240 exception->SetString(kSetting, ContentSettingToString(CONTENT_SETTING_ALLOW)); 255
256 std::string setting_string =
257 content_settings::ContentSettingToString(CONTENT_SETTING_ALLOW);
258 DCHECK(!setting_string.empty());
259
260 exception->SetString(kSetting, setting_string);
241 exception->SetString(kOrigin, url_pattern); 261 exception->SetString(kOrigin, url_pattern);
242 exception->SetString(kEmbeddingOrigin, url_pattern); 262 exception->SetString(kEmbeddingOrigin, url_pattern);
243 exception->SetString(kSource, "HostedApp"); 263 exception->SetString(kSource, "HostedApp");
244 exception->SetString(kAppName, app.name()); 264 exception->SetString(kAppName, app.name());
245 exception->SetString(kAppId, app.id()); 265 exception->SetString(kAppId, app.id());
246 exceptions->Append(exception); 266 exceptions->Append(exception);
247 } 267 }
248 268
249 // Asks the |profile| for hosted apps which have the |permission| set, and 269 // Asks the |profile| for hosted apps which have the |permission| set, and
250 // adds their web extent and launch URL to the |exceptions| list. 270 // adds their web extent and launch URL to the |exceptions| list.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 {"manageHandlers", IDS_HANDLERS_MANAGE}, 365 {"manageHandlers", IDS_HANDLERS_MANAGE},
346 {"exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER}, 366 {"exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER},
347 {"exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER}, 367 {"exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER},
348 {"exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER}, 368 {"exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER},
349 {"embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST}, 369 {"embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST},
350 // Cookies filter. 370 // Cookies filter.
351 {"cookiesTabLabel", IDS_COOKIES_TAB_LABEL}, 371 {"cookiesTabLabel", IDS_COOKIES_TAB_LABEL},
352 {"cookiesHeader", IDS_COOKIES_HEADER}, 372 {"cookiesHeader", IDS_COOKIES_HEADER},
353 {"cookiesAllow", IDS_COOKIES_ALLOW_RADIO}, 373 {"cookiesAllow", IDS_COOKIES_ALLOW_RADIO},
354 {"cookiesBlock", IDS_COOKIES_BLOCK_RADIO}, 374 {"cookiesBlock", IDS_COOKIES_BLOCK_RADIO},
355 {"cookiesSession", IDS_COOKIES_SESSION_ONLY_RADIO}, 375 {"cookiesSessionOnly", IDS_COOKIES_SESSION_ONLY_RADIO},
356 {"cookiesBlock3rdParty", IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX}, 376 {"cookiesBlock3rdParty", IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX},
357 {"cookiesShowCookies", IDS_COOKIES_SHOW_COOKIES_BUTTON}, 377 {"cookiesShowCookies", IDS_COOKIES_SHOW_COOKIES_BUTTON},
358 {"flashStorageSettings", IDS_FLASH_STORAGE_SETTINGS}, 378 {"flashStorageSettings", IDS_FLASH_STORAGE_SETTINGS},
359 {"flashStorageUrl", IDS_FLASH_STORAGE_URL}, 379 {"flashStorageUrl", IDS_FLASH_STORAGE_URL},
360 #if defined(ENABLE_GOOGLE_NOW) 380 #if defined(ENABLE_GOOGLE_NOW)
361 {"googleGeolocationAccessEnable", 381 {"googleGeolocationAccessEnable",
362 IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX}, 382 IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX},
363 #endif 383 #endif
364 // Image filter. 384 // Image filter.
365 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL}, 385 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL},
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS) 487 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS)
468 ->default_value_pref_name()); 488 ->default_value_pref_name());
469 489
470 int default_value = CONTENT_SETTING_DEFAULT; 490 int default_value = CONTENT_SETTING_DEFAULT;
471 bool success = default_pref->GetAsInteger(&default_value); 491 bool success = default_pref->GetAsInteger(&default_value);
472 DCHECK(success); 492 DCHECK(success);
473 DCHECK_NE(CONTENT_SETTING_DEFAULT, default_value); 493 DCHECK_NE(CONTENT_SETTING_DEFAULT, default_value);
474 494
475 int plugin_ids = default_value == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT ? 495 int plugin_ids = default_value == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT ?
476 IDS_PLUGIN_DETECT_RECOMMENDED_RADIO : IDS_PLUGIN_DETECT_RADIO; 496 IDS_PLUGIN_DETECT_RECOMMENDED_RADIO : IDS_PLUGIN_DETECT_RADIO;
477 localized_strings->SetString("pluginsDetect", 497 localized_strings->SetString("pluginsDetectImportantContent",
478 l10n_util::GetStringUTF16(plugin_ids)); 498 l10n_util::GetStringUTF16(plugin_ids));
479 499
480 RegisterTitle(localized_strings, "contentSettingsPage", 500 RegisterTitle(localized_strings, "contentSettingsPage",
481 IDS_CONTENT_SETTINGS_TITLE); 501 IDS_CONTENT_SETTINGS_TITLE);
482 502
483 // Register titles for each of the individual settings whose exception 503 // Register titles for each of the individual settings whose exception
484 // dialogs will be processed by |ContentSettingsHandler|. 504 // dialogs will be processed by |ContentSettingsHandler|.
485 RegisterTitle(localized_strings, "cookies", 505 RegisterTitle(localized_strings, "cookies",
486 IDS_COOKIES_TAB_LABEL); 506 IDS_COOKIES_TAB_LABEL);
487 RegisterTitle(localized_strings, "images", 507 RegisterTitle(localized_strings, "images",
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || 728 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC ||
709 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) { 729 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
710 UpdateMediaSettingsFromPrefs(type); 730 UpdateMediaSettingsFromPrefs(type);
711 if (media_settings_->forType(type).policy_disable) { 731 if (media_settings_->forType(type).policy_disable) {
712 default_setting = CONTENT_SETTING_BLOCK; 732 default_setting = CONTENT_SETTING_BLOCK;
713 provider_id = kPolicyProviderId; 733 provider_id = kPolicyProviderId;
714 } 734 }
715 } 735 }
716 736
717 base::DictionaryValue filter_settings; 737 base::DictionaryValue filter_settings;
738
739 std::string setting_string =
740 content_settings::ContentSettingToString(default_setting);
741 DCHECK(!setting_string.empty());
742
718 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", 743 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value",
719 ContentSettingToString(default_setting)); 744 setting_string);
720 filter_settings.SetString( 745 filter_settings.SetString(
721 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); 746 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id);
722 747
723 web_ui()->CallJavascriptFunction( 748 web_ui()->CallJavascriptFunction(
724 "ContentSettings.setContentFilterSettingsValue", filter_settings); 749 "ContentSettings.setContentFilterSettingsValue", filter_settings);
725 } 750 }
726 751
727 void ContentSettingsHandler::UpdateMediaSettingsFromPrefs( 752 void ContentSettingsHandler::UpdateMediaSettingsFromPrefs(
728 ContentSettingsType type) { 753 ContentSettingsType type) {
729 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 754 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 entry != exceptions.end(); ++entry) { 937 entry != exceptions.end(); ++entry) {
913 base::DictionaryValue* dict = nullptr; 938 base::DictionaryValue* dict = nullptr;
914 bool valid_dict = (*entry)->GetAsDictionary(&dict); 939 bool valid_dict = (*entry)->GetAsDictionary(&dict);
915 DCHECK(valid_dict); 940 DCHECK(valid_dict);
916 941
917 std::string origin; 942 std::string origin;
918 std::string setting; 943 std::string setting;
919 dict->GetString(kOrigin, &origin); 944 dict->GetString(kOrigin, &origin);
920 dict->GetString(kSetting, &setting); 945 dict->GetString(kSetting, &setting);
921 946
947 ContentSetting setting_type;
948 bool result =
949 content_settings::ContentSettingFromString(setting, &setting_type);
950 DCHECK(result);
951
922 settings.exceptions.push_back(MediaException( 952 settings.exceptions.push_back(MediaException(
923 ContentSettingsPattern::FromString(origin), 953 ContentSettingsPattern::FromString(origin),
924 ContentSettingFromString(setting))); 954 setting_type));
925 } 955 }
926 956
927 PepperFlashContentSettingsUtils::SortMediaExceptions( 957 PepperFlashContentSettingsUtils::SortMediaExceptions(
928 &settings.exceptions); 958 &settings.exceptions);
929 959
930 settings.exceptions_initialized = true; 960 settings.exceptions_initialized = true;
931 UpdateFlashMediaLinksVisibility(type); 961 UpdateFlashMediaLinksVisibility(type);
932 } 962 }
933 963
934 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() { 964 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1040 }
1011 case content::HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST: 1041 case content::HostZoomMap::ZOOM_CHANGED_FOR_SCHEME_AND_HOST:
1012 // These are not stored in preferences and get cleared on next browser 1042 // These are not stored in preferences and get cleared on next browser
1013 // start. Therefore, we don't care for them. 1043 // start. Therefore, we don't care for them.
1014 continue; 1044 continue;
1015 case content::HostZoomMap::PAGE_SCALE_IS_ONE_CHANGED: 1045 case content::HostZoomMap::PAGE_SCALE_IS_ONE_CHANGED:
1016 continue; 1046 continue;
1017 case content::HostZoomMap::ZOOM_CHANGED_TEMPORARY_ZOOM: 1047 case content::HostZoomMap::ZOOM_CHANGED_TEMPORARY_ZOOM:
1018 NOTREACHED(); 1048 NOTREACHED();
1019 } 1049 }
1020 exception->SetString(kSetting, 1050
1021 ContentSettingToString(CONTENT_SETTING_DEFAULT)); 1051 std::string setting_string =
1052 content_settings::ContentSettingToString(CONTENT_SETTING_DEFAULT);
1053 DCHECK(!setting_string.empty());
1054
1055 exception->SetString(kSetting, setting_string);
1022 1056
1023 // Calculate the zoom percent from the factor. Round up to the nearest whole 1057 // Calculate the zoom percent from the factor. Round up to the nearest whole
1024 // number. 1058 // number.
1025 int zoom_percent = static_cast<int>( 1059 int zoom_percent = static_cast<int>(
1026 content::ZoomLevelToZoomFactor(i->zoom_level) * 100 + 0.5); 1060 content::ZoomLevelToZoomFactor(i->zoom_level) * 100 + 0.5);
1027 exception->SetString( 1061 exception->SetString(
1028 kZoom, 1062 kZoom,
1029 l10n_util::GetStringFUTF16(IDS_ZOOM_PERCENT, 1063 l10n_util::GetStringFUTF16(IDS_ZOOM_PERCENT,
1030 base::IntToString16(zoom_percent))); 1064 base::IntToString16(zoom_percent)));
1031 exception->SetString(kSource, kPreferencesSource); 1065 exception->SetString(kSource, kPreferencesSource);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1348
1315 void ContentSettingsHandler::SetContentFilter(const base::ListValue* args) { 1349 void ContentSettingsHandler::SetContentFilter(const base::ListValue* args) {
1316 DCHECK_EQ(2U, args->GetSize()); 1350 DCHECK_EQ(2U, args->GetSize());
1317 std::string group, setting; 1351 std::string group, setting;
1318 if (!(args->GetString(0, &group) && 1352 if (!(args->GetString(0, &group) &&
1319 args->GetString(1, &setting))) { 1353 args->GetString(1, &setting))) {
1320 NOTREACHED(); 1354 NOTREACHED();
1321 return; 1355 return;
1322 } 1356 }
1323 1357
1324 ContentSetting default_setting = ContentSettingFromString(setting); 1358 ContentSetting default_setting;
1359 bool result =
1360 content_settings::ContentSettingFromString(setting, &default_setting);
1361 DCHECK(result);
1362
1325 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); 1363 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group);
1326 Profile* profile = Profile::FromWebUI(web_ui()); 1364 Profile* profile = Profile::FromWebUI(web_ui());
1327 1365
1328 #if defined(OS_CHROMEOS) 1366 #if defined(OS_CHROMEOS)
1329 // ChromeOS special case : in Guest mode settings are opened in Incognito 1367 // ChromeOS special case : in Guest mode settings are opened in Incognito
1330 // mode, so we need original profile to actually modify settings. 1368 // mode, so we need original profile to actually modify settings.
1331 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) 1369 if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
1332 profile = profile->GetOriginalProfile(); 1370 profile = profile->GetOriginalProfile();
1333 #endif 1371 #endif
1334 1372
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 NOTREACHED(); 1475 NOTREACHED();
1438 } else { 1476 } else {
1439 HostContentSettingsMap* settings_map = 1477 HostContentSettingsMap* settings_map =
1440 mode == "normal" ? GetContentSettingsMap() : 1478 mode == "normal" ? GetContentSettingsMap() :
1441 GetOTRContentSettingsMap(); 1479 GetOTRContentSettingsMap();
1442 1480
1443 // The settings map could be null if the mode was OTR but the OTR profile 1481 // The settings map could be null if the mode was OTR but the OTR profile
1444 // got destroyed before we received this message. 1482 // got destroyed before we received this message.
1445 if (!settings_map) 1483 if (!settings_map)
1446 return; 1484 return;
1485
1486 ContentSetting setting_type;
1487 bool result =
1488 content_settings::ContentSettingFromString(setting, &setting_type);
1489 DCHECK(result);
1490
1447 settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), 1491 settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern),
1448 ContentSettingsPattern::Wildcard(), 1492 ContentSettingsPattern::Wildcard(),
1449 type, 1493 type,
1450 std::string(), 1494 std::string(),
1451 ContentSettingFromString(setting)); 1495 setting_type);
1452 } 1496 }
1453 } 1497 }
1454 1498
1455 void ContentSettingsHandler::CheckExceptionPatternValidity( 1499 void ContentSettingsHandler::CheckExceptionPatternValidity(
1456 const base::ListValue* args) { 1500 const base::ListValue* args) {
1457 std::string type_string; 1501 std::string type_string;
1458 CHECK(args->GetString(0, &type_string)); 1502 CHECK(args->GetString(0, &type_string));
1459 std::string mode_string; 1503 std::string mode_string;
1460 CHECK(args->GetString(1, &mode_string)); 1504 CHECK(args->GetString(1, &mode_string));
1461 std::string pattern_string; 1505 std::string pattern_string;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 1666
1623 // Exceptions apply only when the feature is enabled. 1667 // Exceptions apply only when the feature is enabled.
1624 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1668 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1625 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1669 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1626 web_ui()->CallJavascriptFunction( 1670 web_ui()->CallJavascriptFunction(
1627 "ContentSettings.enableProtectedContentExceptions", 1671 "ContentSettings.enableProtectedContentExceptions",
1628 base::FundamentalValue(enable_exceptions)); 1672 base::FundamentalValue(enable_exceptions));
1629 } 1673 }
1630 1674
1631 } // namespace options 1675 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/content_settings_exceptions_area.js ('k') | chrome/test/data/policy/policy_test_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698