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 // Removes the specified browsing data associated with |browser_state|. Calls | |
38 // |callback| when the browsing data is actually removed. |browser_state| | |
39 // cannot be null and must not be off the record. | |
40 // |callback| is called on the main thread. | |
41 // Note: Removal operations are not necessarily processed in the sequence that | |
42 // they are received in. | |
43 void Remove(ios::ChromeBrowserState* browser_state, | |
msramek
2016/08/29 14:20:59
I would recommend not copy-pasting the comment, ju
ioanap
2016/08/30 11:32:08
Done.
| |
44 int remove_mask, | |
35 const base::Closure& callback); | 45 const base::Closure& callback); |
36 | 46 |
37 private: | 47 private: |
38 // Encapsulates the information that is needed to remove browsing data from | 48 // Encapsulates the information that is needed to remove browsing data from |
39 // a ChromeBrowserState. | 49 // a ChromeBrowserState. |
40 struct BrowsingDataRemovalInfo { | 50 struct BrowsingDataRemovalInfo { |
41 // Creates a BrowsingDataRemovalInfo with a single callback |callback|. | 51 // Creates a BrowsingDataRemovalInfo with a single callback |callback|. |
42 BrowsingDataRemovalInfo(int remove_mask, const base::Closure& callback); | 52 BrowsingDataRemovalInfo(int remove_mask, |
53 browsing_data::TimePeriod time_period, | |
54 const base::Closure& callback); | |
43 ~BrowsingDataRemovalInfo(); | 55 ~BrowsingDataRemovalInfo(); |
44 // The mask of all the types of browsing data that needs to be removed. | 56 // The mask of all the types of browsing data that needs to be removed. |
45 // Obtained from BrowsingDataRemoved::RemoveDataMask. | 57 // Obtained from BrowsingDataRemoved::RemoveDataMask. |
46 int remove_mask; | 58 int remove_mask; |
59 // Time period for which the user wants to remove the data. | |
60 browsing_data::TimePeriod time_period; | |
47 // The vector of callbacks that need to be run when browsing data is | 61 // The vector of callbacks that need to be run when browsing data is |
48 // actually removed. | 62 // actually removed. |
49 std::vector<base::Closure> callbacks; | 63 std::vector<base::Closure> callbacks; |
50 }; | 64 }; |
51 | 65 |
52 // IOSChromeBrowsingDataRemover::Observer methods. | 66 // IOSChromeBrowsingDataRemover::Observer methods. |
53 void OnIOSChromeBrowsingDataRemoverDone() override; | 67 void OnIOSChromeBrowsingDataRemoverDone() override; |
54 | 68 |
55 // Removes the browsing data using IOSChromeBrowsingDataRemover. | 69 // Removes the browsing data using IOSChromeBrowsingDataRemover. |
56 // IOSChromeBrowsingDataRemover | 70 // IOSChromeBrowsingDataRemover |
57 // must not be running. | 71 // must not be running. |
58 void DoRemove(ios::ChromeBrowserState* browser_state, | 72 void DoRemove(ios::ChromeBrowserState* browser_state, |
59 std::unique_ptr<BrowsingDataRemovalInfo> removal_info); | 73 std::unique_ptr<BrowsingDataRemovalInfo> removal_info); |
60 | 74 |
61 // A map that contains the all the ChromeBrowserStates that have a removal | 75 // A map that contains the all the ChromeBrowserStates that have a removal |
62 // operation pending along with their associated BrowsingDataRemovalInfo. | 76 // operation pending along with their associated BrowsingDataRemovalInfo. |
63 std::map<ios::ChromeBrowserState*, std::unique_ptr<BrowsingDataRemovalInfo>> | 77 std::map<ios::ChromeBrowserState*, std::unique_ptr<BrowsingDataRemovalInfo>> |
64 pending_removals_; | 78 pending_removals_; |
65 // The BrowsingDataRemovalInfo of the currently enqueued removal operation. | 79 // The BrowsingDataRemovalInfo of the currently enqueued removal operation. |
66 std::unique_ptr<BrowsingDataRemovalInfo> current_removal_info_; | 80 std::unique_ptr<BrowsingDataRemovalInfo> current_removal_info_; |
67 // The actual object that perfoms the removal of browsing data. | 81 // The actual object that perfoms the removal of browsing data. |
68 IOSChromeBrowsingDataRemover* current_remover_; | 82 IOSChromeBrowsingDataRemover* current_remover_; |
69 }; | 83 }; |
70 | 84 |
71 #endif // IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ | 85 #endif // IOS_CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_HELPER_H_ |
OLD | NEW |