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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 const auto* extension_registry = | 934 const auto* extension_registry = |
935 extensions::ExtensionRegistry::Get(GetProfile()); | 935 extensions::ExtensionRegistry::Get(GetProfile()); |
936 base::ListValue exceptions; | 936 base::ListValue exceptions; |
937 site_settings::GetExceptionsFromHostContentSettingsMap( | 937 site_settings::GetExceptionsFromHostContentSettingsMap( |
938 settings_map, type, extension_registry, web_ui(), /*incognito=*/false, | 938 settings_map, type, extension_registry, web_ui(), /*incognito=*/false, |
939 /*filter=*/nullptr, &exceptions); | 939 /*filter=*/nullptr, &exceptions); |
940 | 940 |
941 settings.exceptions.clear(); | 941 settings.exceptions.clear(); |
942 for (base::ListValue::const_iterator entry = exceptions.begin(); | 942 for (base::ListValue::const_iterator entry = exceptions.begin(); |
943 entry != exceptions.end(); ++entry) { | 943 entry != exceptions.end(); ++entry) { |
944 base::DictionaryValue* dict = nullptr; | 944 const base::DictionaryValue* dict = nullptr; |
945 bool valid_dict = (*entry)->GetAsDictionary(&dict); | 945 bool valid_dict = entry->GetAsDictionary(&dict); |
946 DCHECK(valid_dict); | 946 DCHECK(valid_dict); |
947 | 947 |
948 std::string origin; | 948 std::string origin; |
949 std::string setting; | 949 std::string setting; |
950 dict->GetString(site_settings::kOrigin, &origin); | 950 dict->GetString(site_settings::kOrigin, &origin); |
951 dict->GetString(site_settings::kSetting, &setting); | 951 dict->GetString(site_settings::kSetting, &setting); |
952 | 952 |
953 ContentSetting setting_type; | 953 ContentSetting setting_type; |
954 bool result = | 954 bool result = |
955 content_settings::ContentSettingFromString(setting, &setting_type); | 955 content_settings::ContentSettingFromString(setting, &setting_type); |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 | 1485 |
1486 // Exceptions apply only when the feature is enabled. | 1486 // Exceptions apply only when the feature is enabled. |
1487 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1487 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1488 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1488 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1489 web_ui()->CallJavascriptFunctionUnsafe( | 1489 web_ui()->CallJavascriptFunctionUnsafe( |
1490 "ContentSettings.enableProtectedContentExceptions", | 1490 "ContentSettings.enableProtectedContentExceptions", |
1491 base::Value(enable_exceptions)); | 1491 base::Value(enable_exceptions)); |
1492 } | 1492 } |
1493 | 1493 |
1494 } // namespace options | 1494 } // namespace options |
OLD | NEW |