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> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/bind_helpers.h" | 15 #include "base/bind_helpers.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/i18n/number_formatting.h" | 17 #include "base/i18n/number_formatting.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/user_metrics.h" |
21 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
22 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
23 #include "base/values.h" | 24 #include "base/values.h" |
24 #include "build/build_config.h" | 25 #include "build/build_config.h" |
25 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 28 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
28 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" | 29 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" |
29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 30 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
30 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 31 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
(...skipping 26 matching lines...) Expand all Loading... |
57 #include "components/content_settings/core/common/content_settings.h" | 58 #include "components/content_settings/core/common/content_settings.h" |
58 #include "components/content_settings/core/common/content_settings_pattern.h" | 59 #include "components/content_settings/core/common/content_settings_pattern.h" |
59 #include "components/google/core/browser/google_util.h" | 60 #include "components/google/core/browser/google_util.h" |
60 #include "components/prefs/pref_service.h" | 61 #include "components/prefs/pref_service.h" |
61 #include "components/signin/core/common/profile_management_switches.h" | 62 #include "components/signin/core/common/profile_management_switches.h" |
62 #include "components/user_prefs/user_prefs.h" | 63 #include "components/user_prefs/user_prefs.h" |
63 #include "content/public/browser/notification_service.h" | 64 #include "content/public/browser/notification_service.h" |
64 #include "content/public/browser/notification_source.h" | 65 #include "content/public/browser/notification_source.h" |
65 #include "content/public/browser/notification_types.h" | 66 #include "content/public/browser/notification_types.h" |
66 #include "content/public/browser/storage_partition.h" | 67 #include "content/public/browser/storage_partition.h" |
67 #include "content/public/browser/user_metrics.h" | |
68 #include "content/public/browser/web_contents.h" | 68 #include "content/public/browser/web_contents.h" |
69 #include "content/public/browser/web_ui.h" | 69 #include "content/public/browser/web_ui.h" |
70 #include "content/public/common/content_switches.h" | 70 #include "content/public/common/content_switches.h" |
71 #include "content/public/common/page_zoom.h" | 71 #include "content/public/common/page_zoom.h" |
72 #include "content/public/common/url_constants.h" | 72 #include "content/public/common/url_constants.h" |
73 #include "extensions/browser/extension_registry.h" | 73 #include "extensions/browser/extension_registry.h" |
74 #include "extensions/common/extension_set.h" | 74 #include "extensions/common/extension_set.h" |
75 #include "extensions/common/permissions/api_permission.h" | 75 #include "extensions/common/permissions/api_permission.h" |
76 #include "extensions/common/permissions/permissions_data.h" | 76 #include "extensions/common/permissions/permissions_data.h" |
77 #include "ppapi/features/features.h" | 77 #include "ppapi/features/features.h" |
(...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 profile = profile->GetOriginalProfile(); | 1255 profile = profile->GetOriginalProfile(); |
1256 #endif | 1256 #endif |
1257 | 1257 |
1258 HostContentSettingsMap* map = | 1258 HostContentSettingsMap* map = |
1259 HostContentSettingsMapFactory::GetForProfile(profile); | 1259 HostContentSettingsMapFactory::GetForProfile(profile); |
1260 map->SetDefaultContentSetting(content_type, default_setting); | 1260 map->SetDefaultContentSetting(content_type, default_setting); |
1261 | 1261 |
1262 const ExceptionsInfoMap& exceptions_info_map = GetExceptionsInfoMap(); | 1262 const ExceptionsInfoMap& exceptions_info_map = GetExceptionsInfoMap(); |
1263 const auto& it = exceptions_info_map.find(content_type); | 1263 const auto& it = exceptions_info_map.find(content_type); |
1264 if (it != exceptions_info_map.end()) | 1264 if (it != exceptions_info_map.end()) |
1265 content::RecordAction(it->second.uma); | 1265 base::RecordAction(it->second.uma); |
1266 } | 1266 } |
1267 | 1267 |
1268 void ContentSettingsHandler::RemoveException(const base::ListValue* args) { | 1268 void ContentSettingsHandler::RemoveException(const base::ListValue* args) { |
1269 std::string type_string; | 1269 std::string type_string; |
1270 CHECK(args->GetString(0, &type_string)); | 1270 CHECK(args->GetString(0, &type_string)); |
1271 | 1271 |
1272 // Zoom levels are no actual content type so we need to handle them | 1272 // Zoom levels are no actual content type so we need to handle them |
1273 // separately. They would not be recognized by | 1273 // separately. They would not be recognized by |
1274 // ContentSettingsTypeFromGroupName. | 1274 // ContentSettingsTypeFromGroupName. |
1275 if (type_string == kZoomContentType) { | 1275 if (type_string == kZoomContentType) { |
(...skipping 209 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 |