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_BROWSING_DATA_REMOVER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // Creates a BrowsingDataRemover bound to a specific period of time (as | 149 // Creates a BrowsingDataRemover bound to a specific period of time (as |
150 // defined via a TimePeriod). Returns a raw pointer, as BrowsingDataRemover | 150 // defined via a TimePeriod). Returns a raw pointer, as BrowsingDataRemover |
151 // retains ownership of itself, and deletes itself once finished. | 151 // retains ownership of itself, and deletes itself once finished. |
152 static BrowsingDataRemover* CreateForPeriod(Profile* profile, | 152 static BrowsingDataRemover* CreateForPeriod(Profile* profile, |
153 TimePeriod period); | 153 TimePeriod period); |
154 | 154 |
155 // Calculate the begin time for the deletion range specified by |time_period|. | 155 // Calculate the begin time for the deletion range specified by |time_period|. |
156 static base::Time CalculateBeginDeleteTime(TimePeriod time_period); | 156 static base::Time CalculateBeginDeleteTime(TimePeriod time_period); |
157 | 157 |
158 // Quota managed data uses a different bitmask for types than | |
159 // BrowsingDataRemover uses. This method generates that mask. | |
160 static int GenerateQuotaClientMask(int remove_mask); | |
161 | |
162 // Is the BrowsingDataRemover currently in the process of removing data? | 158 // Is the BrowsingDataRemover currently in the process of removing data? |
163 static bool is_removing() { return is_removing_; } | 159 static bool is_removing() { return is_removing_; } |
164 | 160 |
165 // Removes the specified items related to browsing for all origins that match | 161 // Removes the specified items related to browsing for all origins that match |
166 // the provided |origin_set_mask| (see BrowsingDataHelper::OriginSetMask). | 162 // the provided |origin_set_mask| (see BrowsingDataHelper::OriginSetMask). |
167 void Remove(int remove_mask, int origin_set_mask); | 163 void Remove(int remove_mask, int origin_set_mask); |
168 | 164 |
169 void AddObserver(Observer* observer); | 165 void AddObserver(Observer* observer); |
170 void RemoveObserver(Observer* observer); | 166 void RemoveObserver(Observer* observer); |
171 | 167 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // NotifyAndDeleteIfDone. | 286 // NotifyAndDeleteIfDone. |
291 void ClearedPnaclCache(); | 287 void ClearedPnaclCache(); |
292 | 288 |
293 // Invokes ClearedPnaclCacheOn on the UI thread. | 289 // Invokes ClearedPnaclCacheOn on the UI thread. |
294 void ClearedPnaclCacheOnIOThread(); | 290 void ClearedPnaclCacheOnIOThread(); |
295 | 291 |
296 // Invoked on the IO thread to delete entries in the PNaCl translation cache. | 292 // Invoked on the IO thread to delete entries in the PNaCl translation cache. |
297 void ClearPnaclCacheOnIOThread(base::Time begin, base::Time end); | 293 void ClearPnaclCacheOnIOThread(base::Time begin, base::Time end); |
298 #endif | 294 #endif |
299 | 295 |
300 // Invoked on the UI thread to delete local storage. | |
301 void ClearLocalStorageOnUIThread(); | |
302 | |
303 // Callback to deal with the list gathered in ClearLocalStorageOnUIThread. | |
304 void OnGotLocalStorageUsageInfo( | |
305 const std::vector<content::LocalStorageUsageInfo>& infos); | |
306 | |
307 // Invoked on the UI thread to delete session storage. | |
308 void ClearSessionStorageOnUIThread(); | |
309 | |
310 // Callback to deal with the list gathered in ClearSessionStorageOnUIThread. | |
311 void OnGotSessionStorageUsageInfo( | |
312 const std::vector<content::SessionStorageUsageInfo>& infos); | |
313 | |
314 // Invoked on the IO thread to delete all storage types managed by the quota | |
315 // system: AppCache, Databases, FileSystems. | |
316 void ClearQuotaManagedDataOnIOThread(); | |
317 | |
318 // Callback to respond to QuotaManager::GetOriginsModifiedSince, which is the | |
319 // core of 'ClearQuotaManagedDataOnIOThread'. | |
320 void OnGotQuotaManagedOrigins(const std::set<GURL>& origins, | |
321 quota::StorageType type); | |
322 | |
323 // Callback responding to deletion of a single quota managed origin's | |
324 // persistent data | |
325 void OnQuotaManagedOriginDeletion(const GURL& origin, | |
326 quota::StorageType type, | |
327 quota::QuotaStatusCode); | |
328 | |
329 // Called to check whether all temporary and persistent origin data that | |
330 // should be deleted has been deleted. If everything's good to go, invokes | |
331 // OnQuotaManagedDataDeleted on the UI thread. | |
332 void CheckQuotaManagedDataDeletionStatus(); | |
333 | |
334 // Completion handler that runs on the UI thread once persistent data has been | |
335 // deleted. Updates the waiting flag and invokes NotifyAndDeleteIfDone. | |
336 void OnQuotaManagedDataDeleted(); | |
337 | |
338 // Callback for when Cookies has been deleted. Invokes NotifyAndDeleteIfDone. | 296 // Callback for when Cookies has been deleted. Invokes NotifyAndDeleteIfDone. |
339 void OnClearedCookies(int num_deleted); | 297 void OnClearedCookies(int num_deleted); |
340 | 298 |
341 // Invoked on the IO thread to delete cookies. | 299 // Invoked on the IO thread to delete cookies. |
342 void ClearCookiesOnIOThread(net::URLRequestContextGetter* rq_context); | 300 void ClearCookiesOnIOThread(net::URLRequestContextGetter* rq_context); |
343 | 301 |
344 // Invoked on the IO thread to delete server bound certs. | 302 // Invoked on the IO thread to delete server bound certs. |
345 void ClearServerBoundCertsOnIOThread( | 303 void ClearServerBoundCertsOnIOThread( |
346 net::URLRequestContextGetter* rq_context); | 304 net::URLRequestContextGetter* rq_context); |
347 | 305 |
348 // Callback on IO Thread when server bound certs have been deleted. Clears SSL | 306 // Callback on IO Thread when server bound certs have been deleted. Clears SSL |
349 // connection pool and posts to UI thread to run OnClearedServerBoundCerts. | 307 // connection pool and posts to UI thread to run OnClearedServerBoundCerts. |
350 void OnClearedServerBoundCertsOnIOThread( | 308 void OnClearedServerBoundCertsOnIOThread( |
351 net::URLRequestContextGetter* rq_context); | 309 net::URLRequestContextGetter* rq_context); |
352 | 310 |
353 // Callback for when server bound certs have been deleted. Invokes | 311 // Callback for when server bound certs have been deleted. Invokes |
354 // NotifyAndDeleteIfDone. | 312 // NotifyAndDeleteIfDone. |
355 void OnClearedServerBoundCerts(); | 313 void OnClearedServerBoundCerts(); |
356 | 314 |
357 // Callback from the above method. | 315 // Callback from the above method. |
358 void OnClearedFormData(); | 316 void OnClearedFormData(); |
359 | 317 |
360 // Callback for when the Autofill profile and credit card origin URLs have | 318 // Callback for when the Autofill profile and credit card origin URLs have |
361 // been deleted. | 319 // been deleted. |
362 void OnClearedAutofillOriginURLs(); | 320 void OnClearedAutofillOriginURLs(); |
363 | 321 |
364 // Callback for when the shader cache has been deleted. | |
365 // Invokes NotifyAndDeleteIfDone. | |
366 void ClearedShaderCache(); | |
367 | 322 |
368 // Invoked on the IO thread to delete from the shader cache. | 323 // Callback on UI thread when the storage partition related data are cleared. |
369 void ClearShaderCacheOnUIThread(); | 324 void OnClearedStoragePartitionData(); |
370 | |
371 // Callback on UI thread when the WebRTC identities are cleared. | |
372 void OnClearWebRTCIdentityStore(); | |
373 | 325 |
374 // Returns true if we're all done. | 326 // Returns true if we're all done. |
375 bool AllDone(); | 327 bool AllDone(); |
376 | 328 |
377 // Profile we're to remove from. | 329 // Profile we're to remove from. |
378 Profile* profile_; | 330 Profile* profile_; |
379 | 331 |
380 // The QuotaManager is owned by the profile; we can use a raw pointer here, | |
381 // and rely on the profile to destroy the object whenever it's reasonable. | |
382 quota::QuotaManager* quota_manager_; | |
383 | |
384 // The DOMStorageContext is owned by the profile; we'll store a raw pointer. | |
385 content::DOMStorageContext* dom_storage_context_; | |
386 | |
387 // 'Protected' origins are not subject to data removal. | 332 // 'Protected' origins are not subject to data removal. |
388 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; | 333 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
389 | 334 |
390 // Start time to delete from. | 335 // Start time to delete from. |
391 const base::Time delete_begin_; | 336 const base::Time delete_begin_; |
392 | 337 |
393 // End time to delete to. | 338 // End time to delete to. |
394 base::Time delete_end_; | 339 base::Time delete_end_; |
395 | 340 |
396 // True if Remove has been invoked. | 341 // True if Remove has been invoked. |
(...skipping 19 matching lines...) Expand all Loading... |
416 // True if we're waiting for various data to be deleted. | 361 // True if we're waiting for various data to be deleted. |
417 // These may only be accessed from UI thread in order to avoid races! | 362 // These may only be accessed from UI thread in order to avoid races! |
418 bool waiting_for_clear_autofill_origin_urls_; | 363 bool waiting_for_clear_autofill_origin_urls_; |
419 bool waiting_for_clear_cache_; | 364 bool waiting_for_clear_cache_; |
420 bool waiting_for_clear_content_licenses_; | 365 bool waiting_for_clear_content_licenses_; |
421 // Non-zero if waiting for cookies to be cleared. | 366 // Non-zero if waiting for cookies to be cleared. |
422 int waiting_for_clear_cookies_count_; | 367 int waiting_for_clear_cookies_count_; |
423 bool waiting_for_clear_form_; | 368 bool waiting_for_clear_form_; |
424 bool waiting_for_clear_history_; | 369 bool waiting_for_clear_history_; |
425 bool waiting_for_clear_hostname_resolution_cache_; | 370 bool waiting_for_clear_hostname_resolution_cache_; |
426 bool waiting_for_clear_local_storage_; | 371 bool waiting_for_clear_keyword_data_; |
427 bool waiting_for_clear_logged_in_predictor_; | 372 bool waiting_for_clear_logged_in_predictor_; |
428 bool waiting_for_clear_nacl_cache_; | 373 bool waiting_for_clear_nacl_cache_; |
429 bool waiting_for_clear_network_predictor_; | 374 bool waiting_for_clear_network_predictor_; |
430 bool waiting_for_clear_networking_history_; | 375 bool waiting_for_clear_networking_history_; |
431 bool waiting_for_clear_plugin_data_; | 376 bool waiting_for_clear_plugin_data_; |
432 bool waiting_for_clear_pnacl_cache_; | 377 bool waiting_for_clear_pnacl_cache_; |
433 bool waiting_for_clear_quota_managed_data_; | 378 bool waiting_for_clear_quota_managed_data_; |
434 bool waiting_for_clear_server_bound_certs_; | 379 bool waiting_for_clear_server_bound_certs_; |
435 bool waiting_for_clear_session_storage_; | 380 bool waiting_for_clear_storage_partition_data_; |
436 bool waiting_for_clear_shader_cache_; | |
437 bool waiting_for_clear_webrtc_identity_store_; | |
438 bool waiting_for_clear_keyword_data_; | |
439 | |
440 // Tracking how many origins need to be deleted, and whether we're finished | |
441 // gathering origins. | |
442 int quota_managed_origins_to_delete_count_; | |
443 int quota_managed_storage_types_to_delete_count_; | |
444 | 381 |
445 // The removal mask for the current removal operation. | 382 // The removal mask for the current removal operation. |
446 int remove_mask_; | 383 int remove_mask_; |
447 | 384 |
448 // The origin for the current removal operation. | 385 // The origin for the current removal operation. |
449 GURL remove_origin_; | 386 GURL remove_origin_; |
450 | 387 |
451 // From which types of origins should we remove data? | 388 // From which types of origins should we remove data? |
452 int origin_set_mask_; | 389 int origin_set_mask_; |
453 | 390 |
454 ObserverList<Observer> observer_list_; | 391 ObserverList<Observer> observer_list_; |
455 | 392 |
456 // Used if we need to clear history. | 393 // Used if we need to clear history. |
457 CancelableTaskTracker history_task_tracker_; | 394 CancelableTaskTracker history_task_tracker_; |
458 | 395 |
459 scoped_ptr<TemplateURLService::Subscription> template_url_sub_; | 396 scoped_ptr<TemplateURLService::Subscription> template_url_sub_; |
460 | 397 |
461 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 398 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
462 }; | 399 }; |
463 | 400 |
464 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 401 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
OLD | NEW |