Chromium Code Reviews| 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" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/prefs/pref_member.h" | 13 #include "base/prefs/pref_member.h" |
| 14 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
| 15 #include "base/synchronization/waitable_event_watcher.h" | 15 #include "base/synchronization/waitable_event_watcher.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "chrome/browser/pepper_flash_settings_manager.h" | 17 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 18 #include "chrome/browser/search_engines/template_url_service.h" | |
| 18 #include "chrome/common/cancelable_task_tracker.h" | 19 #include "chrome/common/cancelable_task_tracker.h" |
| 19 #include "content/public/browser/notification_observer.h" | |
| 20 #include "content/public/browser/notification_registrar.h" | |
| 21 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 22 #include "webkit/common/quota/quota_types.h" | 21 #include "webkit/common/quota/quota_types.h" |
| 23 | 22 |
| 24 class ExtensionSpecialStoragePolicy; | 23 class ExtensionSpecialStoragePolicy; |
| 25 class IOThread; | 24 class IOThread; |
| 26 class Profile; | 25 class Profile; |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 class PluginDataRemover; | 28 class PluginDataRemover; |
| 30 } | 29 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 43 | 42 |
| 44 namespace content { | 43 namespace content { |
| 45 class DOMStorageContext; | 44 class DOMStorageContext; |
| 46 struct LocalStorageUsageInfo; | 45 struct LocalStorageUsageInfo; |
| 47 struct SessionStorageUsageInfo; | 46 struct SessionStorageUsageInfo; |
| 48 } | 47 } |
| 49 | 48 |
| 50 // BrowsingDataRemover is responsible for removing data related to browsing: | 49 // BrowsingDataRemover is responsible for removing data related to browsing: |
| 51 // visits in url database, downloads, cookies ... | 50 // visits in url database, downloads, cookies ... |
| 52 | 51 |
| 53 class BrowsingDataRemover : public content::NotificationObserver | 52 class BrowsingDataRemover |
| 54 #if defined(ENABLE_PLUGINS) | 53 #if defined(ENABLE_PLUGINS) |
| 55 , public PepperFlashSettingsManager::Client | 54 : public PepperFlashSettingsManager::Client |
| 56 #endif | 55 #endif |
| 57 { | 56 { |
| 58 public: | 57 public: |
| 59 // Time period ranges available when doing browsing data removals. | 58 // Time period ranges available when doing browsing data removals. |
| 60 enum TimePeriod { | 59 enum TimePeriod { |
| 61 LAST_HOUR = 0, | 60 LAST_HOUR = 0, |
| 62 LAST_DAY, | 61 LAST_DAY, |
| 63 LAST_WEEK, | 62 LAST_WEEK, |
| 64 FOUR_WEEKS, | 63 FOUR_WEEKS, |
| 65 EVERYTHING | 64 EVERYTHING |
| 66 }; | 65 }; |
| 67 | 66 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 BrowsingDataRemover(Profile* profile, | 206 BrowsingDataRemover(Profile* profile, |
| 208 base::Time delete_begin, | 207 base::Time delete_begin, |
| 209 base::Time delete_end); | 208 base::Time delete_end); |
| 210 | 209 |
| 211 // BrowsingDataRemover deletes itself (using DeleteHelper) and is not supposed | 210 // BrowsingDataRemover deletes itself (using DeleteHelper) and is not supposed |
| 212 // to be deleted by other objects so make destructor private and DeleteHelper | 211 // to be deleted by other objects so make destructor private and DeleteHelper |
| 213 // a friend. | 212 // a friend. |
| 214 friend class base::DeleteHelper<BrowsingDataRemover>; | 213 friend class base::DeleteHelper<BrowsingDataRemover>; |
| 215 virtual ~BrowsingDataRemover(); | 214 virtual ~BrowsingDataRemover(); |
| 216 | 215 |
| 217 // content::NotificationObserver method. Callback when TemplateURLService has | 216 // Callback when TemplateURLService has finished loading. |
|
Avi (use Gerrit)
2013/10/02 22:27:52
"Callback for when..."?
Cait (Slow)
2013/10/03 15:36:45
Done.
| |
| 218 // finished loading. Deletes the entries from the model, and if we're not | 217 void OnKeywordsLoaded(); |
| 219 // waiting on anything else notifies observers and deletes this | |
| 220 // BrowsingDataRemover. | |
| 221 virtual void Observe(int type, | |
| 222 const content::NotificationSource& source, | |
| 223 const content::NotificationDetails& details) OVERRIDE; | |
| 224 | 218 |
| 225 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. | 219 // Called when plug-in data has been cleared. Invokes NotifyAndDeleteIfDone. |
| 226 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 220 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
| 227 | 221 |
| 228 #if defined(ENABLE_PLUGINS) | 222 #if defined(ENABLE_PLUGINS) |
| 229 // PepperFlashSettingsManager::Client implementation. | 223 // PepperFlashSettingsManager::Client implementation. |
| 230 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, | 224 virtual void OnDeauthorizeContentLicensesCompleted(uint32 request_id, |
| 231 bool success) OVERRIDE; | 225 bool success) OVERRIDE; |
| 232 #endif | 226 #endif |
| 233 | 227 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 | 364 |
| 371 // Invoked on the IO thread to delete from the shader cache. | 365 // Invoked on the IO thread to delete from the shader cache. |
| 372 void ClearShaderCacheOnUIThread(); | 366 void ClearShaderCacheOnUIThread(); |
| 373 | 367 |
| 374 // Callback on UI thread when the WebRTC identities are cleared. | 368 // Callback on UI thread when the WebRTC identities are cleared. |
| 375 void OnClearWebRTCIdentityStore(); | 369 void OnClearWebRTCIdentityStore(); |
| 376 | 370 |
| 377 // Returns true if we're all done. | 371 // Returns true if we're all done. |
| 378 bool AllDone(); | 372 bool AllDone(); |
| 379 | 373 |
| 380 content::NotificationRegistrar registrar_; | |
| 381 | |
| 382 // Profile we're to remove from. | 374 // Profile we're to remove from. |
| 383 Profile* profile_; | 375 Profile* profile_; |
| 384 | 376 |
| 385 // The QuotaManager is owned by the profile; we can use a raw pointer here, | 377 // The QuotaManager is owned by the profile; we can use a raw pointer here, |
| 386 // and rely on the profile to destroy the object whenever it's reasonable. | 378 // and rely on the profile to destroy the object whenever it's reasonable. |
| 387 quota::QuotaManager* quota_manager_; | 379 quota::QuotaManager* quota_manager_; |
| 388 | 380 |
| 389 // The DOMStorageContext is owned by the profile; we'll store a raw pointer. | 381 // The DOMStorageContext is owned by the profile; we'll store a raw pointer. |
| 390 content::DOMStorageContext* dom_storage_context_; | 382 content::DOMStorageContext* dom_storage_context_; |
| 391 | 383 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 bool waiting_for_clear_nacl_cache_; | 425 bool waiting_for_clear_nacl_cache_; |
| 434 bool waiting_for_clear_network_predictor_; | 426 bool waiting_for_clear_network_predictor_; |
| 435 bool waiting_for_clear_networking_history_; | 427 bool waiting_for_clear_networking_history_; |
| 436 bool waiting_for_clear_plugin_data_; | 428 bool waiting_for_clear_plugin_data_; |
| 437 bool waiting_for_clear_pnacl_cache_; | 429 bool waiting_for_clear_pnacl_cache_; |
| 438 bool waiting_for_clear_quota_managed_data_; | 430 bool waiting_for_clear_quota_managed_data_; |
| 439 bool waiting_for_clear_server_bound_certs_; | 431 bool waiting_for_clear_server_bound_certs_; |
| 440 bool waiting_for_clear_session_storage_; | 432 bool waiting_for_clear_session_storage_; |
| 441 bool waiting_for_clear_shader_cache_; | 433 bool waiting_for_clear_shader_cache_; |
| 442 bool waiting_for_clear_webrtc_identity_store_; | 434 bool waiting_for_clear_webrtc_identity_store_; |
| 435 bool waiting_for_clear_keyword_data_; | |
| 443 | 436 |
| 444 // Tracking how many origins need to be deleted, and whether we're finished | 437 // Tracking how many origins need to be deleted, and whether we're finished |
| 445 // gathering origins. | 438 // gathering origins. |
| 446 int quota_managed_origins_to_delete_count_; | 439 int quota_managed_origins_to_delete_count_; |
| 447 int quota_managed_storage_types_to_delete_count_; | 440 int quota_managed_storage_types_to_delete_count_; |
| 448 | 441 |
| 449 // The removal mask for the current removal operation. | 442 // The removal mask for the current removal operation. |
| 450 int remove_mask_; | 443 int remove_mask_; |
| 451 | 444 |
| 452 // The origin for the current removal operation. | 445 // The origin for the current removal operation. |
| 453 GURL remove_origin_; | 446 GURL remove_origin_; |
| 454 | 447 |
| 455 // From which types of origins should we remove data? | 448 // From which types of origins should we remove data? |
| 456 int origin_set_mask_; | 449 int origin_set_mask_; |
| 457 | 450 |
| 458 ObserverList<Observer> observer_list_; | 451 ObserverList<Observer> observer_list_; |
| 459 | 452 |
| 460 // Used if we need to clear history. | 453 // Used if we need to clear history. |
| 461 CancelableTaskTracker history_task_tracker_; | 454 CancelableTaskTracker history_task_tracker_; |
| 462 | 455 |
| 456 scoped_ptr<TemplateURLService::Subscription> template_url_sub_; | |
| 457 | |
| 463 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 458 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 464 }; | 459 }; |
| 465 | 460 |
| 466 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 461 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |