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

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

Issue 1776903002: Refactor BrowsingDataRemover to mock out WebappRegistry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use PostDelayedTask Created 4 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
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 namespace content { 45 namespace content {
46 class BrowserContext; 46 class BrowserContext;
47 class PluginDataRemover; 47 class PluginDataRemover;
48 class StoragePartition; 48 class StoragePartition;
49 } 49 }
50 50
51 namespace net { 51 namespace net {
52 class URLRequestContextGetter; 52 class URLRequestContextGetter;
53 } 53 }
54 54
55 #if BUILDFLAG(ANDROID_JAVA_UI)
56 class WebappRegistry;
57 #endif
58
55 // BrowsingDataRemover is responsible for removing data related to browsing: 59 // BrowsingDataRemover is responsible for removing data related to browsing:
56 // visits in url database, downloads, cookies ... 60 // visits in url database, downloads, cookies ...
57 class BrowsingDataRemover : public KeyedService 61 class BrowsingDataRemover : public KeyedService
58 #if defined(ENABLE_PLUGINS) 62 #if defined(ENABLE_PLUGINS)
59 , public PepperFlashSettingsManager::Client 63 , public PepperFlashSettingsManager::Client
60 #endif 64 #endif
61 { 65 {
62 public: 66 public:
63 // Time period ranges available when doing browsing data removals. 67 // Time period ranges available when doing browsing data removals.
64 // TODO(msramek): As this is now reused on Android, we should move it 68 // TODO(msramek): As this is now reused on Android, we should move it
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 int remove_mask, 250 int remove_mask,
247 int origin_type_mask); 251 int origin_type_mask);
248 252
249 void AddObserver(Observer* observer); 253 void AddObserver(Observer* observer);
250 void RemoveObserver(Observer* observer); 254 void RemoveObserver(Observer* observer);
251 255
252 // Used for testing. 256 // Used for testing.
253 void OverrideStoragePartitionForTesting( 257 void OverrideStoragePartitionForTesting(
254 content::StoragePartition* storage_partition); 258 content::StoragePartition* storage_partition);
255 259
260 #if BUILDFLAG(ANDROID_JAVA_UI)
261 void OverrideWebappRegistryForTesting(
262 scoped_ptr<WebappRegistry> webapp_registry);
263 #endif
264
256 private: 265 private:
257 // The clear API needs to be able to toggle removing_ in order to test that 266 // The clear API needs to be able to toggle removing_ in order to test that
258 // only one BrowsingDataRemover instance can be called at a time. 267 // only one BrowsingDataRemover instance can be called at a time.
259 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime); 268 FRIEND_TEST_ALL_PREFIXES(ExtensionBrowsingDataTest, OneAtATime);
260 269
261 // The BrowsingDataRemover tests need to be able to access the implementation 270 // The BrowsingDataRemover tests need to be able to access the implementation
262 // of Remove(), as it exposes details that aren't yet available in the public 271 // of Remove(), as it exposes details that aren't yet available in the public
263 // API. As soon as those details are exposed via new methods, this should be 272 // API. As soon as those details are exposed via new methods, this should be
264 // removed. 273 // removed.
265 // 274 //
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 base::ObserverList<Observer, true> observer_list_; 474 base::ObserverList<Observer, true> observer_list_;
466 475
467 // Used if we need to clear history. 476 // Used if we need to clear history.
468 base::CancelableTaskTracker history_task_tracker_; 477 base::CancelableTaskTracker history_task_tracker_;
469 478
470 scoped_ptr<TemplateURLService::Subscription> template_url_sub_; 479 scoped_ptr<TemplateURLService::Subscription> template_url_sub_;
471 480
472 // We do not own this. 481 // We do not own this.
473 content::StoragePartition* storage_partition_for_testing_ = nullptr; 482 content::StoragePartition* storage_partition_for_testing_ = nullptr;
474 483
484 #if BUILDFLAG(ANDROID_JAVA_UI)
485 // WebappRegistry makes calls across the JNI. In unit tests, the Java side is
486 // not initialised, so the registry must be mocked out.
487 scoped_ptr<WebappRegistry> webapp_registry_;
488 #endif
489
475 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_; 490 base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_;
476 491
477 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover); 492 DISALLOW_COPY_AND_ASSIGN(BrowsingDataRemover);
478 }; 493 };
479 494
480 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_ 495 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/webapps/webapp_registry.cc ('k') | chrome/browser/browsing_data/browsing_data_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698