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

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

Issue 2671743002: Separate state of basic and advanced tab in CBD dialog (Closed)
Patch Set: rebase and fix compilation Created 3 years, 9 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 #ifndef COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ 5 #ifndef COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_
6 #define COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ 6 #define COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_
7 7
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "components/browsing_data/core/clear_browsing_data_tab.h"
10 #include "components/browsing_data/core/counters/browsing_data_counter.h" 11 #include "components/browsing_data/core/counters/browsing_data_counter.h"
11 12
12 namespace browsing_data { 13 namespace browsing_data {
13 14
14 // Browsing data types as seen in the Android UI. 15 // Browsing data types as seen in the Android UI.
15 // TODO(msramek): Reuse this enum as the canonical representation of the 16 // TODO(msramek): Reuse this enum as the canonical representation of the
16 // user-facing browsing data types in the Desktop UI as well. 17 // user-facing browsing data types in the Desktop UI as well.
17 // 18 //
18 // A Java counterpart will be generated for this enum. 19 // A Java counterpart will be generated for this enum.
19 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.browsing_data 20 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.browsing_data
20 enum BrowsingDataType { 21 enum class BrowsingDataType {
21 HISTORY, 22 HISTORY,
22 CACHE, 23 CACHE,
23 COOKIES, 24 COOKIES,
24 PASSWORDS, 25 PASSWORDS,
25 FORM_DATA, 26 FORM_DATA,
26 BOOKMARKS, 27 BOOKMARKS,
27 NUM_TYPES 28 NUM_TYPES
28 }; 29 };
29 30
30 // Time period ranges available when doing browsing data removals. 31 // Time period ranges available when doing browsing data removals.
31 // 32 //
32 // A Java counterpart will be generated for this enum. 33 // A Java counterpart will be generated for this enum.
33 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.browsing_data 34 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.browsing_data
34 enum TimePeriod { 35 enum class TimePeriod {
35 LAST_HOUR = 0, 36 LAST_HOUR = 0,
36 LAST_DAY, 37 LAST_DAY,
37 LAST_WEEK, 38 LAST_WEEK,
38 FOUR_WEEKS, 39 FOUR_WEEKS,
39 ALL_TIME, 40 ALL_TIME,
40 TIME_PERIOD_LAST = ALL_TIME 41 TIME_PERIOD_LAST = ALL_TIME
41 }; 42 };
42 43
43 // Calculate the begin time for the deletion range specified by |time_period|. 44 // Calculate the begin time for the deletion range specified by |time_period|.
44 base::Time CalculateBeginDeleteTime(TimePeriod time_period); 45 base::Time CalculateBeginDeleteTime(TimePeriod time_period);
45 46
46 // Calculate the end time for the deletion range specified by |time_period|. 47 // Calculate the end time for the deletion range specified by |time_period|.
47 base::Time CalculateEndDeleteTime(TimePeriod time_period); 48 base::Time CalculateEndDeleteTime(TimePeriod time_period);
48 49
49 // Records the UMA action of UI-triggered data deletion for |time_period|. 50 // Records the UMA action of UI-triggered data deletion for |time_period|.
50 void RecordDeletionForPeriod(TimePeriod time_period); 51 void RecordDeletionForPeriod(TimePeriod time_period);
51 52
52 // Constructs the text to be displayed by a counter from the given |result|. 53 // Constructs the text to be displayed by a counter from the given |result|.
53 // Currently this can only be used for counters for which the Result is defined 54 // Currently this can only be used for counters for which the Result is defined
54 // in components/browsing_data/core/counters. 55 // in components/browsing_data/core/counters.
55 base::string16 GetCounterTextFromResult( 56 base::string16 GetCounterTextFromResult(
56 const browsing_data::BrowsingDataCounter::Result* result); 57 const BrowsingDataCounter::Result* result);
58
59 // Returns the preference that stores the time period.
60 const char* GetTimePeriodPreferenceName(
61 ClearBrowsingDataTab clear_browsing_data_tab);
57 62
58 // Copies the name of the deletion preference corresponding to the given 63 // Copies the name of the deletion preference corresponding to the given
59 // |data_type| to |out_pref|. Returns false if no such preference exists. 64 // |data_type| to |out_pref|. Returns false if no such preference exists.
60 bool GetDeletionPreferenceFromDataType( 65 bool GetDeletionPreferenceFromDataType(
61 BrowsingDataType data_type, 66 BrowsingDataType data_type,
67 ClearBrowsingDataTab clear_browsing_data_tab,
62 std::string* out_pref); 68 std::string* out_pref);
63 69
70 // Copies the deletion preferences for timeperiod, cache, history and cookies
71 // to a separate preferences that are used to on the basic CBD tab.
72 // This only happens the first time this method is called.
73 void MigratePreferencesToBasic(PrefService* prefs);
74
64 } // namespace browsing_data 75 } // namespace browsing_data
65 76
66 #endif // COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ 77 #endif // COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_
OLDNEW
« no previous file with comments | « components/browsing_data/core/DEPS ('k') | components/browsing_data/core/browsing_data_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698