| OLD | NEW |
| 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/clear_browsing_data_tab.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 // Calculate the end time for the deletion range specified by |time_period|. | 48 // Calculate the end time for the deletion range specified by |time_period|. |
| 49 base::Time CalculateEndDeleteTime(TimePeriod time_period); | 49 base::Time CalculateEndDeleteTime(TimePeriod time_period); |
| 50 | 50 |
| 51 // Records the UMA action of UI-triggered data deletion for |time_period|. | 51 // Records the UMA action of UI-triggered data deletion for |time_period|. |
| 52 void RecordDeletionForPeriod(TimePeriod time_period); | 52 void RecordDeletionForPeriod(TimePeriod time_period); |
| 53 | 53 |
| 54 // Records the UMA action of a change of the clear browsing data time period. | 54 // Records the UMA action of a change of the clear browsing data time period. |
| 55 void RecordTimePeriodChange(TimePeriod period); | 55 void RecordTimePeriodChange(TimePeriod period); |
| 56 | 56 |
| 57 // Records the UMA action and histogram of a data deletion from |tab|. | |
| 58 void RecordDeletionFromTab(ClearBrowsingDataTab tab); | |
| 59 | |
| 60 // Constructs the text to be displayed by a counter from the given |result|. | 57 // Constructs the text to be displayed by a counter from the given |result|. |
| 61 // Currently this can only be used for counters for which the Result is | 58 // Currently this can only be used for counters for which the Result is |
| 62 // defined in components/browsing_data/core/counters. | 59 // defined in components/browsing_data/core/counters. |
| 63 base::string16 GetCounterTextFromResult( | 60 base::string16 GetCounterTextFromResult( |
| 64 const BrowsingDataCounter::Result* result); | 61 const BrowsingDataCounter::Result* result); |
| 65 | 62 |
| 66 // Returns the preference that stores the time period. | 63 // Returns the preference that stores the time period. |
| 67 const char* GetTimePeriodPreferenceName( | 64 const char* GetTimePeriodPreferenceName( |
| 68 ClearBrowsingDataTab clear_browsing_data_tab); | 65 ClearBrowsingDataTab clear_browsing_data_tab); |
| 69 | 66 |
| 70 // Copies the name of the deletion preference corresponding to the given | 67 // Copies the name of the deletion preference corresponding to the given |
| 71 // |data_type| to |out_pref|. Returns false if no such preference exists. | 68 // |data_type| to |out_pref|. Returns false if no such preference exists. |
| 72 bool GetDeletionPreferenceFromDataType( | 69 bool GetDeletionPreferenceFromDataType( |
| 73 BrowsingDataType data_type, | 70 BrowsingDataType data_type, |
| 74 ClearBrowsingDataTab clear_browsing_data_tab, | 71 ClearBrowsingDataTab clear_browsing_data_tab, |
| 75 std::string* out_pref); | 72 std::string* out_pref); |
| 76 | 73 |
| 77 // Copies the deletion preferences for timeperiod, cache, history and cookies | 74 // Copies the deletion preferences for timeperiod, cache, history and cookies |
| 78 // to a separate preferences that are used to on the basic CBD tab. | 75 // to a separate preferences that are used to on the basic CBD tab. |
| 79 // This only happens the first time this method is called. | 76 // This only happens the first time this method is called. |
| 80 void MigratePreferencesToBasic(PrefService* prefs); | 77 void MigratePreferencesToBasic(PrefService* prefs); |
| 81 | 78 |
| 82 } // namespace browsing_data | 79 } // namespace browsing_data |
| 83 | 80 |
| 84 #endif // COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ | 81 #endif // COMPONENTS_BROWSING_DATA_CORE_BROWSING_DATA_UTILS_H_ |
| OLD | NEW |