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

Side by Side Diff: components/browsing_data/core/browsing_data_utils.cc

Issue 2927063002: Add metrics for new CBD dialog (Closed)
Patch Set: Update migration comment (and rebase) Created 3 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/browsing_data/core/browsing_data_utils.h" 5 #include "components/browsing_data/core/browsing_data_utils.h"
6 6
7 #include "base/metrics/histogram_macros.h"
7 #include "base/metrics/user_metrics.h" 8 #include "base/metrics/user_metrics.h"
8 #include "components/browsing_data/core/counters/autofill_counter.h" 9 #include "components/browsing_data/core/counters/autofill_counter.h"
9 #include "components/browsing_data/core/counters/history_counter.h" 10 #include "components/browsing_data/core/counters/history_counter.h"
10 #include "components/browsing_data/core/counters/passwords_counter.h" 11 #include "components/browsing_data/core/counters/passwords_counter.h"
11 #include "components/browsing_data/core/pref_names.h" 12 #include "components/browsing_data/core/pref_names.h"
12 #include "components/prefs/pref_service.h" 13 #include "components/prefs/pref_service.h"
13 #include "components/strings/grit/components_strings.h" 14 #include "components/strings/grit/components_strings.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 namespace browsing_data { 17 namespace browsing_data {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::RecordAction( 59 base::RecordAction(
59 base::UserMetricsAction("ClearBrowsingData_LastMonth")); 60 base::UserMetricsAction("ClearBrowsingData_LastMonth"));
60 break; 61 break;
61 case TimePeriod::ALL_TIME: 62 case TimePeriod::ALL_TIME:
62 base::RecordAction( 63 base::RecordAction(
63 base::UserMetricsAction("ClearBrowsingData_Everything")); 64 base::UserMetricsAction("ClearBrowsingData_Everything"));
64 break; 65 break;
65 } 66 }
66 } 67 }
67 68
69 void RecordTimePeriodChange(TimePeriod period) {
70 switch (period) {
71 case TimePeriod::LAST_HOUR:
72 base::RecordAction(base::UserMetricsAction(
73 "ClearBrowsingData_TimePeriodChanged_LastHour"));
74 break;
75 case TimePeriod::LAST_DAY:
76 base::RecordAction(base::UserMetricsAction(
77 "ClearBrowsingData_TimePeriodChanged_LastDay"));
78 break;
79 case TimePeriod::LAST_WEEK:
80 base::RecordAction(base::UserMetricsAction(
81 "ClearBrowsingData_TimePeriodChanged_LastWeek"));
82 break;
83 case TimePeriod::FOUR_WEEKS:
84 base::RecordAction(base::UserMetricsAction(
85 "ClearBrowsingData_TimePeriodChanged_LastMonth"));
86 break;
87 case TimePeriod::ALL_TIME:
88 base::RecordAction(base::UserMetricsAction(
89 "ClearBrowsingData_TimePeriodChanged_Everything"));
90 break;
91 }
92 }
93
94 void RecordDeletionFromTab(ClearBrowsingDataTab tab) {
95 UMA_HISTOGRAM_ENUMERATION("History.ClearBrowsingData.UserDeletedFromTab", tab,
96 browsing_data::ClearBrowsingDataTab::NUM_TYPES);
97 switch (tab) {
98 case ClearBrowsingDataTab::BASIC:
99 base::RecordAction(base::UserMetricsAction("ClearBrowsingData_BasicTab"));
100 break;
101 case ClearBrowsingDataTab::ADVANCED:
102 base::RecordAction(
103 base::UserMetricsAction("ClearBrowsingData_AdvancedTab"));
104 break;
105 case ClearBrowsingDataTab::NUM_TYPES:
106 NOTREACHED();
107 }
108 }
109
68 base::string16 GetCounterTextFromResult( 110 base::string16 GetCounterTextFromResult(
69 const BrowsingDataCounter::Result* result) { 111 const BrowsingDataCounter::Result* result) {
70 base::string16 text; 112 base::string16 text;
71 std::string pref_name = result->source()->GetPrefName(); 113 std::string pref_name = result->source()->GetPrefName();
72 114
73 if (!result->Finished()) { 115 if (!result->Finished()) {
74 // The counter is still counting. 116 // The counter is still counting.
75 text = l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_CALCULATING); 117 text = l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_CALCULATING);
76 118
77 } else if (pref_name == prefs::kDeletePasswords) { 119 } else if (pref_name == prefs::kDeletePasswords) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 prefs->GetBoolean(prefs::kDeleteCache)); 293 prefs->GetBoolean(prefs::kDeleteCache));
252 prefs->SetBoolean(prefs::kDeleteCookiesBasic, 294 prefs->SetBoolean(prefs::kDeleteCookiesBasic,
253 prefs->GetBoolean(prefs::kDeleteCookies)); 295 prefs->GetBoolean(prefs::kDeleteCookies));
254 prefs->SetInteger(prefs::kDeleteTimePeriodBasic, 296 prefs->SetInteger(prefs::kDeleteTimePeriodBasic,
255 prefs->GetInteger(prefs::kDeleteTimePeriod)); 297 prefs->GetInteger(prefs::kDeleteTimePeriod));
256 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true); 298 prefs->SetBoolean(prefs::kPreferencesMigratedToBasic, true);
257 } 299 }
258 } 300 }
259 301
260 } // namespace browsing_data 302 } // namespace browsing_data
OLDNEW
« no previous file with comments | « components/browsing_data/core/browsing_data_utils.h ('k') | components/browsing_data/core/clear_browsing_data_tab.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698