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

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

Issue 2338163004: [MD settings] add getSiteDetails to site settings browser proxy (Closed)
Patch Set: review changes Created 4 years, 3 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 <map>
10 #include <utility> 11 #include <utility>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/bind.h" 14 #include "base/bind.h"
14 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
15 #include "base/command_line.h" 16 #include "base/command_line.h"
16 #include "base/i18n/number_formatting.h" 17 #include "base/i18n/number_formatting.h"
17 #include "base/logging.h" 18 #include "base/logging.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 942 }
942 943
943 void ContentSettingsHandler::CompareMediaExceptionsWithFlash( 944 void ContentSettingsHandler::CompareMediaExceptionsWithFlash(
944 ContentSettingsType type) { 945 ContentSettingsType type) {
945 MediaSettingsInfo::ForOneType& settings = media_settings_->forType(type); 946 MediaSettingsInfo::ForOneType& settings = media_settings_->forType(type);
946 HostContentSettingsMap* settings_map = 947 HostContentSettingsMap* settings_map =
947 HostContentSettingsMapFactory::GetForProfile(GetProfile()); 948 HostContentSettingsMapFactory::GetForProfile(GetProfile());
948 949
949 base::ListValue exceptions; 950 base::ListValue exceptions;
950 site_settings::GetExceptionsFromHostContentSettingsMap(settings_map, type, 951 site_settings::GetExceptionsFromHostContentSettingsMap(settings_map, type,
951 web_ui(), /*incognito=*/ false, &exceptions); 952 web_ui(), /*incognito=*/false, /*filter=*/nullptr, &exceptions);
952 953
953 settings.exceptions.clear(); 954 settings.exceptions.clear();
954 for (base::ListValue::const_iterator entry = exceptions.begin(); 955 for (base::ListValue::const_iterator entry = exceptions.begin();
955 entry != exceptions.end(); ++entry) { 956 entry != exceptions.end(); ++entry) {
956 base::DictionaryValue* dict = nullptr; 957 base::DictionaryValue* dict = nullptr;
957 bool valid_dict = (*entry)->GetAsDictionary(&dict); 958 bool valid_dict = (*entry)->GetAsDictionary(&dict);
958 DCHECK(valid_dict); 959 DCHECK(valid_dict);
959 960
960 std::string origin; 961 std::string origin;
961 std::string setting; 962 std::string setting;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", 1087 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions",
1087 type_string, zoom_levels_exceptions); 1088 type_string, zoom_levels_exceptions);
1088 } 1089 }
1089 1090
1090 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( 1091 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap(
1091 ContentSettingsType type) { 1092 ContentSettingsType type) {
1092 base::ListValue exceptions; 1093 base::ListValue exceptions;
1093 HostContentSettingsMap* settings_map = 1094 HostContentSettingsMap* settings_map =
1094 HostContentSettingsMapFactory::GetForProfile(GetProfile()); 1095 HostContentSettingsMapFactory::GetForProfile(GetProfile());
1095 site_settings::GetExceptionsFromHostContentSettingsMap(settings_map, type, 1096 site_settings::GetExceptionsFromHostContentSettingsMap(settings_map, type,
1096 web_ui(), /*incognito=*/ false, &exceptions); 1097 web_ui(), /*incognito=*/false, /*filter=*/nullptr, &exceptions);
1097 base::StringValue type_string( 1098 base::StringValue type_string(
1098 site_settings::ContentSettingsTypeToGroupName(type)); 1099 site_settings::ContentSettingsTypeToGroupName(type));
1099 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", 1100 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions",
1100 type_string, exceptions); 1101 type_string, exceptions);
1101 1102
1102 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); 1103 UpdateExceptionsViewFromOTRHostContentSettingsMap(type);
1103 1104
1104 // Fullscreen and mouse lock have no global settings to update. 1105 // Fullscreen and mouse lock have no global settings to update.
1105 // TODO(mgiuca): Delete this after removing these content settings entirely 1106 // TODO(mgiuca): Delete this after removing these content settings entirely
1106 // (https://crbug.com/591896). 1107 // (https://crbug.com/591896).
(...skipping 14 matching lines...) Expand all
1121 } 1122 }
1122 1123
1123 void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap( 1124 void ContentSettingsHandler::UpdateExceptionsViewFromOTRHostContentSettingsMap(
1124 ContentSettingsType type) { 1125 ContentSettingsType type) {
1125 const HostContentSettingsMap* otr_settings_map = 1126 const HostContentSettingsMap* otr_settings_map =
1126 HostContentSettingsMapFactory::GetForProfile(GetOTRProfile()); 1127 HostContentSettingsMapFactory::GetForProfile(GetOTRProfile());
1127 if (!otr_settings_map) 1128 if (!otr_settings_map)
1128 return; 1129 return;
1129 base::ListValue exceptions; 1130 base::ListValue exceptions;
1130 site_settings::GetExceptionsFromHostContentSettingsMap(otr_settings_map, type, 1131 site_settings::GetExceptionsFromHostContentSettingsMap(otr_settings_map, type,
1131 web_ui(), /*incognito=*/ true, &exceptions); 1132 web_ui(), /*incognito=*/true, /*filter=*/nullptr, &exceptions);
1132 base::StringValue type_string( 1133 base::StringValue type_string(
1133 site_settings::ContentSettingsTypeToGroupName(type)); 1134 site_settings::ContentSettingsTypeToGroupName(type));
1134 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setOTRExceptions", 1135 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setOTRExceptions",
1135 type_string, exceptions); 1136 type_string, exceptions);
1136 } 1137 }
1137 1138
1138 void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap( 1139 void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap(
1139 const base::ListValue* args, 1140 const base::ListValue* args,
1140 ContentSettingsType type) { 1141 ContentSettingsType type) {
1141 std::string mode; 1142 std::string mode;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 1504
1504 // Exceptions apply only when the feature is enabled. 1505 // Exceptions apply only when the feature is enabled.
1505 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1506 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1506 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1507 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1507 web_ui()->CallJavascriptFunctionUnsafe( 1508 web_ui()->CallJavascriptFunctionUnsafe(
1508 "ContentSettings.enableProtectedContentExceptions", 1509 "ContentSettings.enableProtectedContentExceptions",
1509 base::FundamentalValue(enable_exceptions)); 1510 base::FundamentalValue(enable_exceptions));
1510 } 1511 }
1511 1512
1512 } // namespace options 1513 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698