| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/values.h" | 21 #include "base/values.h" |
| 21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 25 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 25 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" | 26 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" |
| 26 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 27 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| (...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 bool result = | 1512 bool result = |
| 1512 content_settings::ContentSettingFromString(setting, &setting_type); | 1513 content_settings::ContentSettingFromString(setting, &setting_type); |
| 1513 DCHECK(result); | 1514 DCHECK(result); |
| 1514 | 1515 |
| 1515 settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), | 1516 settings_map->SetContentSetting(ContentSettingsPattern::FromString(pattern), |
| 1516 ContentSettingsPattern::Wildcard(), | 1517 ContentSettingsPattern::Wildcard(), |
| 1517 type, | 1518 type, |
| 1518 std::string(), | 1519 std::string(), |
| 1519 setting_type); | 1520 setting_type); |
| 1520 WebSiteSettingsUmaUtil::LogPermissionChange(type, setting_type); | 1521 WebSiteSettingsUmaUtil::LogPermissionChange(type, setting_type); |
| 1522 |
| 1523 size_t num_values; |
| 1524 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
| 1525 UMA_HISTOGRAM_ENUMERATION("ContentSettings.AddManualException", |
| 1526 histogram_value, num_values); |
| 1521 } | 1527 } |
| 1522 } | 1528 } |
| 1523 | 1529 |
| 1524 void ContentSettingsHandler::CheckExceptionPatternValidity( | 1530 void ContentSettingsHandler::CheckExceptionPatternValidity( |
| 1525 const base::ListValue* args) { | 1531 const base::ListValue* args) { |
| 1526 std::string type_string; | 1532 std::string type_string; |
| 1527 CHECK(args->GetString(0, &type_string)); | 1533 CHECK(args->GetString(0, &type_string)); |
| 1528 std::string mode_string; | 1534 std::string mode_string; |
| 1529 CHECK(args->GetString(1, &mode_string)); | 1535 CHECK(args->GetString(1, &mode_string)); |
| 1530 std::string pattern_string; | 1536 std::string pattern_string; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 | 1697 |
| 1692 // Exceptions apply only when the feature is enabled. | 1698 // Exceptions apply only when the feature is enabled. |
| 1693 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1699 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1694 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1700 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1695 web_ui()->CallJavascriptFunction( | 1701 web_ui()->CallJavascriptFunction( |
| 1696 "ContentSettings.enableProtectedContentExceptions", | 1702 "ContentSettings.enableProtectedContentExceptions", |
| 1697 base::FundamentalValue(enable_exceptions)); | 1703 base::FundamentalValue(enable_exceptions)); |
| 1698 } | 1704 } |
| 1699 | 1705 |
| 1700 } // namespace options | 1706 } // namespace options |
| OLD | NEW |