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

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

Issue 264713008: options: fix content settings exceptions dialog regression. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 const base::ListValue* args, 1202 const base::ListValue* args,
1203 ContentSettingsType type) { 1203 ContentSettingsType type) {
1204 std::string mode; 1204 std::string mode;
1205 bool rv = args->GetString(1, &mode); 1205 bool rv = args->GetString(1, &mode);
1206 DCHECK(rv); 1206 DCHECK(rv);
1207 1207
1208 std::string pattern; 1208 std::string pattern;
1209 rv = args->GetString(2, &pattern); 1209 rv = args->GetString(2, &pattern);
1210 DCHECK(rv); 1210 DCHECK(rv);
1211 1211
1212 // The third argument to this handler is optional. 1212 // The fourth argument to this handler is optional.
1213 std::string secondary_pattern; 1213 std::string secondary_pattern;
1214 if (args->GetSize() == 3U) { 1214 if (args->GetSize() >= 4U) {
Dan Beam 2014/05/01 23:43:33 ^ the fix that took me 3s to write
Lei Zhang 2014/05/01 23:54:30 Curious, what's args->GetString(0, &foo) ?
Dan Beam 2014/05/02 00:43:15 see below
1215 rv = args->GetString(3, &secondary_pattern); 1215 rv = args->GetString(3, &secondary_pattern);
1216 DCHECK(rv); 1216 DCHECK(rv);
1217 } 1217 }
1218 1218
1219 HostContentSettingsMap* settings_map = 1219 HostContentSettingsMap* settings_map =
1220 mode == "normal" ? GetContentSettingsMap() : 1220 mode == "normal" ? GetContentSettingsMap() :
1221 GetOTRContentSettingsMap(); 1221 GetOTRContentSettingsMap();
1222 if (settings_map) { 1222 if (settings_map) {
1223 settings_map->SetWebsiteSetting( 1223 settings_map->SetWebsiteSetting(
1224 ContentSettingsPattern::FromString(pattern), 1224 ContentSettingsPattern::FromString(pattern),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 content::RecordAction( 1364 content::RecordAction(
1365 UserMetricsAction("Options_DefaultMIDISysExSettingChanged")); 1365 UserMetricsAction("Options_DefaultMIDISysExSettingChanged"));
1366 break; 1366 break;
1367 default: 1367 default:
1368 break; 1368 break;
1369 } 1369 }
1370 } 1370 }
1371 1371
1372 void ContentSettingsHandler::RemoveException(const base::ListValue* args) { 1372 void ContentSettingsHandler::RemoveException(const base::ListValue* args) {
1373 std::string type_string; 1373 std::string type_string;
1374 CHECK(args->GetString(0, &type_string)); 1374 CHECK(args->GetString(0, &type_string));
Dan Beam 2014/05/02 00:43:15 ^ the type of exception to remove (e.g. "cookies",
1375 1375
1376 // Zoom levels are no actual content type so we need to handle them 1376 // Zoom levels are no actual content type so we need to handle them
1377 // separately. They would not be recognized by 1377 // separately. They would not be recognized by
1378 // ContentSettingsTypeFromGroupName. 1378 // ContentSettingsTypeFromGroupName.
1379 if (type_string == kZoomContentType) { 1379 if (type_string == kZoomContentType) {
1380 RemoveZoomLevelException(args); 1380 RemoveZoomLevelException(args);
1381 return; 1381 return;
1382 } 1382 }
1383 1383
1384 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); 1384 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { 1564 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
1565 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 1565 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
1566 // Exceptions apply only when the feature is enabled. 1566 // Exceptions apply only when the feature is enabled.
1567 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1567 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1568 web_ui()->CallJavascriptFunction( 1568 web_ui()->CallJavascriptFunction(
1569 "ContentSettings.enableProtectedContentExceptions", 1569 "ContentSettings.enableProtectedContentExceptions",
1570 base::FundamentalValue(enable_exceptions)); 1570 base::FundamentalValue(enable_exceptions));
1571 } 1571 }
1572 1572
1573 } // namespace options 1573 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698