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_SERVICE_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
15 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
16 #include "components/password_manager/core/browser/affiliation_utils.h" | 16 #include "components/password_manager/core/browser/affiliation_utils.h" |
17 | 17 |
18 namespace base { | 18 namespace base { |
| 19 class FilePath; |
19 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
20 } | 21 } // namespace base |
| 22 |
| 23 namespace net { |
| 24 class URLRequestContextGetter; |
| 25 } // namespace net |
21 | 26 |
22 namespace password_manager { | 27 namespace password_manager { |
23 | 28 |
24 class AffiliationBackend; | 29 class AffiliationBackend; |
25 | 30 |
26 // A service that can be used to query the list of facets that are affiliated | 31 // A service that can be used to query the list of facets that are affiliated |
27 // with a given facet, i.e., facets that belong to the same logical application. | 32 // with a given facet, i.e., facets that belong to the same logical application. |
28 // See affiliation_utils.h for details of what this means. | 33 // See affiliation_utils.h for details of what this means. |
29 // | 34 // |
30 // The service must be accessed from the UI thread, and it can be utilized in | 35 // The service must be accessed from the UI thread, and it can be utilized in |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 typedef base::Closure CancelPrefetchingHandle; | 95 typedef base::Closure CancelPrefetchingHandle; |
91 | 96 |
92 // The |backend_task_runner| should be a task runner corresponding to a thread | 97 // The |backend_task_runner| should be a task runner corresponding to a thread |
93 // that can take blocking I/O, and is normally Chrome's DB thread. | 98 // that can take blocking I/O, and is normally Chrome's DB thread. |
94 AffiliationService( | 99 AffiliationService( |
95 scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner); | 100 scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner); |
96 ~AffiliationService() override; | 101 ~AffiliationService() override; |
97 | 102 |
98 // Initializes the service by creating its backend and transferring it to the | 103 // Initializes the service by creating its backend and transferring it to the |
99 // thread corresponding to |backend_task_runner_|. | 104 // thread corresponding to |backend_task_runner_|. |
100 void Initialize(); | 105 void Initialize(net::URLRequestContextGetter* request_context_getter, |
| 106 const base::FilePath& db_path); |
101 | 107 |
102 // Looks up facets affiliated with the facet identified by |facet_uri|. If | 108 // Looks up facets affiliated with the facet identified by |facet_uri|. If |
103 // |cached_only| is true, the results will be based solely on prefetched | 109 // |cached_only| is true, the results will be based solely on prefetched |
104 // information already stored in the cache. Otherwise, on-demand network | 110 // information already stored in the cache. Otherwise, on-demand network |
105 // requests will be issued if there is no up-to-date data in the cache. | 111 // requests will be issued if there is no up-to-date data in the cache. |
106 void GetAffiliations(const FacetURI& facet_uri, | 112 void GetAffiliations(const FacetURI& facet_uri, |
107 bool cached_only, | 113 bool cached_only, |
108 const ResultCallback& result_callback); | 114 const ResultCallback& result_callback); |
109 | 115 |
110 // Prefetches affiliation information for the facet identified by |facet_uri|, | 116 // Prefetches affiliation information for the facet identified by |facet_uri|, |
(...skipping 30 matching lines...) Expand all Loading... |
141 | 147 |
142 base::ThreadChecker thread_checker_; | 148 base::ThreadChecker thread_checker_; |
143 base::WeakPtrFactory<AffiliationService> weak_ptr_factory_; | 149 base::WeakPtrFactory<AffiliationService> weak_ptr_factory_; |
144 | 150 |
145 DISALLOW_COPY_AND_ASSIGN(AffiliationService); | 151 DISALLOW_COPY_AND_ASSIGN(AffiliationService); |
146 }; | 152 }; |
147 | 153 |
148 } // namespace password_manager | 154 } // namespace password_manager |
149 | 155 |
150 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ | 156 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ |
OLD | NEW |