Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/metrics/histogram.h" | |
| 14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/values.h" | 18 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 21 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" | 22 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" |
| 22 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 23 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 24 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1411 if (type_string == kZoomContentType) { | 1412 if (type_string == kZoomContentType) { |
| 1412 RemoveZoomLevelException(args); | 1413 RemoveZoomLevelException(args); |
| 1413 return; | 1414 return; |
| 1414 } | 1415 } |
| 1415 | 1416 |
| 1416 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); | 1417 ContentSettingsType type = ContentSettingsTypeFromGroupName(type_string); |
| 1417 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) | 1418 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) |
| 1418 RemoveMediaException(args); | 1419 RemoveMediaException(args); |
| 1419 else | 1420 else |
| 1420 RemoveExceptionFromHostContentSettingsMap(args, type); | 1421 RemoveExceptionFromHostContentSettingsMap(args, type); |
| 1422 ContentSettingsTypeHistogram histogram_value = | |
|
Finnur
2015/02/23 14:15:27
nit: Line-break above (looks as-is a bit like part
Miguel Garcia
2015/02/23 14:35:21
Done.
| |
| 1423 ContentSettingTypeToHistogramValue(type); | |
|
Finnur
2015/02/23 14:15:27
In the other place, you DCHECK if you get an inval
Miguel Garcia
2015/02/23 14:35:21
Done.
| |
| 1424 | |
| 1425 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged", | |
| 1426 histogram_value, | |
| 1427 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES); | |
| 1428 | |
| 1429 UMA_HISTOGRAM_ENUMERATION( | |
| 1430 "WebsiteSettings.ContentSettings.PermissionChanged.Ask", histogram_value, | |
|
Finnur
2015/02/23 14:15:27
Same here: s/Ask/Reset/
Miguel Garcia
2015/02/23 14:35:21
Done.
| |
| 1431 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES); | |
| 1421 } | 1432 } |
| 1422 | 1433 |
| 1423 void ContentSettingsHandler::SetException(const base::ListValue* args) { | 1434 void ContentSettingsHandler::SetException(const base::ListValue* args) { |
| 1424 std::string type_string; | 1435 std::string type_string; |
| 1425 CHECK(args->GetString(0, &type_string)); | 1436 CHECK(args->GetString(0, &type_string)); |
| 1426 std::string mode; | 1437 std::string mode; |
| 1427 CHECK(args->GetString(1, &mode)); | 1438 CHECK(args->GetString(1, &mode)); |
| 1428 std::string pattern; | 1439 std::string pattern; |
| 1429 CHECK(args->GetString(2, &pattern)); | 1440 CHECK(args->GetString(2, &pattern)); |
| 1430 std::string setting; | 1441 std::string setting; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1595 | 1606 |
| 1596 // Exceptions apply only when the feature is enabled. | 1607 // Exceptions apply only when the feature is enabled. |
| 1597 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1608 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1598 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1609 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1599 web_ui()->CallJavascriptFunction( | 1610 web_ui()->CallJavascriptFunction( |
| 1600 "ContentSettings.enableProtectedContentExceptions", | 1611 "ContentSettings.enableProtectedContentExceptions", |
| 1601 base::FundamentalValue(enable_exceptions)); | 1612 base::FundamentalValue(enable_exceptions)); |
| 1602 } | 1613 } |
| 1603 | 1614 |
| 1604 } // namespace options | 1615 } // namespace options |
| OLD | NEW |