OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 REMOVE_DOWNLOADS = 1 << 3, | 65 REMOVE_DOWNLOADS = 1 << 3, |
66 REMOVE_FILE_SYSTEMS = 1 << 4, | 66 REMOVE_FILE_SYSTEMS = 1 << 4, |
67 REMOVE_FORM_DATA = 1 << 5, | 67 REMOVE_FORM_DATA = 1 << 5, |
68 // In addition to visits, REMOVE_HISTORY removes keywords and last session. | 68 // In addition to visits, REMOVE_HISTORY removes keywords and last session. |
69 REMOVE_HISTORY = 1 << 6, | 69 REMOVE_HISTORY = 1 << 6, |
70 REMOVE_INDEXEDDB = 1 << 7, | 70 REMOVE_INDEXEDDB = 1 << 7, |
71 REMOVE_LOCAL_STORAGE = 1 << 8, | 71 REMOVE_LOCAL_STORAGE = 1 << 8, |
72 REMOVE_PLUGIN_DATA = 1 << 9, | 72 REMOVE_PLUGIN_DATA = 1 << 9, |
73 REMOVE_PASSWORDS = 1 << 10, | 73 REMOVE_PASSWORDS = 1 << 10, |
74 REMOVE_WEBSQL = 1 << 11, | 74 REMOVE_WEBSQL = 1 << 11, |
75 REMOVE_ORIGIN_BOUND_CERTS = 1 << 12, | 75 REMOVE_SERVER_BOUND_CERTS = 1 << 12, |
76 | 76 |
77 // "Site data" includes cookies, appcache, file systems, indexedDBs, local | 77 // "Site data" includes cookies, appcache, file systems, indexedDBs, local |
78 // storage, webSQL, and plugin data. | 78 // storage, webSQL, and plugin data. |
79 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | | 79 REMOVE_SITE_DATA = REMOVE_APPCACHE | REMOVE_COOKIES | REMOVE_FILE_SYSTEMS | |
80 REMOVE_INDEXEDDB | REMOVE_LOCAL_STORAGE | | 80 REMOVE_INDEXEDDB | REMOVE_LOCAL_STORAGE | |
81 REMOVE_PLUGIN_DATA | REMOVE_WEBSQL | | 81 REMOVE_PLUGIN_DATA | REMOVE_WEBSQL | |
82 REMOVE_ORIGIN_BOUND_CERTS | 82 REMOVE_SERVER_BOUND_CERTS |
83 }; | 83 }; |
84 | 84 |
85 // When BrowsingDataRemover successfully removes data, a notification of type | 85 // When BrowsingDataRemover successfully removes data, a notification of type |
86 // NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of | 86 // NOTIFICATION_BROWSING_DATA_REMOVED is triggered with a Details object of |
87 // this type. | 87 // this type. |
88 struct NotificationDetails { | 88 struct NotificationDetails { |
89 NotificationDetails(); | 89 NotificationDetails(); |
90 NotificationDetails(const NotificationDetails& details); | 90 NotificationDetails(const NotificationDetails& details); |
91 NotificationDetails(base::Time removal_begin, | 91 NotificationDetails(base::Time removal_begin, |
92 int removal_mask); | 92 int removal_mask); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // Completion handler that runs on the UI thread once persistent data has been | 228 // Completion handler that runs on the UI thread once persistent data has been |
229 // deleted. Updates the waiting flag and invokes NotifyAndDeleteIfDone. | 229 // deleted. Updates the waiting flag and invokes NotifyAndDeleteIfDone. |
230 void OnQuotaManagedDataDeleted(); | 230 void OnQuotaManagedDataDeleted(); |
231 | 231 |
232 // Callback when Cookies has been deleted. Invokes NotifyAndDeleteIfDone. | 232 // Callback when Cookies has been deleted. Invokes NotifyAndDeleteIfDone. |
233 void OnClearedCookies(int num_deleted); | 233 void OnClearedCookies(int num_deleted); |
234 | 234 |
235 // Invoked on the IO thread to delete cookies. | 235 // Invoked on the IO thread to delete cookies. |
236 void ClearCookiesOnIOThread(net::URLRequestContextGetter* rq_context); | 236 void ClearCookiesOnIOThread(net::URLRequestContextGetter* rq_context); |
237 | 237 |
238 // Invoked on the IO thread to delete origin bound certs. | 238 // Invoked on the IO thread to delete server bound certs. |
239 void ClearOriginBoundCertsOnIOThread( | 239 void ClearServerBoundCertsOnIOThread( |
240 net::URLRequestContextGetter* rq_context); | 240 net::URLRequestContextGetter* rq_context); |
241 | 241 |
242 // Callback when origin bound certs have been deleted. Invokes | 242 // Callback when server bound certs have been deleted. Invokes |
243 // NotifyAndDeleteIfDone. | 243 // NotifyAndDeleteIfDone. |
244 void OnClearedOriginBoundCerts(); | 244 void OnClearedServerBoundCerts(); |
245 | 245 |
246 // Calculate the begin time for the deletion range specified by |time_period|. | 246 // Calculate the begin time for the deletion range specified by |time_period|. |
247 base::Time CalculateBeginDeleteTime(TimePeriod time_period); | 247 base::Time CalculateBeginDeleteTime(TimePeriod time_period); |
248 | 248 |
249 // Returns true if we're all done. | 249 // Returns true if we're all done. |
250 bool all_done() { | 250 bool all_done() { |
251 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && | 251 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
252 !waiting_for_clear_cookies_count_&& | 252 !waiting_for_clear_cookies_count_&& |
253 !waiting_for_clear_history_ && | 253 !waiting_for_clear_history_ && |
254 !waiting_for_clear_networking_history_ && | 254 !waiting_for_clear_networking_history_ && |
255 !waiting_for_clear_origin_bound_certs_ && | 255 !waiting_for_clear_server_bound_certs_ && |
256 !waiting_for_clear_plugin_data_ && | 256 !waiting_for_clear_plugin_data_ && |
257 !waiting_for_clear_quota_managed_data_; | 257 !waiting_for_clear_quota_managed_data_; |
258 } | 258 } |
259 | 259 |
260 // Setter for removing_; DCHECKs that we can only start removing if we're not | 260 // Setter for removing_; DCHECKs that we can only start removing if we're not |
261 // already removing, and vice-versa. | 261 // already removing, and vice-versa. |
262 static void set_removing(bool removing); | 262 static void set_removing(bool removing); |
263 | 263 |
264 content::NotificationRegistrar registrar_; | 264 content::NotificationRegistrar registrar_; |
265 | 265 |
(...skipping 27 matching lines...) Expand all Loading... |
293 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; | 293 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; |
294 base::WaitableEventWatcher watcher_; | 294 base::WaitableEventWatcher watcher_; |
295 | 295 |
296 // True if we're waiting for various data to be deleted. | 296 // True if we're waiting for various data to be deleted. |
297 // These may only be accessed from UI thread in order to avoid races! | 297 // These may only be accessed from UI thread in order to avoid races! |
298 bool waiting_for_clear_cache_; | 298 bool waiting_for_clear_cache_; |
299 // Non-zero if waiting for cookies to be cleared. | 299 // Non-zero if waiting for cookies to be cleared. |
300 int waiting_for_clear_cookies_count_; | 300 int waiting_for_clear_cookies_count_; |
301 bool waiting_for_clear_history_; | 301 bool waiting_for_clear_history_; |
302 bool waiting_for_clear_networking_history_; | 302 bool waiting_for_clear_networking_history_; |
303 bool waiting_for_clear_origin_bound_certs_; | 303 bool waiting_for_clear_server_bound_certs_; |
304 bool waiting_for_clear_plugin_data_; | 304 bool waiting_for_clear_plugin_data_; |
305 bool waiting_for_clear_quota_managed_data_; | 305 bool waiting_for_clear_quota_managed_data_; |
306 | 306 |
307 // Tracking how many origins need to be deleted, and whether we're finished | 307 // Tracking how many origins need to be deleted, and whether we're finished |
308 // gathering origins. | 308 // gathering origins. |
309 int quota_managed_origins_to_delete_count_; | 309 int quota_managed_origins_to_delete_count_; |
310 int quota_managed_storage_types_to_delete_count_; | 310 int quota_managed_storage_types_to_delete_count_; |
311 | 311 |
312 // The removal mask for the current removal operation. | 312 // The removal mask for the current removal operation. |
313 int remove_mask_; | 313 int remove_mask_; |
314 | 314 |
315 // The origin for the current removal operation. | 315 // The origin for the current removal operation. |
316 GURL remove_origin_; | 316 GURL remove_origin_; |
317 | 317 |
318 // Should data for protected origins be removed? | 318 // Should data for protected origins be removed? |
319 bool remove_protected_; | 319 bool remove_protected_; |
320 | 320 |
321 ObserverList<Observer> observer_list_; | 321 ObserverList<Observer> observer_list_; |
322 | 322 |
323 // Used if we need to clear history. | 323 // Used if we need to clear history. |
324 CancelableRequestConsumer request_consumer_; | 324 CancelableRequestConsumer request_consumer_; |
325 | 325 |
326 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 326 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
327 }; | 327 }; |
328 | 328 |
329 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 329 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |