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

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

Issue 1852093002: components/password_manager: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and revert an accidental .proto change Created 4 years, 8 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 public: 55 public:
56 using StrategyOnCacheMiss = AffiliationService::StrategyOnCacheMiss; 56 using StrategyOnCacheMiss = AffiliationService::StrategyOnCacheMiss;
57 57
58 // Constructs an instance that will use |request_context_getter| for all 58 // Constructs an instance that will use |request_context_getter| for all
59 // network requests, use |task_runner| for asynchronous tasks, and will rely 59 // network requests, use |task_runner| for asynchronous tasks, and will rely
60 // on |time_source| and |time_tick_source| to tell the current time/ticks. 60 // on |time_source| and |time_tick_source| to tell the current time/ticks.
61 // Construction is very cheap, expensive steps are deferred to Initialize(). 61 // Construction is very cheap, expensive steps are deferred to Initialize().
62 AffiliationBackend( 62 AffiliationBackend(
63 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, 63 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 64 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
65 scoped_ptr<base::Clock> time_source, 65 std::unique_ptr<base::Clock> time_source,
66 scoped_ptr<base::TickClock> time_tick_source); 66 std::unique_ptr<base::TickClock> time_tick_source);
67 ~AffiliationBackend() override; 67 ~AffiliationBackend() override;
68 68
69 // Performs the I/O-heavy part of initialization. The database used to cache 69 // Performs the I/O-heavy part of initialization. The database used to cache
70 // affiliation information locally will be opened/created at |db_path|. 70 // affiliation information locally will be opened/created at |db_path|.
71 void Initialize(const base::FilePath& db_path); 71 void Initialize(const base::FilePath& db_path);
72 72
73 // Implementations for methods of the same name in AffiliationService. They 73 // Implementations for methods of the same name in AffiliationService. They
74 // are not documented here again. See affiliation_service.h for details: 74 // are not documented here again. See affiliation_service.h for details:
75 void GetAffiliations( 75 void GetAffiliations(
76 const FacetURI& facet_uri, 76 const FacetURI& facet_uri,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // FacetManagerHost: 109 // FacetManagerHost:
110 bool ReadAffiliationsFromDatabase( 110 bool ReadAffiliationsFromDatabase(
111 const FacetURI& facet_uri, 111 const FacetURI& facet_uri,
112 AffiliatedFacetsWithUpdateTime* affiliations) override; 112 AffiliatedFacetsWithUpdateTime* affiliations) override;
113 void SignalNeedNetworkRequest() override; 113 void SignalNeedNetworkRequest() override;
114 void RequestNotificationAtTime(const FacetURI& facet_uri, 114 void RequestNotificationAtTime(const FacetURI& facet_uri,
115 base::Time time) override; 115 base::Time time) override;
116 116
117 // AffiliationFetcherDelegate: 117 // AffiliationFetcherDelegate:
118 void OnFetchSucceeded( 118 void OnFetchSucceeded(
119 scoped_ptr<AffiliationFetcherDelegate::Result> result) override; 119 std::unique_ptr<AffiliationFetcherDelegate::Result> result) override;
120 void OnFetchFailed() override; 120 void OnFetchFailed() override;
121 void OnMalformedResponse() override; 121 void OnMalformedResponse() override;
122 122
123 // AffiliationFetchThrottlerDelegate: 123 // AffiliationFetchThrottlerDelegate:
124 bool OnCanSendNetworkRequest() override; 124 bool OnCanSendNetworkRequest() override;
125 125
126 // Returns the number of in-memory FacetManagers. Used only for testing. 126 // Returns the number of in-memory FacetManagers. Used only for testing.
127 size_t facet_manager_count_for_testing() { return facet_managers_.size(); } 127 size_t facet_manager_count_for_testing() { return facet_managers_.size(); }
128 128
129 // Reports the |requested_facet_uri_count| in a single fetch; and the elapsed 129 // Reports the |requested_facet_uri_count| in a single fetch; and the elapsed
130 // time before the first fetch, and in-between subsequent fetches. 130 // time before the first fetch, and in-between subsequent fetches.
131 void ReportStatistics(size_t requested_facet_uri_count); 131 void ReportStatistics(size_t requested_facet_uri_count);
132 132
133 // To be called after Initialize() to use |throttler| instead of the default 133 // To be called after Initialize() to use |throttler| instead of the default
134 // one. Used only for testing. 134 // one. Used only for testing.
135 void SetThrottlerForTesting(scoped_ptr<AffiliationFetchThrottler> throttler); 135 void SetThrottlerForTesting(
136 std::unique_ptr<AffiliationFetchThrottler> throttler);
136 137
137 // Created in Initialize(), and ensures that all subsequent methods are called 138 // Created in Initialize(), and ensures that all subsequent methods are called
138 // on the same thread. 139 // on the same thread.
139 scoped_ptr<base::ThreadChecker> thread_checker_; 140 std::unique_ptr<base::ThreadChecker> thread_checker_;
140 141
141 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 142 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
142 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 143 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
143 scoped_ptr<base::Clock> clock_; 144 std::unique_ptr<base::Clock> clock_;
144 scoped_ptr<base::TickClock> tick_clock_; 145 std::unique_ptr<base::TickClock> tick_clock_;
145 146
146 scoped_ptr<AffiliationDatabase> cache_; 147 std::unique_ptr<AffiliationDatabase> cache_;
147 scoped_ptr<AffiliationFetcher> fetcher_; 148 std::unique_ptr<AffiliationFetcher> fetcher_;
148 scoped_ptr<AffiliationFetchThrottler> throttler_; 149 std::unique_ptr<AffiliationFetchThrottler> throttler_;
149 150
150 base::Time construction_time_; 151 base::Time construction_time_;
151 base::Time last_request_time_; 152 base::Time last_request_time_;
152 153
153 // Contains a FacetManager for each facet URI that need ongoing attention. To 154 // Contains a FacetManager for each facet URI that need ongoing attention. To
154 // save memory, managers are discarded as soon as they become redundant. 155 // save memory, managers are discarded as soon as they become redundant.
155 base::ScopedPtrHashMap<FacetURI, scoped_ptr<FacetManager>> facet_managers_; 156 base::ScopedPtrHashMap<FacetURI, std::unique_ptr<FacetManager>>
157 facet_managers_;
156 158
157 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; 159 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_;
158 160
159 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); 161 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend);
160 }; 162 };
161 163
162 } // namespace password_manager 164 } // namespace password_manager
163 165
164 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ 166 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698