| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_counter.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "components/browsing_data/browsing_data_utils.h" |
| 11 #include "components/browsing_data/counters/browsing_data_counter.h" |
| 10 | 12 |
| 11 // Whether the browsing data counters experiment is enabled. | 13 // Whether the browsing data counters experiment is enabled. |
| 12 bool AreCountersEnabled(); | 14 bool AreCountersEnabled(); |
| 13 | 15 |
| 14 // Constructs the text to be displayed by a counter from the given |result|. | 16 // Constructs the text to be displayed by a counter from the given |result|. |
| 15 base::string16 GetCounterTextFromResult( | 17 base::string16 GetCounterTextFromResult( |
| 16 const BrowsingDataCounter::Result* result); | 18 const BrowsingDataCounter::Result* result); |
| 17 | 19 |
| 18 // Browsing data types as seen in the Android UI. | |
| 19 // TODO(msramek): Reuse this enum as the canonical representation of the | |
| 20 // user-facing browsing data types in the Desktop UI as well. | |
| 21 // | |
| 22 // A Java counterpart will be generated for this enum. | |
| 23 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser | |
| 24 enum BrowsingDataType { | |
| 25 HISTORY, | |
| 26 CACHE, | |
| 27 COOKIES, | |
| 28 PASSWORDS, | |
| 29 FORM_DATA, | |
| 30 BOOKMARKS, | |
| 31 NUM_TYPES | |
| 32 }; | |
| 33 | |
| 34 // Copies the name of the deletion preference corresponding to the given | 20 // Copies the name of the deletion preference corresponding to the given |
| 35 // |data_type| to |out_pref|. Returns false if no such preference exists. | 21 // |data_type| to |out_pref|. Returns false if no such preference exists. |
| 36 bool GetDeletionPreferenceFromDataType( | 22 bool GetDeletionPreferenceFromDataType( |
| 37 BrowsingDataType data_type, std::string* out_pref); | 23 BrowsingDataType data_type, std::string* out_pref); |
| 38 | 24 |
| 39 // Creates a new instance of BrowsingDataCounter that is counting the data | 25 // Creates a new instance of BrowsingDataCounter that is counting the data |
| 40 // related to a given deletion preference |pref_name|. | 26 // related to a given deletion preference |pref_name|. |
| 41 BrowsingDataCounter* CreateCounterForPreference(std::string pref_name); | 27 BrowsingDataCounter* CreateCounterForPreference(std::string pref_name, |
| 28 Profile* profile); |
| 42 | 29 |
| 43 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ | 30 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_COUNTER_UTILS_H_ |
| OLD | NEW |