| 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 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 std::string secondary_pattern; | 1333 std::string secondary_pattern; |
| 1334 if (args->GetSize() >= 4U) { | 1334 if (args->GetSize() >= 4U) { |
| 1335 rv = args->GetString(3, &secondary_pattern); | 1335 rv = args->GetString(3, &secondary_pattern); |
| 1336 DCHECK(rv); | 1336 DCHECK(rv); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 HostContentSettingsMap* settings_map = | 1339 HostContentSettingsMap* settings_map = |
| 1340 mode == "normal" ? GetContentSettingsMap() : | 1340 mode == "normal" ? GetContentSettingsMap() : |
| 1341 GetOTRContentSettingsMap(); | 1341 GetOTRContentSettingsMap(); |
| 1342 if (settings_map) { | 1342 if (settings_map) { |
| 1343 settings_map->SetContentSetting( | 1343 settings_map->SetContentSettingCustomScope( |
| 1344 ContentSettingsPattern::FromString(pattern), | 1344 ContentSettingsPattern::FromString(pattern), |
| 1345 secondary_pattern.empty() | 1345 secondary_pattern.empty() |
| 1346 ? ContentSettingsPattern::Wildcard() | 1346 ? ContentSettingsPattern::Wildcard() |
| 1347 : ContentSettingsPattern::FromString(secondary_pattern), | 1347 : ContentSettingsPattern::FromString(secondary_pattern), |
| 1348 type, std::string(), CONTENT_SETTING_DEFAULT); | 1348 type, std::string(), CONTENT_SETTING_DEFAULT); |
| 1349 } | 1349 } |
| 1350 } | 1350 } |
| 1351 | 1351 |
| 1352 void ContentSettingsHandler::RemoveZoomLevelException( | 1352 void ContentSettingsHandler::RemoveZoomLevelException( |
| 1353 const base::ListValue* args) { | 1353 const base::ListValue* args) { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 // The settings map could be null if the mode was OTR but the OTR profile | 1505 // The settings map could be null if the mode was OTR but the OTR profile |
| 1506 // got destroyed before we received this message. | 1506 // got destroyed before we received this message. |
| 1507 if (!settings_map) | 1507 if (!settings_map) |
| 1508 return; | 1508 return; |
| 1509 | 1509 |
| 1510 ContentSetting setting_type; | 1510 ContentSetting setting_type; |
| 1511 bool result = | 1511 bool result = |
| 1512 content_settings::ContentSettingFromString(setting, &setting_type); | 1512 content_settings::ContentSettingFromString(setting, &setting_type); |
| 1513 DCHECK(result); | 1513 DCHECK(result); |
| 1514 | 1514 |
| 1515 settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), | 1515 settings_map->SetContentSettingCustomScope( |
| 1516 ContentSettingsPattern::Wildcard(), | 1516 ContentSettingsPattern::FromString(pattern), |
| 1517 type, | 1517 ContentSettingsPattern::Wildcard(), type, std::string(), setting_type); |
| 1518 std::string(), | |
| 1519 setting_type); | |
| 1520 WebSiteSettingsUmaUtil::LogPermissionChange(type, setting_type); | 1518 WebSiteSettingsUmaUtil::LogPermissionChange(type, setting_type); |
| 1521 } | 1519 } |
| 1522 } | 1520 } |
| 1523 | 1521 |
| 1524 void ContentSettingsHandler::CheckExceptionPatternValidity( | 1522 void ContentSettingsHandler::CheckExceptionPatternValidity( |
| 1525 const base::ListValue* args) { | 1523 const base::ListValue* args) { |
| 1526 std::string type_string; | 1524 std::string type_string; |
| 1527 CHECK(args->GetString(0, &type_string)); | 1525 CHECK(args->GetString(0, &type_string)); |
| 1528 std::string mode_string; | 1526 std::string mode_string; |
| 1529 CHECK(args->GetString(1, &mode_string)); | 1527 CHECK(args->GetString(1, &mode_string)); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 | 1689 |
| 1692 // Exceptions apply only when the feature is enabled. | 1690 // Exceptions apply only when the feature is enabled. |
| 1693 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1691 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1694 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1692 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1695 web_ui()->CallJavascriptFunction( | 1693 web_ui()->CallJavascriptFunction( |
| 1696 "ContentSettings.enableProtectedContentExceptions", | 1694 "ContentSettings.enableProtectedContentExceptions", |
| 1697 base::FundamentalValue(enable_exceptions)); | 1695 base::FundamentalValue(enable_exceptions)); |
| 1698 } | 1696 } |
| 1699 | 1697 |
| 1700 } // namespace options | 1698 } // namespace options |
| OLD | NEW |