OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 scoped_ptr<AffiliationFetcherDelegate::Result> result) override; | 103 scoped_ptr<AffiliationFetcherDelegate::Result> result) override; |
104 void OnFetchFailed() override; | 104 void OnFetchFailed() override; |
105 void OnMalformedResponse() override; | 105 void OnMalformedResponse() override; |
106 | 106 |
107 // AffiliationFetchThrottlerDelegate: | 107 // AffiliationFetchThrottlerDelegate: |
108 bool OnCanSendNetworkRequest() override; | 108 bool OnCanSendNetworkRequest() override; |
109 | 109 |
110 // Returns the number of in-memory FacetManagers. Used only for testing. | 110 // Returns the number of in-memory FacetManagers. Used only for testing. |
111 size_t facet_manager_count_for_testing() { return facet_managers_.size(); } | 111 size_t facet_manager_count_for_testing() { return facet_managers_.size(); } |
112 | 112 |
113 // Reports the |requested_facet_uri_count| in a single fetch; and the elapsed | |
114 // time before the first fetch, and in-between subsequent fetches. | |
115 void ReportStatistics(size_t requested_facet_uri_count); | |
116 | |
117 // To be called after Initialize() to use |throttler| instead of the default | 113 // To be called after Initialize() to use |throttler| instead of the default |
118 // one. Used only for testing. | 114 // one. Used only for testing. |
119 void SetThrottlerForTesting(scoped_ptr<AffiliationFetchThrottler> throttler); | 115 void SetThrottlerForTesting(scoped_ptr<AffiliationFetchThrottler> throttler); |
120 | 116 |
121 // Created in Initialize(), and ensures that all subsequent methods are called | 117 // Created in Initialize(), and ensures that all subsequent methods are called |
122 // on the same thread. | 118 // on the same thread. |
123 scoped_ptr<base::ThreadChecker> thread_checker_; | 119 scoped_ptr<base::ThreadChecker> thread_checker_; |
124 | 120 |
125 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 121 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
126 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 122 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
127 scoped_ptr<base::Clock> clock_; | 123 scoped_ptr<base::Clock> clock_; |
128 scoped_ptr<base::TickClock> tick_clock_; | 124 scoped_ptr<base::TickClock> tick_clock_; |
129 | 125 |
130 scoped_ptr<AffiliationDatabase> cache_; | 126 scoped_ptr<AffiliationDatabase> cache_; |
131 scoped_ptr<AffiliationFetcher> fetcher_; | 127 scoped_ptr<AffiliationFetcher> fetcher_; |
132 scoped_ptr<AffiliationFetchThrottler> throttler_; | 128 scoped_ptr<AffiliationFetchThrottler> throttler_; |
133 | 129 |
134 base::Time construction_time_; | |
135 base::Time last_request_time_; | |
136 | |
137 // Contains a FacetManager for each facet URI that need ongoing attention. To | 130 // Contains a FacetManager for each facet URI that need ongoing attention. To |
138 // save memory, managers are discarded as soon as they become redundant. | 131 // save memory, managers are discarded as soon as they become redundant. |
139 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_; | 132 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_; |
140 | 133 |
141 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; | 134 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; |
142 | 135 |
143 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); | 136 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); |
144 }; | 137 }; |
145 | 138 |
146 } // namespace password_manager | 139 } // namespace password_manager |
147 | 140 |
148 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ | 141 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ |
OLD | NEW |