| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 12 #include "base/synchronization/waitable_event_watcher.h" | 13 #include "base/synchronization/waitable_event_watcher.h" |
| 13 #include "base/task/cancelable_task_tracker.h" | 14 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 15 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover_delegate.h" |
| 16 #include "chrome/common/features.h" | 17 #include "chrome/common/features.h" |
| 17 #include "components/browsing_data/core/browsing_data_utils.h" | 18 #include "components/browsing_data/core/browsing_data_utils.h" |
| 18 #include "components/offline_pages/core/offline_page_model.h" | 19 #include "components/offline_pages/core/offline_page_model.h" |
| 19 #include "components/search_engines/template_url_service.h" | 20 #include "components/search_engines/template_url_service.h" |
| 20 #include "media/media_features.h" | 21 #include "media/media_features.h" |
| 21 #include "ppapi/features/features.h" | 22 #include "ppapi/features/features.h" |
| 22 | 23 |
| 23 #if BUILDFLAG(ENABLE_PLUGINS) | 24 #if BUILDFLAG(ENABLE_PLUGINS) |
| 24 #include "chrome/browser/pepper_flash_settings_manager.h" | 25 #include "chrome/browser/pepper_flash_settings_manager.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| 27 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 28 #include "chromeos/dbus/dbus_method_call_status.h" | 29 #include "chromeos/dbus/dbus_method_call_status.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 class Profile; | 32 class Profile; |
| 32 class WebappRegistry; | 33 class WebappRegistry; |
| 33 | 34 |
| 35 namespace content { |
| 36 class BrowserContext; |
| 37 } |
| 38 |
| 34 // A delegate used by BrowsingDataRemover to delete data specific to Chrome | 39 // A delegate used by BrowsingDataRemover to delete data specific to Chrome |
| 35 // as the embedder. | 40 // as the embedder. |
| 36 class ChromeBrowsingDataRemoverDelegate : public BrowsingDataRemoverDelegate | 41 class ChromeBrowsingDataRemoverDelegate : public BrowsingDataRemoverDelegate |
| 37 #if BUILDFLAG(ENABLE_PLUGINS) | 42 #if BUILDFLAG(ENABLE_PLUGINS) |
| 38 , public PepperFlashSettingsManager::Client | 43 , public PepperFlashSettingsManager::Client |
| 39 #endif | 44 #endif |
| 40 { | 45 { |
| 41 public: | 46 public: |
| 47 // Used to track the deletion of a single data storage backend. |
| 48 class SubTask { |
| 49 public: |
| 50 // Creates a SubTask that calls |forward_callback| when completed. |
| 51 // |forward_callback| is only kept as a reference and must outlive SubTask. |
| 52 explicit SubTask(const base::Closure& forward_callback); |
| 53 ~SubTask(); |
| 54 |
| 55 // Indicate that the task is in progress and we're waiting. |
| 56 void Start(); |
| 57 |
| 58 // Returns a callback that should be called to indicate that the task |
| 59 // has been finished. |
| 60 base::Closure GetCompletionCallback(); |
| 61 |
| 62 // Whether the task is still in progress. |
| 63 bool is_pending() const { return is_pending_; } |
| 64 |
| 65 private: |
| 66 void CompletionCallback(); |
| 67 |
| 68 bool is_pending_; |
| 69 const base::Closure& forward_callback_; |
| 70 base::WeakPtrFactory<SubTask> weak_ptr_factory_; |
| 71 }; |
| 72 |
| 42 ChromeBrowsingDataRemoverDelegate(content::BrowserContext* browser_context); | 73 ChromeBrowsingDataRemoverDelegate(content::BrowserContext* browser_context); |
| 43 ~ChromeBrowsingDataRemoverDelegate() override; | 74 ~ChromeBrowsingDataRemoverDelegate() override; |
| 44 | 75 |
| 45 // Removes Chrome-specific data. | 76 // Removes Chrome-specific data. |
| 46 void RemoveEmbedderData( | 77 void RemoveEmbedderData( |
| 47 const base::Time& delete_begin, | 78 const base::Time& delete_begin, |
| 48 const base::Time& delete_end, | 79 const base::Time& delete_end, |
| 49 int remove_mask, | 80 int remove_mask, |
| 50 const BrowsingDataFilterBuilder& filter_builder, | 81 const BrowsingDataFilterBuilder& filter_builder, |
| 51 int origin_type_mask, | 82 int origin_type_mask, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 123 |
| 93 // Completion callback to call when all data are deleted. | 124 // Completion callback to call when all data are deleted. |
| 94 base::Closure callback_; | 125 base::Closure callback_; |
| 95 | 126 |
| 96 // A callback to NotifyIfDone() used by SubTasks instances. | 127 // A callback to NotifyIfDone() used by SubTasks instances. |
| 97 const base::Closure sub_task_forward_callback_; | 128 const base::Closure sub_task_forward_callback_; |
| 98 | 129 |
| 99 // Keeping track of various subtasks to be completed. | 130 // Keeping track of various subtasks to be completed. |
| 100 // Non-zero if waiting for SafeBrowsing cookies to be cleared. | 131 // Non-zero if waiting for SafeBrowsing cookies to be cleared. |
| 101 int clear_cookies_count_ = 0; | 132 int clear_cookies_count_ = 0; |
| 102 BrowsingDataRemover::SubTask synchronous_clear_operations_; | 133 SubTask synchronous_clear_operations_; |
| 103 BrowsingDataRemover::SubTask clear_autofill_origin_urls_; | 134 SubTask clear_autofill_origin_urls_; |
| 104 BrowsingDataRemover::SubTask clear_flash_content_licenses_; | 135 SubTask clear_flash_content_licenses_; |
| 105 BrowsingDataRemover::SubTask clear_domain_reliability_monitor_; | 136 SubTask clear_domain_reliability_monitor_; |
| 106 BrowsingDataRemover::SubTask clear_form_; | 137 SubTask clear_form_; |
| 107 BrowsingDataRemover::SubTask clear_history_; | 138 SubTask clear_history_; |
| 108 BrowsingDataRemover::SubTask clear_keyword_data_; | 139 SubTask clear_keyword_data_; |
| 109 #if !defined(DISABLE_NACL) | 140 #if !defined(DISABLE_NACL) |
| 110 BrowsingDataRemover::SubTask clear_nacl_cache_; | 141 SubTask clear_nacl_cache_; |
| 111 BrowsingDataRemover::SubTask clear_pnacl_cache_; | 142 SubTask clear_pnacl_cache_; |
| 112 #endif | 143 #endif |
| 113 BrowsingDataRemover::SubTask clear_hostname_resolution_cache_; | 144 SubTask clear_hostname_resolution_cache_; |
| 114 BrowsingDataRemover::SubTask clear_network_predictor_; | 145 SubTask clear_network_predictor_; |
| 115 BrowsingDataRemover::SubTask clear_networking_history_; | 146 SubTask clear_networking_history_; |
| 116 BrowsingDataRemover::SubTask clear_passwords_; | 147 SubTask clear_passwords_; |
| 117 BrowsingDataRemover::SubTask clear_passwords_stats_; | 148 SubTask clear_passwords_stats_; |
| 118 BrowsingDataRemover::SubTask clear_platform_keys_; | 149 SubTask clear_platform_keys_; |
| 119 #if BUILDFLAG(ANDROID_JAVA_UI) | 150 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 120 BrowsingDataRemover::SubTask clear_precache_history_; | 151 SubTask clear_precache_history_; |
| 121 BrowsingDataRemover::SubTask clear_offline_page_data_; | 152 SubTask clear_offline_page_data_; |
| 122 #endif | 153 #endif |
| 123 | 154 |
| 124 #if BUILDFLAG(ENABLE_WEBRTC) | 155 #if BUILDFLAG(ENABLE_WEBRTC) |
| 125 BrowsingDataRemover::SubTask clear_webrtc_logs_; | 156 SubTask clear_webrtc_logs_; |
| 126 #endif | 157 #endif |
| 127 BrowsingDataRemover::SubTask clear_auto_sign_in_; | 158 SubTask clear_auto_sign_in_; |
| 128 | 159 |
| 129 #if BUILDFLAG(ENABLE_PLUGINS) | 160 #if BUILDFLAG(ENABLE_PLUGINS) |
| 130 uint32_t deauthorize_flash_content_licenses_request_id_ = 0; | 161 uint32_t deauthorize_flash_content_licenses_request_id_ = 0; |
| 131 | 162 |
| 132 // Used to deauthorize content licenses for Pepper Flash. | 163 // Used to deauthorize content licenses for Pepper Flash. |
| 133 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; | 164 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_; |
| 134 #endif | 165 #endif |
| 135 | 166 |
| 136 // Used if we need to clear history. | 167 // Used if we need to clear history. |
| 137 base::CancelableTaskTracker history_task_tracker_; | 168 base::CancelableTaskTracker history_task_tracker_; |
| 138 | 169 |
| 139 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; | 170 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_; |
| 140 | 171 |
| 141 #if BUILDFLAG(ANDROID_JAVA_UI) | 172 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 142 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is | 173 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is |
| 143 // not initialised, so the registry must be mocked out. | 174 // not initialised, so the registry must be mocked out. |
| 144 std::unique_ptr<WebappRegistry> webapp_registry_; | 175 std::unique_ptr<WebappRegistry> webapp_registry_; |
| 145 #endif | 176 #endif |
| 146 | 177 |
| 147 base::WeakPtrFactory<ChromeBrowsingDataRemoverDelegate> weak_ptr_factory_; | 178 base::WeakPtrFactory<ChromeBrowsingDataRemoverDelegate> weak_ptr_factory_; |
| 148 | 179 |
| 149 DISALLOW_COPY_AND_ASSIGN(ChromeBrowsingDataRemoverDelegate); | 180 DISALLOW_COPY_AND_ASSIGN(ChromeBrowsingDataRemoverDelegate); |
| 150 }; | 181 }; |
| 151 | 182 |
| 152 #endif // CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ | 183 #endif // CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_ |
| OLD | NEW |