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

Side by Side Diff: components/password_manager/core/browser/affiliation_backend.h

Issue 1006813008: Introduce StrategyOnCacheMiss enum instead of |cached_only| boolean. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aff_integ_final
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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // I/O, the backend ends up doing most of the work for the AffiliationService; 43 // I/O, the backend ends up doing most of the work for the AffiliationService;
44 // the latter being just a thin layer that delegates most tasks to the backend. 44 // the latter being just a thin layer that delegates most tasks to the backend.
45 // 45 //
46 // This class is not thread-safe, but it is fine to construct it on one thread 46 // This class is not thread-safe, but it is fine to construct it on one thread
47 // and then transfer it to the background thread for the rest of its life. 47 // and then transfer it to the background thread for the rest of its life.
48 // Initialize() must be called already on the final (background) thread. 48 // Initialize() must be called already on the final (background) thread.
49 class AffiliationBackend : public FacetManagerHost, 49 class AffiliationBackend : public FacetManagerHost,
50 public AffiliationFetcherDelegate, 50 public AffiliationFetcherDelegate,
51 public AffiliationFetchThrottlerDelegate { 51 public AffiliationFetchThrottlerDelegate {
52 public: 52 public:
53 using StrategyOnCacheMiss = AffiliationService::StrategyOnCacheMiss;
54
53 // Constructs an instance that will use |request_context_getter| for all 55 // Constructs an instance that will use |request_context_getter| for all
54 // network requests, use |task_runner| for asynchronous tasks, and will rely 56 // network requests, use |task_runner| for asynchronous tasks, and will rely
55 // on |time_source| and |time_tick_source| to tell the current time/ticks. 57 // on |time_source| and |time_tick_source| to tell the current time/ticks.
56 // Construction is very cheap, expensive steps are deferred to Initialize(). 58 // Construction is very cheap, expensive steps are deferred to Initialize().
57 AffiliationBackend( 59 AffiliationBackend(
58 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, 60 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
59 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 61 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
60 scoped_ptr<base::Clock> time_source, 62 scoped_ptr<base::Clock> time_source,
61 scoped_ptr<base::TickClock> time_tick_source); 63 scoped_ptr<base::TickClock> time_tick_source);
62 ~AffiliationBackend() override; 64 ~AffiliationBackend() override;
63 65
64 // Performs the I/O-heavy part of initialization. The database used to cache 66 // Performs the I/O-heavy part of initialization. The database used to cache
65 // affiliation information locally will be opened/created at |db_path|. 67 // affiliation information locally will be opened/created at |db_path|.
66 void Initialize(const base::FilePath& db_path); 68 void Initialize(const base::FilePath& db_path);
67 69
68 // Implementations for methods of the same name in AffiliationService. They 70 // Implementations for methods of the same name in AffiliationService. They
69 // are not documented here again. See affiliation_service.h for details: 71 // are not documented here again. See affiliation_service.h for details:
70 void GetAffiliations( 72 void GetAffiliations(
71 const FacetURI& facet_uri, 73 const FacetURI& facet_uri,
72 bool cached_only, 74 StrategyOnCacheMiss cache_miss_strategy,
73 const AffiliationService::ResultCallback& callback, 75 const AffiliationService::ResultCallback& callback,
74 const scoped_refptr<base::TaskRunner>& callback_task_runner); 76 const scoped_refptr<base::TaskRunner>& callback_task_runner);
75 void Prefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until); 77 void Prefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until);
76 void CancelPrefetch(const FacetURI& facet_uri, 78 void CancelPrefetch(const FacetURI& facet_uri,
77 const base::Time& keep_fresh_until); 79 const base::Time& keep_fresh_until);
78 void TrimCache(); 80 void TrimCache();
79 81
80 private: 82 private:
81 friend class AffiliationBackendTest; 83 friend class AffiliationBackendTest;
82 84
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_; 132 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_;
131 133
132 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; 134 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_;
133 135
134 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); 136 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend);
135 }; 137 };
136 138
137 } // namespace password_manager 139 } // namespace password_manager
138 140
139 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ 141 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698