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_DOMAIN_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_DOMAIN_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 domain bound certs. |
239 void ClearOriginBoundCertsOnIOThread( | 239 void ClearDomainBoundCertsOnIOThread( |
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 domain bound certs have been deleted. Invokes |
243 // NotifyAndDeleteIfDone. | 243 // NotifyAndDeleteIfDone. |
244 void OnClearedOriginBoundCerts(); | 244 void OnClearedDomainBoundCerts(); |
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 // Invoked on the WEBKIT thread to clear local storage. | 249 // Invoked on the WEBKIT thread to clear local storage. |
250 void ClearDOMStorageOnWebKitThread( | 250 void ClearDOMStorageOnWebKitThread( |
251 scoped_refptr<content::DOMStorageContext> dom_storage_context); | 251 scoped_refptr<content::DOMStorageContext> dom_storage_context); |
252 | 252 |
253 // Returns true if we're all done. | 253 // Returns true if we're all done. |
254 bool all_done() { | 254 bool all_done() { |
255 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && | 255 return registrar_.IsEmpty() && !waiting_for_clear_cache_ && |
256 !waiting_for_clear_cookies_count_&& | 256 !waiting_for_clear_cookies_count_&& |
257 !waiting_for_clear_history_ && | 257 !waiting_for_clear_history_ && |
258 !waiting_for_clear_networking_history_ && | 258 !waiting_for_clear_networking_history_ && |
259 !waiting_for_clear_origin_bound_certs_ && | 259 !waiting_for_clear_domain_bound_certs_ && |
260 !waiting_for_clear_plugin_data_ && | 260 !waiting_for_clear_plugin_data_ && |
261 !waiting_for_clear_quota_managed_data_; | 261 !waiting_for_clear_quota_managed_data_; |
262 } | 262 } |
263 | 263 |
264 // Setter for removing_; DCHECKs that we can only start removing if we're not | 264 // Setter for removing_; DCHECKs that we can only start removing if we're not |
265 // already removing, and vice-versa. | 265 // already removing, and vice-versa. |
266 static void set_removing(bool removing); | 266 static void set_removing(bool removing); |
267 | 267 |
268 content::NotificationRegistrar registrar_; | 268 content::NotificationRegistrar registrar_; |
269 | 269 |
(...skipping 27 matching lines...) Expand all Loading... |
297 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; | 297 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; |
298 base::WaitableEventWatcher watcher_; | 298 base::WaitableEventWatcher watcher_; |
299 | 299 |
300 // True if we're waiting for various data to be deleted. | 300 // True if we're waiting for various data to be deleted. |
301 // These may only be accessed from UI thread in order to avoid races! | 301 // These may only be accessed from UI thread in order to avoid races! |
302 bool waiting_for_clear_cache_; | 302 bool waiting_for_clear_cache_; |
303 // Non-zero if waiting for cookies to be cleared. | 303 // Non-zero if waiting for cookies to be cleared. |
304 int waiting_for_clear_cookies_count_; | 304 int waiting_for_clear_cookies_count_; |
305 bool waiting_for_clear_history_; | 305 bool waiting_for_clear_history_; |
306 bool waiting_for_clear_networking_history_; | 306 bool waiting_for_clear_networking_history_; |
307 bool waiting_for_clear_origin_bound_certs_; | 307 bool waiting_for_clear_domain_bound_certs_; |
308 bool waiting_for_clear_plugin_data_; | 308 bool waiting_for_clear_plugin_data_; |
309 bool waiting_for_clear_quota_managed_data_; | 309 bool waiting_for_clear_quota_managed_data_; |
310 | 310 |
311 // Tracking how many origins need to be deleted, and whether we're finished | 311 // Tracking how many origins need to be deleted, and whether we're finished |
312 // gathering origins. | 312 // gathering origins. |
313 int quota_managed_origins_to_delete_count_; | 313 int quota_managed_origins_to_delete_count_; |
314 int quota_managed_storage_types_to_delete_count_; | 314 int quota_managed_storage_types_to_delete_count_; |
315 | 315 |
316 // The removal mask for the current removal operation. | 316 // The removal mask for the current removal operation. |
317 int remove_mask_; | 317 int remove_mask_; |
318 | 318 |
319 // The origin for the current removal operation. | 319 // The origin for the current removal operation. |
320 GURL remove_origin_; | 320 GURL remove_origin_; |
321 | 321 |
322 // Should data for protected origins be removed? | 322 // Should data for protected origins be removed? |
323 bool remove_protected_; | 323 bool remove_protected_; |
324 | 324 |
325 ObserverList<Observer> observer_list_; | 325 ObserverList<Observer> observer_list_; |
326 | 326 |
327 // Used if we need to clear history. | 327 // Used if we need to clear history. |
328 CancelableRequestConsumer request_consumer_; | 328 CancelableRequestConsumer request_consumer_; |
329 | 329 |
330 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 330 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
331 }; | 331 }; |
332 | 332 |
333 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ | 333 #endif // CHROME_BROWSER_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |