| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "chrome/common/features.h" | 24 #include "chrome/common/features.h" |
| 25 #include "components/browsing_data/core/browsing_data_utils.h" | 25 #include "components/browsing_data/core/browsing_data_utils.h" |
| 26 #include "components/content_settings/core/common/content_settings_pattern.h" | 26 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 27 #include "components/content_settings/core/common/content_settings_types.h" | 27 #include "components/content_settings/core/common/content_settings_types.h" |
| 28 #include "components/keyed_service/core/keyed_service.h" | 28 #include "components/keyed_service/core/keyed_service.h" |
| 29 #include "components/offline_pages/offline_page_model.h" | 29 #include "components/offline_pages/offline_page_model.h" |
| 30 #include "components/prefs/pref_member.h" | 30 #include "components/prefs/pref_member.h" |
| 31 #include "components/search_engines/template_url_service.h" | 31 #include "components/search_engines/template_url_service.h" |
| 32 #include "ppapi/features/features.h" |
| 32 #include "storage/common/quota/quota_types.h" | 33 #include "storage/common/quota/quota_types.h" |
| 33 #include "url/gurl.h" | 34 #include "url/gurl.h" |
| 34 | 35 |
| 35 #if defined(ENABLE_PLUGINS) | 36 #if BUILDFLAG(ENABLE_PLUGINS) |
| 36 #include "chrome/browser/pepper_flash_settings_manager.h" | 37 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 37 #endif | 38 #endif |
| 38 | 39 |
| 39 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
| 40 #include "chromeos/dbus/dbus_method_call_status.h" | 41 #include "chromeos/dbus/dbus_method_call_status.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 class BrowsingDataFilterBuilder; | 44 class BrowsingDataFilterBuilder; |
| 44 class BrowsingDataFlashLSOHelper; | 45 class BrowsingDataFlashLSOHelper; |
| 45 class BrowsingDataRemoverFactory; | 46 class BrowsingDataRemoverFactory; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // } | 89 // } |
| 89 // | 90 // |
| 90 // void OnBrowsingDataRemoverDone() { | 91 // void OnBrowsingDataRemoverDone() { |
| 91 // LOG(INFO) << "Cookies were deleted."; | 92 // LOG(INFO) << "Cookies were deleted."; |
| 92 // } | 93 // } |
| 93 // } | 94 // } |
| 94 // | 95 // |
| 95 //////////////////////////////////////////////////////////////////////////////// | 96 //////////////////////////////////////////////////////////////////////////////// |
| 96 | 97 |
| 97 class BrowsingDataRemover : public KeyedService | 98 class BrowsingDataRemover : public KeyedService |
| 98 #if defined(ENABLE_PLUGINS) | 99 #if BUILDFLAG(ENABLE_PLUGINS) |
| 99 , public PepperFlashSettingsManager::Client | 100 , public PepperFlashSettingsManager::Client |
| 100 #endif | 101 #endif |
| 101 { | 102 { |
| 102 public: | 103 public: |
| 103 // Mask used for Remove. | 104 // Mask used for Remove. |
| 104 enum RemoveDataMask { | 105 enum RemoveDataMask { |
| 105 REMOVE_APPCACHE = 1 << 0, | 106 REMOVE_APPCACHE = 1 << 0, |
| 106 REMOVE_CACHE = 1 << 1, | 107 REMOVE_CACHE = 1 << 1, |
| 107 REMOVE_COOKIES = 1 << 2, | 108 REMOVE_COOKIES = 1 << 2, |
| 108 REMOVE_DOWNLOADS = 1 << 3, | 109 REMOVE_DOWNLOADS = 1 << 3, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 270 |
| 270 // Used for testing. | 271 // Used for testing. |
| 271 void OverrideStoragePartitionForTesting( | 272 void OverrideStoragePartitionForTesting( |
| 272 content::StoragePartition* storage_partition); | 273 content::StoragePartition* storage_partition); |
| 273 | 274 |
| 274 #if BUILDFLAG(ANDROID_JAVA_UI) | 275 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 275 void OverrideWebappRegistryForTesting( | 276 void OverrideWebappRegistryForTesting( |
| 276 std::unique_ptr<WebappRegistry> webapp_registry); | 277 std::unique_ptr<WebappRegistry> webapp_registry); |
| 277 #endif | 278 #endif |
| 278 | 279 |
| 279 #if defined(ENABLE_PLUGINS) | 280 #if BUILDFLAG(ENABLE_PLUGINS) |
| 280 void OverrideFlashLSOHelperForTesting( | 281 void OverrideFlashLSOHelperForTesting( |
| 281 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper); | 282 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper); |
| 282 #endif | 283 #endif |
| 283 | 284 |
| 284 // Parameters of the last call are exposed to be used by tests. Removal and | 285 // Parameters of the last call are exposed to be used by tests. Removal and |
| 285 // origin type masks equal to -1 mean that no removal has ever been executed. | 286 // origin type masks equal to -1 mean that no removal has ever been executed. |
| 286 // TODO(msramek): If other consumers than tests are interested in this, | 287 // TODO(msramek): If other consumers than tests are interested in this, |
| 287 // consider returning them in OnBrowsingDataRemoverDone() callback. | 288 // consider returning them in OnBrowsingDataRemoverDone() callback. |
| 288 const base::Time& GetLastUsedBeginTime(); | 289 const base::Time& GetLastUsedBeginTime(); |
| 289 const base::Time& GetLastUsedEndTime(); | 290 const base::Time& GetLastUsedEndTime(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 void Shutdown() override; | 342 void Shutdown() override; |
| 342 | 343 |
| 343 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're | 344 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're |
| 344 // not already removing, and vice-versa. | 345 // not already removing, and vice-versa. |
| 345 void SetRemoving(bool is_removing); | 346 void SetRemoving(bool is_removing); |
| 346 | 347 |
| 347 // Callback for when TemplateURLService has finished loading. Clears the data, | 348 // Callback for when TemplateURLService has finished loading. Clears the data, |
| 348 // clears the respective waiting flag, and invokes NotifyIfDone. | 349 // clears the respective waiting flag, and invokes NotifyIfDone. |
| 349 void OnKeywordsLoaded(base::Callback<bool(const GURL&)> url_filter); | 350 void OnKeywordsLoaded(base::Callback<bool(const GURL&)> url_filter); |
| 350 | 351 |
| 351 #if defined(ENABLE_PLUGINS) | 352 #if BUILDFLAG(ENABLE_PLUGINS) |
| 352 // Called when plugin data has been cleared. Invokes NotifyIfDone. | 353 // Called when plugin data has been cleared. Invokes NotifyIfDone. |
| 353 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); | 354 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event); |
| 354 | 355 |
| 355 // Called when the list of |sites| storing Flash LSO cookies is fetched. | 356 // Called when the list of |sites| storing Flash LSO cookies is fetched. |
| 356 void OnSitesWithFlashDataFetched( | 357 void OnSitesWithFlashDataFetched( |
| 357 base::Callback<bool(const std::string&)> plugin_filter, | 358 base::Callback<bool(const std::string&)> plugin_filter, |
| 358 const std::vector<std::string>& sites); | 359 const std::vector<std::string>& sites); |
| 359 | 360 |
| 360 // Indicates that LSO cookies for one website have been deleted. | 361 // Indicates that LSO cookies for one website have been deleted. |
| 361 void OnFlashDataDeleted(); | 362 void OnFlashDataDeleted(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 bool is_removing_; | 493 bool is_removing_; |
| 493 | 494 |
| 494 // Removal tasks to be processed. | 495 // Removal tasks to be processed. |
| 495 std::queue<RemovalTask> task_queue_; | 496 std::queue<RemovalTask> task_queue_; |
| 496 | 497 |
| 497 // If non-NULL, the |completion_inhibitor_| is notified each time an instance | 498 // If non-NULL, the |completion_inhibitor_| is notified each time an instance |
| 498 // is about to complete a browsing data removal process, and has the ability | 499 // is about to complete a browsing data removal process, and has the ability |
| 499 // to artificially delay completion. Used for testing. | 500 // to artificially delay completion. Used for testing. |
| 500 static CompletionInhibitor* completion_inhibitor_; | 501 static CompletionInhibitor* completion_inhibitor_; |
| 501 | 502 |
| 502 #if defined(ENABLE_PLUGINS) | 503 #if BUILDFLAG(ENABLE_PLUGINS) |
| 503 // Used to delete plugin data. | 504 // Used to delete plugin data. |
| 504 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_; | 505 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_; |
| 505 base::WaitableEventWatcher watcher_; | 506 base::WaitableEventWatcher watcher_; |
| 506 | 507 |
| 507 // Used for per-site plugin data deletion. | 508 // Used for per-site plugin data deletion. |
| 508 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; | 509 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; |
| 509 | 510 |
| 510 // Used to deauthorize content licenses for Pepper Flash. | 511 // Used to deauthorize content licenses for Pepper Flash. |
| 511 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; | 512 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; |
| 512 #endif | 513 #endif |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 // not initialised, so the registry must be mocked out. | 564 // not initialised, so the registry must be mocked out. |
| 564 std::unique_ptr<WebappRegistry> webapp_registry_; | 565 std::unique_ptr<WebappRegistry> webapp_registry_; |
| 565 #endif | 566 #endif |
| 566 | 567 |
| 567 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; | 568 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; |
| 568 | 569 |
| 569 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); | 570 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); |
| 570 }; | 571 }; |
| 571 | 572 |
| 572 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ | 573 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ |
| OLD | NEW |