| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_REMOVER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 void AddObserver(Observer* observer); | 92 void AddObserver(Observer* observer); |
| 93 void RemoveObserver(Observer* observer); | 93 void RemoveObserver(Observer* observer); |
| 94 | 94 |
| 95 // Called when history deletion is done. | 95 // Called when history deletion is done. |
| 96 void OnHistoryDeletionDone(); | 96 void OnHistoryDeletionDone(); |
| 97 | 97 |
| 98 static bool is_removing() { return removing_; } | 98 static bool is_removing() { return removing_; } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 // The clear API needs to be able to toggle removing_ in order to test that |
| 102 // only one BrowsingDataRemover instance can be called at a time. |
| 103 FRIEND_TEST_ALL_PREFIXES(ExtensionApiTest, ClearOneAtATime); |
| 104 |
| 101 enum CacheState { | 105 enum CacheState { |
| 102 STATE_NONE, | 106 STATE_NONE, |
| 103 STATE_CREATE_MAIN, | 107 STATE_CREATE_MAIN, |
| 104 STATE_CREATE_MEDIA, | 108 STATE_CREATE_MEDIA, |
| 105 STATE_DELETE_MAIN, | 109 STATE_DELETE_MAIN, |
| 106 STATE_DELETE_MEDIA, | 110 STATE_DELETE_MEDIA, |
| 107 STATE_DONE | 111 STATE_DONE |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 // BrowsingDataRemover deletes itself (using DeleteTask) and is not supposed | 114 // BrowsingDataRemover deletes itself (using DeleteTask) and is not supposed |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 172 |
| 169 // Returns true if we're all done. | 173 // Returns true if we're all done. |
| 170 bool all_done() { | 174 bool all_done() { |
| 171 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && | 175 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
| 172 !waiting_for_clear_history_ && | 176 !waiting_for_clear_history_ && |
| 173 !waiting_for_clear_quota_managed_data_ && | 177 !waiting_for_clear_quota_managed_data_ && |
| 174 !waiting_for_clear_networking_history_ && | 178 !waiting_for_clear_networking_history_ && |
| 175 !waiting_for_clear_lso_data_; | 179 !waiting_for_clear_lso_data_; |
| 176 } | 180 } |
| 177 | 181 |
| 182 // Setter for removing_; DCHECKs that we can only start removing if we're not |
| 183 // already removing, and vice-versa. |
| 184 static void set_removing(bool removing); |
| 185 |
| 178 NotificationRegistrar registrar_; | 186 NotificationRegistrar registrar_; |
| 179 | 187 |
| 180 // Profile we're to remove from. | 188 // Profile we're to remove from. |
| 181 Profile* profile_; | 189 Profile* profile_; |
| 182 | 190 |
| 183 // The QuotaManager is owned by the profile; we can use a raw pointer here, | 191 // The QuotaManager is owned by the profile; we can use a raw pointer here, |
| 184 // and rely on the profile to destroy the object whenever it's reasonable. | 192 // and rely on the profile to destroy the object whenever it's reasonable. |
| 185 quota::QuotaManager* quota_manager_; | 193 quota::QuotaManager* quota_manager_; |
| 186 | 194 |
| 187 // 'Protected' origins are not subject to data removal. | 195 // 'Protected' origins are not subject to data removal. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 231 |
| 224 ObserverList<Observer> observer_list_; | 232 ObserverList<Observer> observer_list_; |
| 225 | 233 |
| 226 // Used if we need to clear history. | 234 // Used if we need to clear history. |
| 227 CancelableRequestConsumer request_consumer_; | 235 CancelableRequestConsumer request_consumer_; |
| 228 | 236 |
| 229 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 237 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 230 }; | 238 }; |
| 231 | 239 |
| 232 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 240 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |