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

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

Issue 2637043002: Move plugins to ChromeBrowsingDataRemoverDelegate. (Closed)
Patch Set: Rebase. 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 (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_IMPL_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_IMPL_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_IMPL_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 #include <set> 11 #include <set>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/synchronization/waitable_event_watcher.h" 17 #include "base/synchronization/waitable_event_watcher.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "chrome/browser/browsing_data/browsing_data_remover.h" 20 #include "chrome/browser/browsing_data/browsing_data_remover.h"
21 #include "chrome/common/features.h" 21 #include "chrome/common/features.h"
22 #include "components/keyed_service/core/keyed_service.h" 22 #include "components/keyed_service/core/keyed_service.h"
23 #include "ppapi/features/features.h" 23 #include "ppapi/features/features.h"
24 #include "storage/common/quota/quota_types.h" 24 #include "storage/common/quota/quota_types.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 class BrowsingDataFilterBuilder; 27 class BrowsingDataFilterBuilder;
28 class BrowsingDataFlashLSOHelper;
29 class BrowsingDataRemoverFactory; 28 class BrowsingDataRemoverFactory;
30 29
31 namespace content { 30 namespace content {
32 class BrowserContext; 31 class BrowserContext;
33 class PluginDataRemover;
34 class StoragePartition; 32 class StoragePartition;
35 } 33 }
36 34
37 class BrowsingDataRemoverImpl : 35 class BrowsingDataRemoverImpl :
38 public BrowsingDataRemover, 36 public BrowsingDataRemover,
39 public KeyedService { 37 public KeyedService {
40 public: 38 public:
41 // The completion inhibitor can artificially delay completion of the browsing 39 // The completion inhibitor can artificially delay completion of the browsing
42 // data removal process. It is used during testing to simulate scenarios in 40 // data removal process. It is used during testing to simulate scenarios in
43 // which the deletion stalls or takes a very long time. 41 // which the deletion stalls or takes a very long time.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 123
126 const base::Time& GetLastUsedBeginTime() override; 124 const base::Time& GetLastUsedBeginTime() override;
127 const base::Time& GetLastUsedEndTime() override; 125 const base::Time& GetLastUsedEndTime() override;
128 int GetLastUsedRemovalMask() override; 126 int GetLastUsedRemovalMask() override;
129 int GetLastUsedOriginTypeMask() override; 127 int GetLastUsedOriginTypeMask() override;
130 128
131 // Used for testing. 129 // Used for testing.
132 void OverrideStoragePartitionForTesting( 130 void OverrideStoragePartitionForTesting(
133 content::StoragePartition* storage_partition); 131 content::StoragePartition* storage_partition);
134 132
135 #if BUILDFLAG(ENABLE_PLUGINS)
136 void OverrideFlashLSOHelperForTesting(
137 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper);
138 #endif
139
140 protected: 133 protected:
141 // Use BrowsingDataRemoverFactory::GetForBrowserContext to get an instance of 134 // Use BrowsingDataRemoverFactory::GetForBrowserContext to get an instance of
142 // this class. The constructor is protected so that the class is mockable. 135 // this class. The constructor is protected so that the class is mockable.
143 explicit BrowsingDataRemoverImpl(content::BrowserContext* browser_context); 136 explicit BrowsingDataRemoverImpl(content::BrowserContext* browser_context);
144 ~BrowsingDataRemoverImpl() override; 137 ~BrowsingDataRemoverImpl() override;
145 138
146 // A common reduction of all public Remove[WithFilter][AndReply] methods. 139 // A common reduction of all public Remove[WithFilter][AndReply] methods.
147 virtual void RemoveInternal( 140 virtual void RemoveInternal(
148 const base::Time& delete_begin, 141 const base::Time& delete_begin,
149 const base::Time& delete_end, 142 const base::Time& delete_end,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder; 177 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder;
185 Observer* observer; 178 Observer* observer;
186 }; 179 };
187 180
188 void Shutdown() override; 181 void Shutdown() override;
189 182
190 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're 183 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're
191 // not already removing, and vice-versa. 184 // not already removing, and vice-versa.
192 void SetRemoving(bool is_removing); 185 void SetRemoving(bool is_removing);
193 186
194 #if BUILDFLAG(ENABLE_PLUGINS)
195 // Called when plugin data has been cleared. Invokes NotifyIfDone.
196 void OnWaitableEventSignaled(base::WaitableEvent* waitable_event);
197
198 // Called when the list of |sites| storing Flash LSO cookies is fetched.
199 void OnSitesWithFlashDataFetched(
200 base::Callback<bool(const std::string&)> plugin_filter,
201 const std::vector<std::string>& sites);
202
203 // Indicates that LSO cookies for one website have been deleted.
204 void OnFlashDataDeleted();
205 #endif
206
207 // Executes the next removal task. Called after the previous task was finished 187 // Executes the next removal task. Called after the previous task was finished
208 // or directly from Remove() if the task queue was empty. 188 // or directly from Remove() if the task queue was empty.
209 void RunNextTask(); 189 void RunNextTask();
210 190
211 // Removes the specified items related to browsing for a specific host. If the 191 // Removes the specified items related to browsing for a specific host. If the
212 // provided |remove_url| is empty, data is removed for all origins; otherwise, 192 // provided |remove_url| is empty, data is removed for all origins; otherwise,
213 // it is restricted by the origin filter origin (where implemented yet). The 193 // it is restricted by the origin filter origin (where implemented yet). The
214 // |origin_type_mask| parameter defines the set of origins from which data 194 // |origin_type_mask| parameter defines the set of origins from which data
215 // should be removed (protected, unprotected, or both). 195 // should be removed (protected, unprotected, or both).
216 // TODO(ttr314): Remove "(where implemented yet)" constraint above once 196 // TODO(ttr314): Remove "(where implemented yet)" constraint above once
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 bool is_removing_; 233 bool is_removing_;
254 234
255 // Removal tasks to be processed. 235 // Removal tasks to be processed.
256 std::queue<RemovalTask> task_queue_; 236 std::queue<RemovalTask> task_queue_;
257 237
258 // If non-NULL, the |completion_inhibitor_| is notified each time an instance 238 // If non-NULL, the |completion_inhibitor_| is notified each time an instance
259 // is about to complete a browsing data removal process, and has the ability 239 // is about to complete a browsing data removal process, and has the ability
260 // to artificially delay completion. Used for testing. 240 // to artificially delay completion. Used for testing.
261 static CompletionInhibitor* completion_inhibitor_; 241 static CompletionInhibitor* completion_inhibitor_;
262 242
263 #if BUILDFLAG(ENABLE_PLUGINS)
264 // Used to delete plugin data.
265 std::unique_ptr<content::PluginDataRemover> plugin_data_remover_;
266 base::WaitableEventWatcher watcher_;
267
268 // Used for per-site plugin data deletion.
269 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_;
270 #endif
271
272 // A callback to NotifyIfDone() used by SubTasks instances. 243 // A callback to NotifyIfDone() used by SubTasks instances.
273 const base::Closure sub_task_forward_callback_; 244 const base::Closure sub_task_forward_callback_;
274 245
275 // Keeping track of various subtasks to be completed. 246 // Keeping track of various subtasks to be completed.
276 // These may only be accessed from UI thread in order to avoid races! 247 // These may only be accessed from UI thread in order to avoid races!
277 SubTask synchronous_clear_operations_; 248 SubTask synchronous_clear_operations_;
278 SubTask clear_embedder_data_; 249 SubTask clear_embedder_data_;
279 SubTask clear_cache_; 250 SubTask clear_cache_;
280 SubTask clear_channel_ids_; 251 SubTask clear_channel_ids_;
281 SubTask clear_http_auth_cache_; 252 SubTask clear_http_auth_cache_;
282 SubTask clear_storage_partition_data_; 253 SubTask clear_storage_partition_data_;
283 // Counts the number of plugin data tasks. Should be the number of LSO cookies
284 // to be deleted, or 1 while we're fetching LSO cookies or deleting in bulk.
285 int clear_plugin_data_count_ = 0;
286 254
287 // Observers of the global state and individual tasks. 255 // Observers of the global state and individual tasks.
288 base::ObserverList<Observer, true> observer_list_; 256 base::ObserverList<Observer, true> observer_list_;
289 257
290 // We do not own this. 258 // We do not own this.
291 content::StoragePartition* storage_partition_for_testing_ = nullptr; 259 content::StoragePartition* storage_partition_for_testing_ = nullptr;
292 260
293 base::WeakPtrFactory<BrowsingDataRemoverImpl> weak_ptr_factory_; 261 base::WeakPtrFactory<BrowsingDataRemoverImpl> weak_ptr_factory_;
294 262
295 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverImpl); 263 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemoverImpl);
296 }; 264 };
297 265
298 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_IMPL_H_ 266 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/browsing_data_remover.h ('k') | chrome/browser/browsing_data/browsing_data_remover_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698