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 <set> | 9 #include <set> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 REMOVE_APPCACHE = 1 << 0, | 59 REMOVE_APPCACHE = 1 << 0, |
60 REMOVE_CACHE = 1 << 1, | 60 REMOVE_CACHE = 1 << 1, |
61 REMOVE_COOKIES = 1 << 2, | 61 REMOVE_COOKIES = 1 << 2, |
62 REMOVE_DOWNLOADS = 1 << 3, | 62 REMOVE_DOWNLOADS = 1 << 3, |
63 REMOVE_FILE_SYSTEMS = 1 << 4, | 63 REMOVE_FILE_SYSTEMS = 1 << 4, |
64 REMOVE_FORM_DATA = 1 << 5, | 64 REMOVE_FORM_DATA = 1 << 5, |
65 // In addition to visits, REMOVE_HISTORY removes keywords and last session. | 65 // In addition to visits, REMOVE_HISTORY removes keywords and last session. |
66 REMOVE_HISTORY = 1 << 6, | 66 REMOVE_HISTORY = 1 << 6, |
67 REMOVE_INDEXEDDB = 1 << 7, | 67 REMOVE_INDEXEDDB = 1 << 7, |
68 REMOVE_LOCAL_STORAGE = 1 << 8, | 68 REMOVE_LOCAL_STORAGE = 1 << 8, |
69 REMOVE_LSO_DATA = 1 << 9, | 69 REMOVE_PLUGIN_DATA = 1 << 9, |
70 REMOVE_PASSWORDS = 1 << 10, | 70 REMOVE_PASSWORDS = 1 << 10, |
71 REMOVE_WEBSQL = 1 << 11, | 71 REMOVE_WEBSQL = 1 << 11, |
72 | 72 |
73 // "Site data" includes cookies, appcache, file systems, indexedDBs, local | 73 // "Site data" includes cookies, appcache, file systems, indexedDBs, local |
74 // storage, webSQL, and LSO data. | 74 // storage, webSQL, and plugin data. |
75 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | | 75 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | |
76 REMOVE_INDEXEDDB | REMOVE_LOCAL_STORAGE | | 76 REMOVE_INDEXEDDB | REMOVE_LOCAL_STORAGE | |
77 REMOVE_LSO_DATA | REMOVE_WEBSQL | 77 REMOVE_PLUGIN_DATA | REMOVE_WEBSQL |
78 }; | 78 }; |
79 | 79 |
80 // When BrowsingDataRemover successfully removes data, a notification of type | 80 // When BrowsingDataRemover successfully removes data, a notification of type |
81 // NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of | 81 // NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of |
82 // this type. | 82 // this type. |
83 struct NotificationDetails { | 83 struct NotificationDetails { |
84 NotificationDetails(); | 84 NotificationDetails(); |
85 NotificationDetails(const NotificationDetails& details); | 85 NotificationDetails(const NotificationDetails& details); |
86 NotificationDetails(base::Time removal_begin, | 86 NotificationDetails(base::Time removal_begin, |
87 int removal_mask); | 87 int removal_mask); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // Calculate the begin time for the deletion range specified by |time_period|. | 210 // Calculate the begin time for the deletion range specified by |time_period|. |
211 base::Time CalculateBeginDeleteTime(TimePeriod time_period); | 211 base::Time CalculateBeginDeleteTime(TimePeriod time_period); |
212 | 212 |
213 // Returns true if we're all done. | 213 // Returns true if we're all done. |
214 bool all_done() { | 214 bool all_done() { |
215 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && | 215 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
216 !waiting_for_clear_cookies_&& | 216 !waiting_for_clear_cookies_&& |
217 !waiting_for_clear_history_ && | 217 !waiting_for_clear_history_ && |
218 !waiting_for_clear_quota_managed_data_ && | 218 !waiting_for_clear_quota_managed_data_ && |
219 !waiting_for_clear_networking_history_ && | 219 !waiting_for_clear_networking_history_ && |
220 !waiting_for_clear_lso_data_; | 220 !waiting_for_clear_plugin_data_; |
221 } | 221 } |
222 | 222 |
223 // Setter for removing_; DCHECKs that we can only start removing if we're not | 223 // Setter for removing_; DCHECKs that we can only start removing if we're not |
224 // already removing, and vice-versa. | 224 // already removing, and vice-versa. |
225 static void set_removing(bool removing); | 225 static void set_removing(bool removing); |
226 | 226 |
227 content::NotificationRegistrar registrar_; | 227 content::NotificationRegistrar registrar_; |
228 | 228 |
229 // Profile we're to remove from. | 229 // Profile we're to remove from. |
230 Profile* profile_; | 230 Profile* profile_; |
(...skipping 27 matching lines...) Expand all Loading... |
258 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; | 258 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; |
259 base::WaitableEventWatcher watcher_; | 259 base::WaitableEventWatcher watcher_; |
260 | 260 |
261 // True if we're waiting for various data to be deleted. | 261 // True if we're waiting for various data to be deleted. |
262 // These may only be accessed from UI thread in order to avoid races! | 262 // These may only be accessed from UI thread in order to avoid races! |
263 bool waiting_for_clear_history_; | 263 bool waiting_for_clear_history_; |
264 bool waiting_for_clear_quota_managed_data_; | 264 bool waiting_for_clear_quota_managed_data_; |
265 bool waiting_for_clear_networking_history_; | 265 bool waiting_for_clear_networking_history_; |
266 bool waiting_for_clear_cookies_; | 266 bool waiting_for_clear_cookies_; |
267 bool waiting_for_clear_cache_; | 267 bool waiting_for_clear_cache_; |
268 bool waiting_for_clear_lso_data_; | 268 bool waiting_for_clear_plugin_data_; |
269 | 269 |
270 // Tracking how many origins need to be deleted, and whether we're finished | 270 // Tracking how many origins need to be deleted, and whether we're finished |
271 // gathering origins. | 271 // gathering origins. |
272 int quota_managed_origins_to_delete_count_; | 272 int quota_managed_origins_to_delete_count_; |
273 int quota_managed_storage_types_to_delete_count_; | 273 int quota_managed_storage_types_to_delete_count_; |
274 | 274 |
275 // The removal mask for the current removal operation. | 275 // The removal mask for the current removal operation. |
276 int remove_mask_; | 276 int remove_mask_; |
277 | 277 |
278 ObserverList<Observer> observer_list_; | 278 ObserverList<Observer> observer_list_; |
279 | 279 |
280 // Used if we need to clear history. | 280 // Used if we need to clear history. |
281 CancelableRequestConsumer request_consumer_; | 281 CancelableRequestConsumer request_consumer_; |
282 | 282 |
283 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 283 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
284 }; | 284 }; |
285 | 285 |
286 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 286 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |