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

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

Issue 2554413002: Extract embedder-specific data types from BrowsingDataRemover (Closed)
Patch Set: Android fix Created 4 years 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
(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 // Called when history deletion is done.
73 void OnHistoryDeletionDone();
74
75 // Callback for when the hostname resolution cache has been cleared.
76 // Clears the respective waiting flag and invokes NotifyIfDone.
77 void OnClearedHostnameResolutionCache();
78
79 // Callback for when speculative data in the network Predictor has been
80 // cleared. Clears the respective waiting flag and invokes
81 // NotifyIfDone.
82 void OnClearedNetworkPredictor();
83
84 // Callback for when network related data in ProfileIOData has been cleared.
85 // Clears the respective waiting flag and invokes NotifyIfDone.
86 void OnClearedNetworkingHistory();
87
88 #if !defined(DISABLE_NACL)
89 // Callback for when the NaCl cache has been deleted. Invokes
90 // NotifyIfDone.
91 void ClearedNaClCache();
92
93 // Callback for when the PNaCl translation cache has been deleted. Invokes
94 // NotifyIfDone.
95 void ClearedPnaclCache();
96 #endif
97
98 // Callback for when cookies have been deleted. Invokes NotifyIfDone.
99 void OnClearedCookies();
100
101 // Callback for when passwords for the requested time range have been cleared.
102 void OnClearedPasswords();
103
104 // Callback for when passwords stats for the requested time range have been
105 // cleared.
106 void OnClearedPasswordsStats();
107
108 // Callback for when the autosignin state of passwords has been revoked.
109 void OnClearedAutoSignIn();
110
111 // Callback from the above method.
112 void OnClearedFormData();
113
114 // Callback for when the Autofill profile and credit card origin URLs have
115 // been deleted.
116 void OnClearedAutofillOriginURLs();
117
118 #if BUILDFLAG(ENABLE_WEBRTC)
119 // Callback on UI thread when the WebRTC logs have been deleted.
120 void OnClearedWebRtcLogs();
121 #endif
122
123 #if BUILDFLAG(ANDROID_JAVA_UI)
124 // Callback on UI thread when the precache history has been cleared.
125 void OnClearedPrecacheHistory();
126
127 // Callback on UI thread when the offline page data has been cleared.
128 void OnClearedOfflinePageData(
129 offline_pages::OfflinePageModel::DeletePageResult result);
130 #endif
131
132 #if BUILDFLAG(ENABLE_PLUGINS)
133 // PepperFlashSettingsManager::Client implementation.
134 void OnDeauthorizeFlashContentLicensesCompleted(uint32_t request_id,
135 bool success) override;
136 #endif
137
138 void OnClearedDomainReliabilityMonitor();
139
140 // The profile for which the data will be deleted.
141 Profile* profile_;
142
143 // Start time to delete from.
144 base::Time delete_begin_;
145
146 // End time to delete to.
147 base::Time delete_end_;
148
149 // Completion callback to call when all data are deleted.
150 base::Closure callback_;
151
152 bool waiting_for_synchronous_clear_operations_ = false;
Bernhard Bauer 2016/12/12 14:52:06 If we're rewriting this class anyway... I feel a
msramek 2016/12/12 20:48:56 Done. I created a "SubTask" class, the "sub" part
Bernhard Bauer 2016/12/13 13:26:22 OK. We could cut down the constructor (and NotifyI
153 bool waiting_for_clear_autofill_origin_urls_ = false;
154 bool waiting_for_clear_flash_content_licenses_ = false;
155 // Non-zero if waiting for cookies to be cleared.
156 int waiting_for_clear_cookies_count_ = 0;
157 bool waiting_for_clear_domain_reliability_monitor_ = false;
158 bool waiting_for_clear_form_ = false;
159 bool waiting_for_clear_history_ = false;
160 bool waiting_for_clear_keyword_data_ = false;
161 bool waiting_for_clear_nacl_cache_ = false;
162 bool waiting_for_clear_hostname_resolution_cache_ = false;
163 bool waiting_for_clear_network_predictor_ = false;
164 bool waiting_for_clear_networking_history_ = false;
165 bool waiting_for_clear_passwords_ = false;
166 bool waiting_for_clear_passwords_stats_ = false;
167 bool waiting_for_clear_platform_keys_ = false;
168 bool waiting_for_clear_pnacl_cache_ = false;
169 #if BUILDFLAG(ANDROID_JAVA_UI)
170 bool waiting_for_clear_precache_history_ = false;
171 bool waiting_for_clear_offline_page_data_ = false;
172 #endif
173
174 #if BUILDFLAG(ENABLE_WEBRTC)
175 bool waiting_for_clear_webrtc_logs_ = false;
176 #endif
177 bool waiting_for_clear_auto_sign_in_ = false;
178
179 #if BUILDFLAG(ENABLE_PLUGINS)
180 uint32_t deauthorize_flash_content_licenses_request_id_ = 0;
181
182 // Used to deauthorize content licenses for Pepper Flash.
183 std::unique_ptr<PepperFlashSettingsManager> pepper_flash_settings_manager_;
184 #endif
185
186 // Used if we need to clear history.
187 base::CancelableTaskTracker history_task_tracker_;
188
189 std::unique_ptr<TemplateURLService::Subscription> template_url_sub_;
190
191 #if BUILDFLAG(ANDROID_JAVA_UI)
192 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is
193 // not initialised, so the registry must be mocked out.
194 std::unique_ptr<WebappRegistry> webapp_registry_;
195 #endif
196
197 base::WeakPtrFactory<ChromeBrowsingDataRemoverDelegate> weak_ptr_factory_;
198
199 DISALLOW_COPY_AND_ASSIGN(ChromeBrowsingDataRemoverDelegate);
200 };
201
202 #endif // CHROME_BROWSER_BROWSING_DATA_CHROME_BROWSING_DATA_REMOVER_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698