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

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

Issue 1033013003: Refactor http cache removing from a StoragePartition into separate class: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 #include "base/prefs/pref_member.h" 13 #include "base/prefs/pref_member.h"
14 #include "base/sequenced_task_runner_helpers.h" 14 #include "base/sequenced_task_runner_helpers.h"
15 #include "base/synchronization/waitable_event_watcher.h" 15 #include "base/synchronization/waitable_event_watcher.h"
16 #include "base/task/cancelable_task_tracker.h" 16 #include "base/task/cancelable_task_tracker.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "chrome/browser/pepper_flash_settings_manager.h" 18 #include "chrome/browser/pepper_flash_settings_manager.h"
19 #include "components/search_engines/template_url_service.h" 19 #include "components/search_engines/template_url_service.h"
20 #if defined(OS_CHROMEOS) 20 #if defined(OS_CHROMEOS)
21 #include "chromeos/dbus/dbus_method_call_status.h" 21 #include "chromeos/dbus/dbus_method_call_status.h"
22 #endif 22 #endif
23 #include "storage/common/quota/quota_types.h" 23 #include "storage/common/quota/quota_types.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 class ExtensionSpecialStoragePolicy;
27 class IOThread; 26 class IOThread;
28 class Profile; 27 class Profile;
29 28
30 namespace chrome_browser_net { 29 namespace chrome_browser_net {
31 class Predictor; 30 class Predictor;
32 } 31 }
33 32
34 namespace content { 33 namespace content {
35 class PluginDataRemover; 34 class PluginDataRemover;
36 class StoragePartition; 35 class StoragePartition;
37 } 36 }
38 37
39 namespace disk_cache {
40 class Backend;
41 }
42
43 namespace net { 38 namespace net {
44 class URLRequestContextGetter; 39 class URLRequestContextGetter;
45 } 40 }
46 41
47 namespace storage {
48 class QuotaManager;
49 }
50
51 namespace content {
52 class DOMStorageContext;
53 struct LocalStorageUsageInfo;
54 struct SessionStorageUsageInfo;
55 }
56
57 // BrowsingDataRemover is responsible for removing data related to browsing: 42 // BrowsingDataRemover is responsible for removing data related to browsing:
58 // visits in url database, downloads, cookies ... 43 // visits in url database, downloads, cookies ...
59 44
60 class BrowsingDataRemover 45 class BrowsingDataRemover
61 #if defined(ENABLE_PLUGINS) 46 #if defined(ENABLE_PLUGINS)
62 : public PepperFlashSettingsManager::Client 47 : public PepperFlashSettingsManager::Client
63 #endif 48 #endif
64 { 49 {
65 public: 50 public:
66 // Time period ranges available when doing browsing data removals. 51 // Time period ranges available when doing browsing data removals.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); 215 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime);
231 216
232 // The BrowsingDataRemover tests need to be able to access the implementation 217 // The BrowsingDataRemover tests need to be able to access the implementation
233 // of Remove(), as it exposes details that aren't yet available in the public 218 // of Remove(), as it exposes details that aren't yet available in the public
234 // API. As soon as those details are exposed via new methods, this should be 219 // API. As soon as those details are exposed via new methods, this should be
235 // removed. 220 // removed.
236 // 221 //
237 // TODO(mkwst): See http://crbug.com/113621 222 // TODO(mkwst): See http://crbug.com/113621
238 friend class BrowsingDataRemoverTest; 223 friend class BrowsingDataRemoverTest;
239 224
240 enum CacheState {
241 STATE_NONE,
242 STATE_CREATE_MAIN,
243 STATE_CREATE_MEDIA,
244 STATE_DELETE_MAIN,
245 STATE_DELETE_MEDIA,
246 STATE_DONE
247 };
248
249 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're 225 // Setter for |is_removing_|; DCHECKs that we can only start removing if we're
250 // not already removing, and vice-versa. 226 // not already removing, and vice-versa.
251 static void set_removing(bool is_removing); 227 static void set_removing(bool is_removing);
252 228
253 // Creates a BrowsingDataRemover to remove browser data from the specified 229 // Creates a BrowsingDataRemover to remove browser data from the specified
254 // profile in the specified time range. Use Remove to initiate the removal. 230 // profile in the specified time range. Use Remove to initiate the removal.
255 BrowsingDataRemover(Profile* profile, 231 BrowsingDataRemover(Profile* profile,
256 base::Time delete_begin, 232 base::Time delete_begin,
257 base::Time delete_end); 233 base::Time delete_end);
258 234
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 void ClearNetworkPredictorOnIOThread( 301 void ClearNetworkPredictorOnIOThread(
326 chrome_browser_net::Predictor* predictor); 302 chrome_browser_net::Predictor* predictor);
327 303
328 // Callback for when network related data in ProfileIOData has been cleared. 304 // Callback for when network related data in ProfileIOData has been cleared.
329 // Clears the respective waiting flag and invokes NotifyAndDeleteIfDone. 305 // Clears the respective waiting flag and invokes NotifyAndDeleteIfDone.
330 void OnClearedNetworkingHistory(); 306 void OnClearedNetworkingHistory();
331 307
332 // Callback for when the cache has been deleted. Invokes 308 // Callback for when the cache has been deleted. Invokes
333 // NotifyAndDeleteIfDone. 309 // NotifyAndDeleteIfDone.
334 void ClearedCache(); 310 void ClearedCache();
335
336 // Invoked on the IO thread to delete from the cache.
337 void ClearCacheOnIOThread();
338
339 // Performs the actual work to delete the cache.
340 void DoClearCache(int rv);
341
342 #if !defined(DISABLE_NACL) 311 #if !defined(DISABLE_NACL)
343 // Callback for when the NaCl cache has been deleted. Invokes 312 // Callback for when the NaCl cache has been deleted. Invokes
344 // NotifyAndDeleteIfDone. 313 // NotifyAndDeleteIfDone.
345 void ClearedNaClCache(); 314 void ClearedNaClCache();
346 315
347 // Invokes the ClearedNaClCache on the UI thread. 316 // Invokes the ClearedNaClCache on the UI thread.
348 void ClearedNaClCacheOnIOThread(); 317 void ClearedNaClCacheOnIOThread();
349 318
350 // Invoked on the IO thread to delete the NaCl cache. 319 // Invoked on the IO thread to delete the NaCl cache.
351 void ClearNaClCacheOnIOThread(); 320 void ClearNaClCacheOnIOThread();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 base::Time delete_end_; 379 base::Time delete_end_;
411 380
412 // True if Remove has been invoked. 381 // True if Remove has been invoked.
413 static bool is_removing_; 382 static bool is_removing_;
414 383
415 // If non-NULL, the |completion_inhibitor_| is notified each time an instance 384 // If non-NULL, the |completion_inhibitor_| is notified each time an instance
416 // is about to complete a browsing data removal process, and has the ability 385 // is about to complete a browsing data removal process, and has the ability
417 // to artificially delay completion. Used for testing. 386 // to artificially delay completion. Used for testing.
418 static CompletionInhibitor* completion_inhibitor_; 387 static CompletionInhibitor* completion_inhibitor_;
419 388
420 CacheState next_cache_state_;
421 disk_cache::Backend* cache_;
422
423 // Used to delete data from HTTP cache. 389 // Used to delete data from HTTP cache.
424 scoped_refptr<net::URLRequestContextGetter> main_context_getter_; 390 scoped_refptr<net::URLRequestContextGetter> main_context_getter_;
425 scoped_refptr<net::URLRequestContextGetter> media_context_getter_; 391 scoped_refptr<net::URLRequestContextGetter> media_context_getter_;
426 392
427 #if defined(ENABLE_PLUGINS) 393 #if defined(ENABLE_PLUGINS)
428 // Used to delete plugin data. 394 // Used to delete plugin data.
429 scoped_ptr<content::PluginDataRemover> plugin_data_remover_; 395 scoped_ptr<content::PluginDataRemover> plugin_data_remover_;
430 base::WaitableEventWatcher watcher_; 396 base::WaitableEventWatcher watcher_;
431 397
432 // Used to deauthorize content licenses for Pepper Flash. 398 // Used to deauthorize content licenses for Pepper Flash.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 441
476 scoped_ptr<TemplateURLService::Subscription> template_url_sub_; 442 scoped_ptr<TemplateURLService::Subscription> template_url_sub_;
477 443
478 // We do not own this. 444 // We do not own this.
479 content::StoragePartition* storage_partition_for_testing_; 445 content::StoragePartition* storage_partition_for_testing_;
480 446
481 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); 447 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
482 }; 448 };
483 449
484 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 450 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browsing_data/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698