OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/synchronization/waitable_event_watcher.h" |
| 11 #include "base/task/cancelable_task_tracker.h" |
| 12 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 13 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" |
| 14 #include "chrome/common/features.h" |
| 15 #include "components/browsing_data/core/browsing_data_utils.h" |
| 16 #include "components/offline_pages/core/offline_page_model.h" |
| 17 #include "components/search_engines/template_url_service.h" |
| 18 #include "media/media_features.h" |
| 19 #include "ppapi/features/features.h" |
| 20 |
| 21 #if BUILDFLAG(ENABLE_PLUGINS) |
| 22 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 23 #endif |
| 24 |
| 25 #if defined(OS_CHROMEOS) |
| 26 #include "chromeos/dbus/dbus_method_call_status.h" |
| 27 #endif |
| 28 |
| 29 class WebappRegistry; |
| 30 |
| 31 // A delegate used by BrowsingDataRemover to delete data specific to Chrome |
| 32 // as the embedder. |
| 33 class ChromeBrowsingDataRemoverDelegate : public BrowsingDataRemoverDelegate |
| 34 #if BUILDFLAG(ENABLE_PLUGINS) |
| 35 , public PepperFlashSettingsManager::Client |
| 36 #endif |
| 37 { |
| 38 public: |
| 39 ChromeBrowsingDataRemoverDelegate(content::BrowserContext* browser_context); |
| 40 ~ChromeBrowsingDataRemoverDelegate() override; |
| 41 |
| 42 // Removes Chrome-specific data. |
| 43 void RemoveEmbedderData( |
| 44 const base::Time& delete_begin, |
| 45 const base::Time& delete_end, |
| 46 int remove_mask, |
| 47 const BrowsingDataFilterBuilder& filter_builder, |
| 48 int origin_type_mask, |
| 49 const base::Closure& callback) override; |
| 50 |
| 51 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 52 void OverrideWebappRegistryForTesting( |
| 53 std::unique_ptr<WebappRegistry> webapp_registry); |
| 54 #endif |
| 55 |
| 56 private: |
| 57 // If AllDone(), calls the callback provided in RemoveEmbedderData(). |
| 58 void NotifyIfDone(); |
| 59 |
| 60 // Whether there are no running deletion tasks. |
| 61 bool AllDone(); |
| 62 |
| 63 // Callback for when TemplateURLService has finished loading. Clears the data, |
| 64 // clears the respective waiting flag, and invokes NotifyIfDone. |
| 65 void OnKeywordsLoaded(base::Callback<bool(const GURL&)> url_filter); |
| 66 |
| 67 #if defined (OS_CHROMEOS) |
| 68 void OnClearPlatformKeys(chromeos::DBusMethodCallStatus call_status, |
| 69 bool result); |
| 70 #endif |
| 71 |
| 72 // Callback for when cookies have been deleted. Invokes NotifyIfDone. |
| 73 void OnClearedCookies(); |
| 74 |
| 75 #if BUILDFLAG(ENABLE_PLUGINS) |
| 76 // PepperFlashSettingsManager::Client implementation. |
| 77 void OnDeauthorizeFlashContentLicensesCompleted(uint32_t request_id, |
| 78 bool success) override; |
| 79 #endif |
| 80 |
| 81 // The profile for which the data will be deleted. |
| 82 Profile* profile_; |
| 83 |
| 84 // Start time to delete from. |
| 85 base::Time delete_begin_; |
| 86 |
| 87 // End time to delete to. |
| 88 base::Time delete_end_; |
| 89 |
| 90 // Completion callback to call when all data are deleted. |
| 91 base::Closure callback_; |
| 92 |
| 93 // A callback to NotifyIfDone() used by SubTasks instances. |
| 94 const base::Closure sub_task_forward_callback_; |
| 95 |
| 96 // Keeping track of various subtasks to be completed. |
| 97 // Non-zero if waiting for SafeBrowsing cookies to be cleared. |
| 98 int clear_cookies_count_ = 0; |
| 99 BrowsingDataRemover::SubTask synchronous_clear_operations_; |
| 100 BrowsingDataRemover::SubTask clear_autofill_origin_urls_; |
| 101 BrowsingDataRemover::SubTask clear_flash_content_licenses_; |
| 102 BrowsingDataRemover::SubTask clear_domain_reliability_monitor_; |
| 103 BrowsingDataRemover::SubTask clear_form_; |
| 104 BrowsingDataRemover::SubTask clear_history_; |
| 105 BrowsingDataRemover::SubTask clear_keyword_data_; |
| 106 #if !defined(DISABLE_NACL) |
| 107 BrowsingDataRemover::SubTask clear_nacl_cache_; |
| 108 BrowsingDataRemover::SubTask clear_pnacl_cache_; |
| 109 #endif |
| 110 BrowsingDataRemover::SubTask clear_hostname_resolution_cache_; |
| 111 BrowsingDataRemover::SubTask clear_network_predictor_; |
| 112 BrowsingDataRemover::SubTask clear_networking_history_; |
| 113 BrowsingDataRemover::SubTask clear_passwords_; |
| 114 BrowsingDataRemover::SubTask clear_passwords_stats_; |
| 115 BrowsingDataRemover::SubTask clear_platform_keys_; |
| 116 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 117 BrowsingDataRemover::SubTask clear_precache_history_; |
| 118 BrowsingDataRemover::SubTask clear_offline_page_data_; |
| 119 #endif |
| 120 |
| 121 #if BUILDFLAG(ENABLE_WEBRTC) |
| 122 BrowsingDataRemover::SubTask clear_webrtc_logs_; |
| 123 #endif |
| 124 BrowsingDataRemover::SubTask clear_auto_sign_in_; |
| 125 |
| 126 #if BUILDFLAG(ENABLE_PLUGINS) |
| 127 uint32_t deauthorize_flash_content_licenses_request_id_ = 0; |
| 128 |
| 129 // Used to deauthorize content licenses for Pepper Flash. |
| 130 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; |
| 131 #endif |
| 132 |
| 133 // Used if we need to clear history. |
| 134 base::CancelableTaskTracker history_task_tracker_; |
| 135 |
| 136 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; |
| 137 |
| 138 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 139 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is |
| 140 // not initialised, so the registry must be mocked out. |
| 141 std::unique_ptr<WebappRegistry> webapp_registry_; |
| 142 #endif |
| 143 |
| 144 base::WeakPtrFactory<ChromeBrowsingDataRemoverDelegate> weak_ptr_factory_; |
| 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(ChromeBrowsingDataRemoverDelegate); |
| 147 }; |
| 148 |
| 149 #endif // CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ |
OLD | NEW |