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 |
113 // To be called after Initialize() to use |throttler| instead of the default | 117 // To be called after Initialize() to use |throttler| instead of the default |
114 // one. Used only for testing. | 118 // one. Used only for testing. |
115 void SetThrottlerForTesting(scoped_ptr<AffiliationFetchThrottler> throttler); | 119 void SetThrottlerForTesting(scoped_ptr<AffiliationFetchThrottler> throttler); |
116 | 120 |
117 // Created in Initialize(), and ensures that all subsequent methods are called | 121 // Created in Initialize(), and ensures that all subsequent methods are called |
118 // on the same thread. | 122 // on the same thread. |
119 scoped_ptr<base::ThreadChecker> thread_checker_; | 123 scoped_ptr<base::ThreadChecker> thread_checker_; |
120 | 124 |
121 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 125 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
122 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 126 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
123 scoped_ptr<base::Clock> clock_; | 127 scoped_ptr<base::Clock> clock_; |
124 scoped_ptr<base::TickClock> tick_clock_; | 128 scoped_ptr<base::TickClock> tick_clock_; |
125 | 129 |
126 scoped_ptr<AffiliationDatabase> cache_; | 130 scoped_ptr<AffiliationDatabase> cache_; |
127 scoped_ptr<AffiliationFetcher> fetcher_; | 131 scoped_ptr<AffiliationFetcher> fetcher_; |
128 scoped_ptr<AffiliationFetchThrottler> throttler_; | 132 scoped_ptr<AffiliationFetchThrottler> throttler_; |
129 | 133 |
| 134 base::Time construction_time_; |
| 135 base::Time last_request_time_; |
| 136 |
130 // Contains a FacetManager for each facet URI that need ongoing attention. To | 137 // Contains a FacetManager for each facet URI that need ongoing attention. To |
131 // save memory, managers are discarded as soon as they become redundant. | 138 // save memory, managers are discarded as soon as they become redundant. |
132 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_; | 139 base::ScopedPtrHashMap<FacetURI, FacetManager> facet_managers_; |
133 | 140 |
134 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; | 141 base::WeakPtrFactory<AffiliationBackend> weak_ptr_factory_; |
135 | 142 |
136 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); | 143 DISALLOW_COPY_AND_ASSIGN(AffiliationBackend); |
137 }; | 144 }; |
138 | 145 |
139 } // namespace password_manager | 146 } // namespace password_manager |
140 | 147 |
141 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ | 148 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_BACKEND_H_ |
OLD | NEW |