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" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // same |facet_uri| and with the same |keep_fresh_until|. | 135 // same |facet_uri| and with the same |keep_fresh_until|. |
136 virtual void CancelPrefetch(const FacetURI& facet_uri, | 136 virtual void CancelPrefetch(const FacetURI& facet_uri, |
137 const base::Time& keep_fresh_until); | 137 const base::Time& keep_fresh_until); |
138 | 138 |
139 // Wipes results of on-demand fetches and expired prefetches from the cache, | 139 // Wipes results of on-demand fetches and expired prefetches from the cache, |
140 // but retains information corresponding to facets that are being kept fresh. | 140 // but retains information corresponding to facets that are being kept fresh. |
141 // As no required data is deleted, there will be no network requests directly | 141 // As no required data is deleted, there will be no network requests directly |
142 // triggered by this call. | 142 // triggered by this call. |
143 void TrimCache(); | 143 void TrimCache(); |
144 | 144 |
| 145 // Posts a task to the |backend_task_runner| to delete the cache database file |
| 146 // at |db_path|, and all auxiliary files. The database must be closed before |
| 147 // calling this. |
| 148 static void DeleteCache(const base::FilePath& db_path, |
| 149 base::SingleThreadTaskRunner* backend_task_runner); |
| 150 |
145 private: | 151 private: |
146 // The backend, owned by this AffiliationService instance, but living on the | 152 // The backend, owned by this AffiliationService instance, but living on the |
147 // DB thread. It will be deleted asynchronously during shutdown on the DB | 153 // DB thread. It will be deleted asynchronously during shutdown on the DB |
148 // thread, so it will outlive |this| along with all its in-flight tasks. | 154 // thread, so it will outlive |this| along with all its in-flight tasks. |
149 AffiliationBackend* backend_; | 155 AffiliationBackend* backend_; |
150 | 156 |
151 // TaskRunner to be used to run the |backend_| (usually the DB thread). | 157 // TaskRunner to be used to run the |backend_| (usually the DB thread). |
152 scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner_; | 158 scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner_; |
153 | 159 |
154 base::ThreadChecker thread_checker_; | 160 base::ThreadChecker thread_checker_; |
155 base::WeakPtrFactory<AffiliationService> weak_ptr_factory_; | 161 base::WeakPtrFactory<AffiliationService> weak_ptr_factory_; |
156 | 162 |
157 DISALLOW_COPY_AND_ASSIGN(AffiliationService); | 163 DISALLOW_COPY_AND_ASSIGN(AffiliationService); |
158 }; | 164 }; |
159 | 165 |
160 } // namespace password_manager | 166 } // namespace password_manager |
161 | 167 |
162 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ | 168 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_AFFILIATION_SERVICE_H_ |
OLD | NEW |