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

Unified Diff: chrome/browser/android/preferences/website_preference_bridge.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/content_settings/web_site_settings_uma_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/preferences/website_preference_bridge.cc
diff --git a/chrome/browser/android/preferences/website_preference_bridge.cc b/chrome/browser/android/preferences/website_preference_bridge.cc
index 333bae86d903bf686e534cdf63912e473ed8abee..83cd49919f667f1bfcc7a625b260775d388ada60 100644
--- a/chrome/browser/android/preferences/website_preference_bridge.cc
+++ b/chrome/browser/android/preferences/website_preference_bridge.cc
@@ -10,12 +10,12 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/files/file_path.h"
-#include "base/strings/string_util.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
#include "chrome/browser/browsing_data/cookies_tree_model.h"
#include "chrome/browser/browsing_data/local_data_container.h"
#include "chrome/browser/content_settings/cookie_settings.h"
+#include "chrome/browser/content_settings/web_site_settings_uma_util.h"
#include "chrome/browser/notifications/desktop_notification_profile_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -153,6 +153,7 @@ static void SetSettingForOrigin(JNIEnv* env,
content_type,
std::string(),
setting);
+ WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting);
}
static void GetGeolocationOrigins(JNIEnv* env,
@@ -230,7 +231,7 @@ static void SetPushNotificationSettingForOrigin(JNIEnv* env, jclass clazz,
// permission types. See https://crbug.com/416894.
Profile* profile = ProfileManager::GetActiveUserProfile();
GURL url = GURL(ConvertJavaStringToUTF8(env, origin));
-
+ ContentSetting setting = CONTENT_SETTING_DEFAULT;
switch (value) {
case -1:
DesktopNotificationProfileUtil::ClearSetting(
@@ -238,13 +239,17 @@ static void SetPushNotificationSettingForOrigin(JNIEnv* env, jclass clazz,
break;
case 1:
DesktopNotificationProfileUtil::GrantPermission(profile, url);
+ setting = CONTENT_SETTING_ALLOW;
break;
case 2:
DesktopNotificationProfileUtil::DenyPermission(profile, url);
+ setting = CONTENT_SETTING_BLOCK;
break;
default:
NOTREACHED();
}
+ WebSiteSettingsUmaUtil::LogPermissionChange(
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS, setting);
}
static void GetVoiceAndVideoCaptureOrigins(JNIEnv* env,
@@ -323,12 +328,16 @@ static void SetCookieSettingForOrigin(JNIEnv* env, jclass clazz,
ContentSettingsPattern primary_pattern(
ContentSettingsPattern::FromURLNoWildcard(url));
ContentSettingsPattern secondary_pattern(ContentSettingsPattern::Wildcard());
+ ContentSetting setting = CONTENT_SETTING_DEFAULT;
if (value == -1) {
GetCookieSettings()->ResetCookieSetting(primary_pattern, secondary_pattern);
} else {
+ setting = value ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
GetCookieSettings()->SetCookieSetting(primary_pattern, secondary_pattern,
- value ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
+ setting);
}
+ WebSiteSettingsUmaUtil::LogPermissionChange(
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS, setting);
}
namespace {
« no previous file with comments | « no previous file | chrome/browser/content_settings/web_site_settings_uma_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698