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

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/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/content_settings/web_site_settings_uma_util.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"
24 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/ui/browser_list.h" 26 #include "chrome/browser/ui/browser_list.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 28 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
28 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
(...skipping 1381 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 WebSiteSettingsUmaUtil::LogPermissionChange(
1424 type, ContentSetting::CONTENT_SETTING_DEFAULT);
1421 } 1425 }
1422 1426
1423 void ContentSettingsHandler::SetException(const base::ListValue* args) { 1427 void ContentSettingsHandler::SetException(const base::ListValue* args) {
1424 std::string type_string; 1428 std::string type_string;
1425 CHECK(args->GetString(0, &type_string)); 1429 CHECK(args->GetString(0, &type_string));
1426 std::string mode; 1430 std::string mode;
1427 CHECK(args->GetString(1, &mode)); 1431 CHECK(args->GetString(1, &mode));
1428 std::string pattern; 1432 std::string pattern;
1429 CHECK(args->GetString(2, &pattern)); 1433 CHECK(args->GetString(2, &pattern));
1430 std::string setting; 1434 std::string setting;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 1599
1596 // Exceptions apply only when the feature is enabled. 1600 // Exceptions apply only when the feature is enabled.
1597 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1601 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1598 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1602 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1599 web_ui()->CallJavascriptFunction( 1603 web_ui()->CallJavascriptFunction(
1600 "ContentSettings.enableProtectedContentExceptions", 1604 "ContentSettings.enableProtectedContentExceptions",
1601 base::FundamentalValue(enable_exceptions)); 1605 base::FundamentalValue(enable_exceptions));
1602 } 1606 }
1603 1607
1604 } // namespace options 1608 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/content_settings/web_site_settings_uma_util.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698