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 IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ | 5 #ifndef IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ |
6 #define IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ | 6 #define IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 14 matching lines...) Expand all Loading... |
25 ~BrowsingDataRemoverHelper() override; | 25 ~BrowsingDataRemoverHelper() override; |
26 | 26 |
27 // Removes the specified browsing data associated with |browser_state|. Calls | 27 // Removes the specified browsing data associated with |browser_state|. Calls |
28 // |callback| when the browsing data is actually removed. |browser_state| | 28 // |callback| when the browsing data is actually removed. |browser_state| |
29 // cannot be null and must not be off the record. | 29 // cannot be null and must not be off the record. |
30 // |callback| is called on the main thread. | 30 // |callback| is called on the main thread. |
31 // Note: Removal operations are not necessarily processed in the sequence that | 31 // Note: Removal operations are not necessarily processed in the sequence that |
32 // they are received in. | 32 // they are received in. |
33 void Remove(ios::ChromeBrowserState* browser_state, | 33 void Remove(ios::ChromeBrowserState* browser_state, |
34 int remove_mask, | 34 int remove_mask, |
| 35 browsing_data::TimePeriod time_period, |
| 36 const base::Closure& callback); |
| 37 |
| 38 // DEPRECATED: Same as above, but setting the |time_period| to ALL_TIME. |
| 39 // TODO(ioanap): Remove after all call sites are changed. |
| 40 void Remove(ios::ChromeBrowserState* browser_state, |
| 41 int remove_mask, |
35 const base::Closure& callback); | 42 const base::Closure& callback); |
36 | 43 |
37 private: | 44 private: |
38 // Encapsulates the information that is needed to remove browsing data from | 45 // Encapsulates the information that is needed to remove browsing data from |
39 // a ChromeBrowserState. | 46 // a ChromeBrowserState. |
40 struct BrowsingDataRemovalInfo { | 47 struct BrowsingDataRemovalInfo { |
41 // Creates a BrowsingDataRemovalInfo with a single callback |callback|. | 48 // Creates a BrowsingDataRemovalInfo with a single callback |callback|. |
42 BrowsingDataRemovalInfo(int remove_mask, const base::Closure& callback); | 49 BrowsingDataRemovalInfo(int remove_mask, |
| 50 browsing_data::TimePeriod time_period, |
| 51 const base::Closure& callback); |
43 ~BrowsingDataRemovalInfo(); | 52 ~BrowsingDataRemovalInfo(); |
44 // The mask of all the types of browsing data that needs to be removed. | 53 // The mask of all the types of browsing data that needs to be removed. |
45 // Obtained from BrowsingDataRemoved::RemoveDataMask. | 54 // Obtained from BrowsingDataRemoved::RemoveDataMask. |
46 int remove_mask; | 55 int remove_mask; |
| 56 // Time period for which the user wants to remove the data. |
| 57 browsing_data::TimePeriod time_period; |
47 // The vector of callbacks that need to be run when browsing data is | 58 // The vector of callbacks that need to be run when browsing data is |
48 // actually removed. | 59 // actually removed. |
49 std::vector<base::Closure> callbacks; | 60 std::vector<base::Closure> callbacks; |
50 }; | 61 }; |
51 | 62 |
52 // IOSChromeBrowsingDataRemover::Observer methods. | 63 // IOSChromeBrowsingDataRemover::Observer methods. |
53 void OnIOSChromeBrowsingDataRemoverDone() override; | 64 void OnIOSChromeBrowsingDataRemoverDone() override; |
54 | 65 |
55 // Removes the browsing data using IOSChromeBrowsingDataRemover. | 66 // Removes the browsing data using IOSChromeBrowsingDataRemover. |
56 // IOSChromeBrowsingDataRemover | 67 // IOSChromeBrowsingDataRemover |
57 // must not be running. | 68 // must not be running. |
58 void DoRemove(ios::ChromeBrowserState* browser_state, | 69 void DoRemove(ios::ChromeBrowserState* browser_state, |
59 std::unique_ptr<BrowsingDataRemovalInfo> removal_info); | 70 std::unique_ptr<BrowsingDataRemovalInfo> removal_info); |
60 | 71 |
61 // A map that contains the all the ChromeBrowserStates that have a removal | 72 // A map that contains the all the ChromeBrowserStates that have a removal |
62 // operation pending along with their associated BrowsingDataRemovalInfo. | 73 // operation pending along with their associated BrowsingDataRemovalInfo. |
63 std::map<ios::ChromeBrowserState*, std::unique_ptr<BrowsingDataRemovalInfo>> | 74 std::map<ios::ChromeBrowserState*, std::unique_ptr<BrowsingDataRemovalInfo>> |
64 pending_removals_; | 75 pending_removals_; |
65 // The BrowsingDataRemovalInfo of the currently enqueued removal operation. | 76 // The BrowsingDataRemovalInfo of the currently enqueued removal operation. |
66 std::unique_ptr<BrowsingDataRemovalInfo> current_removal_info_; | 77 std::unique_ptr<BrowsingDataRemovalInfo> current_removal_info_; |
67 // The actual object that perfoms the removal of browsing data. | 78 // The actual object that perfoms the removal of browsing data. |
68 IOSChromeBrowsingDataRemover* current_remover_; | 79 IOSChromeBrowsingDataRemover* current_remover_; |
69 }; | 80 }; |
70 | 81 |
71 #endif // IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ | 82 #endif // IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ |
OLD | NEW |