Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h

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

Powered by Google App Engine
This is Rietveld 408576698