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

Unified Diff: chrome/browser/content_settings/tab_specific_content_settings.cc

Issue 7558024: Add UMA metrics for blocked plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years, 4 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
Index: chrome/browser/content_settings/tab_specific_content_settings.cc
diff --git a/chrome/browser/content_settings/tab_specific_content_settings.cc b/chrome/browser/content_settings/tab_specific_content_settings.cc
index 186fa4850fd5e395ea6f24bff47d1eaf066b5156..78b3ca2ff732acb679204c553abcda17a438e456 100644
--- a/chrome/browser/content_settings/tab_specific_content_settings.cc
+++ b/chrome/browser/content_settings/tab_specific_content_settings.cc
@@ -24,6 +24,7 @@
#include "content/browser/tab_contents/navigation_details.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
+#include "content/browser/user_metrics.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
#include "net/base/cookie_monster.h"
@@ -205,9 +206,18 @@ void TabSpecificContentSettings::AddBlockedResource(
void TabSpecificContentSettings::OnContentBlocked(
ContentSettingsType type,
- const std::string& resource_identifier) {
+ const std::string& resource_identifier,
+ ContentSetting setting) {
DCHECK(type != CONTENT_SETTINGS_TYPE_GEOLOCATION)
<< "Geolocation settings handled by OnGeolocationPermissionSet";
+ if (type == CONTENT_SETTINGS_TYPE_PLUGINS) {
+ if (setting == CONTENT_SETTING_BLOCK)
+ UserMetrics::RecordAction(UserMetricsAction("Plugin.Blocked"));
+ else if (setting == CONTENT_SETTING_ASK)
+ UserMetrics::RecordAction(UserMetricsAction("Plugin.ClickToPlay"));
+ else
+ NOTREACHED();
+ }
content_accessed_[type] = true;
if (!resource_identifier.empty())
AddBlockedResource(type, resource_identifier);
@@ -254,7 +264,8 @@ void TabSpecificContentSettings::OnCookiesRead(
cookie->IsHttpOnly());
}
if (blocked_by_policy)
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
else
OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
}
@@ -267,7 +278,8 @@ void TabSpecificContentSettings::OnCookieChanged(
if (blocked_by_policy) {
blocked_local_shared_objects_.cookies()->SetCookieWithOptions(
url, cookie_line, options);
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
} else {
allowed_local_shared_objects_.cookies()->SetCookieWithOptions(
url, cookie_line, options);
@@ -282,7 +294,8 @@ void TabSpecificContentSettings::OnIndexedDBAccessed(
if (blocked_by_policy) {
blocked_local_shared_objects_.indexed_dbs()->AddIndexedDB(
url, description);
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
} else {
allowed_local_shared_objects_.indexed_dbs()->AddIndexedDB(
url, description);
@@ -302,7 +315,8 @@ void TabSpecificContentSettings::OnLocalStorageAccessed(
helper->AddLocalStorage(url);
if (blocked_by_policy)
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
else
OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
}
@@ -315,7 +329,8 @@ void TabSpecificContentSettings::OnWebDatabaseAccessed(
if (blocked_by_policy) {
blocked_local_shared_objects_.databases()->AddDatabase(
url, UTF16ToUTF8(name), UTF16ToUTF8(display_name));
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
} else {
allowed_local_shared_objects_.databases()->AddDatabase(
url, UTF16ToUTF8(name), UTF16ToUTF8(display_name));
@@ -327,7 +342,8 @@ void TabSpecificContentSettings::OnAppCacheAccessed(
const GURL& manifest_url, bool blocked_by_policy) {
if (blocked_by_policy) {
blocked_local_shared_objects_.appcaches()->AddAppCache(manifest_url);
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
} else {
allowed_local_shared_objects_.appcaches()->AddAppCache(manifest_url);
OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES);
@@ -340,7 +356,8 @@ void TabSpecificContentSettings::OnFileSystemAccessed(
if (blocked_by_policy) {
blocked_local_shared_objects_.file_systems()->AddFileSystem(url,
fileapi::kFileSystemTypeTemporary, 0);
- OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string());
+ OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string(),
+ CONTENT_SETTING_BLOCK);
} else {
allowed_local_shared_objects_.file_systems()->AddFileSystem(url,
fileapi::kFileSystemTypeTemporary, 0);

Powered by Google App Engine
This is Rietveld 408576698