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

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

Issue 952463002: Add UMA to track permission changes from the content settings menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
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
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"
Ilya Sherman 2015/02/23 22:55:20 Ditto
Miguel Garcia 2015/02/24 13:25:24 Done.
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
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
1423 ContentSettingsTypeHistogram histogram_value =
1424 ContentSettingTypeToHistogramValue(type);
1425 DCHECK_NE(histogram_value, CONTENT_SETTINGS_TYPE_HISTOGRAM_INVALID)
1426 << "Invalid content setting type specified.";
1427
1428 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Menu.PermissionChanged",
1429 histogram_value,
1430 CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES);
1431
1432 UMA_HISTOGRAM_ENUMERATION(
1433 "WebsiteSettings.ContentSettings.PermissionChanged.Reset",
1434 histogram_value, CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES);
Ilya Sherman 2015/02/23 22:55:20 Please call LogPermissionChange() to emit to these
Miguel Garcia 2015/02/24 13:25:24 So the thing is that those two files are a world a
Ilya Sherman 2015/02/24 19:13:40 I'm suggesting moving the helper method out into a
1421 } 1435 }
1422 1436
1423 void ContentSettingsHandler::SetException(const base::ListValue* args) { 1437 void ContentSettingsHandler::SetException(const base::ListValue* args) {
1424 std::string type_string; 1438 std::string type_string;
1425 CHECK(args->GetString(0, &type_string)); 1439 CHECK(args->GetString(0, &type_string));
1426 std::string mode; 1440 std::string mode;
1427 CHECK(args->GetString(1, &mode)); 1441 CHECK(args->GetString(1, &mode));
1428 std::string pattern; 1442 std::string pattern;
1429 CHECK(args->GetString(2, &pattern)); 1443 CHECK(args->GetString(2, &pattern));
1430 std::string setting; 1444 std::string setting;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 1609
1596 // Exceptions apply only when the feature is enabled. 1610 // Exceptions apply only when the feature is enabled.
1597 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1611 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1598 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1612 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1599 web_ui()->CallJavascriptFunction( 1613 web_ui()->CallJavascriptFunction(
1600 "ContentSettings.enableProtectedContentExceptions", 1614 "ContentSettings.enableProtectedContentExceptions",
1601 base::FundamentalValue(enable_exceptions)); 1615 base::FundamentalValue(enable_exceptions));
1602 } 1616 }
1603 1617
1604 } // namespace options 1618 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698