Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Add metrics for CBD dialog initiated deletion of cookies and cache.
Browse files Browse the repository at this point in the history
The metric added in https://codereview.chromium.org/1259953003 is measured in BrowsingDataRemover, and includes deletions initiatied from anywhere.

This new metric focuses specifically on deletions initiated from the Clear Browsing Data dialog.

BUG=527372

Review URL: https://codereview.chromium.org/1325083002

Cr-Commit-Position: refs/heads/master@{#347275}
  • Loading branch information
msramek authored and Commit bot committed Sep 3, 2015
1 parent 4155f5f commit c927f52
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 10 deletions.
10 changes: 0 additions & 10 deletions chrome/browser/browsing_data/browsing_data_remover.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@ CallbackList* GetOnBrowsingDataRemovedCallbacks() {
return g_on_browsing_data_removed_callbacks;
}

// A helper enum to report the deletion of cookies and/or cache. Do not reorder
// the entries, as this enum is passed to UMA.
enum CookieOrCacheDeletionChoice {
NEITHER_COOKIES_NOR_CACHE,
ONLY_COOKIES,
ONLY_CACHE,
BOTH_COOKIES_AND_CACHE,
MAX_CHOICE_VALUE
};

} // namespace

bool BrowsingDataRemover::is_removing_ = false;
Expand Down
10 changes: 10 additions & 0 deletions chrome/browser/browsing_data/browsing_data_remover.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ class BrowsingDataRemover
REMOVE_WIPE_PROFILE = REMOVE_ALL | REMOVE_NOCHECKS,
};

// A helper enum to report the deletion of cookies and/or cache. Do not
// reorder the entries, as this enum is passed to UMA.
enum CookieOrCacheDeletionChoice {
NEITHER_COOKIES_NOR_CACHE,
ONLY_COOKIES,
ONLY_CACHE,
BOTH_COOKIES_AND_CACHE,
MAX_CHOICE_VALUE
};

// When BrowsingDataRemover successfully removes data, a notification of type
// NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of
// this type.
Expand Down
15 changes: 15 additions & 0 deletions chrome/browser/ui/webui/options/clear_browser_data_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string16.h"
#include "base/values.h"
Expand Down Expand Up @@ -214,6 +215,20 @@ void ClearBrowserDataHandler::HandleClearBrowserData(
origin_mask |= BrowsingDataHelper::PROTECTED_WEB;
}

// Record the deletion of cookies and cache.
BrowsingDataRemover::CookieOrCacheDeletionChoice choice =
BrowsingDataRemover::NEITHER_COOKIES_NOR_CACHE;
if (prefs->GetBoolean(prefs::kDeleteCookies)) {
choice = prefs->GetBoolean(prefs::kDeleteCache)
? BrowsingDataRemover::BOTH_COOKIES_AND_CACHE
: BrowsingDataRemover::ONLY_COOKIES;
} else if (prefs->GetBoolean(prefs::kDeleteCache)) {
choice = BrowsingDataRemover::ONLY_CACHE;
}
UMA_HISTOGRAM_ENUMERATION(
"History.ClearBrowsingData.UserDeletedCookieOrCacheFromDialog",
choice, BrowsingDataRemover::MAX_CHOICE_VALUE);

// BrowsingDataRemover deletes itself when done.
int period_selected = prefs->GetInteger(prefs::kDeleteTimePeriod);
remover_ = BrowsingDataRemover::CreateForPeriod(profile,
Expand Down
10 changes: 10 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14017,6 +14017,16 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>

<histogram name="History.ClearBrowsingData.UserDeletedCookieOrCacheFromDialog"
enum="CookieOrCacheDeletion">
<owner>msramek@chromium.org</owner>
<summary>
Recorded when the user deletes their browsing data manually from the
ClearBrowsingData dialog. Shows whether cookies and/or cache were among the
selected data types.
</summary>
</histogram>

<histogram name="History.DatabaseAdvancedMetricsTime" units="milliseconds">
<owner>shess@chromium.org</owner>
<summary>
Expand Down

0 comments on commit c927f52

Please sign in to comment.