| 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 #include "components/password_manager/core/browser/affiliation_service.h" | 5 #include "components/password_manager/core/browser/affiliation_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const ResultCallback& result_callback) { | 49 const ResultCallback& result_callback) { |
| 50 DCHECK(thread_checker_.CalledOnValidThread()); | 50 DCHECK(thread_checker_.CalledOnValidThread()); |
| 51 DCHECK(backend_); | 51 DCHECK(backend_); |
| 52 backend_task_runner_->PostTask( | 52 backend_task_runner_->PostTask( |
| 53 FROM_HERE, | 53 FROM_HERE, |
| 54 base::Bind(&AffiliationBackend::GetAffiliations, | 54 base::Bind(&AffiliationBackend::GetAffiliations, |
| 55 base::Unretained(backend_), facet_uri, cached_only, | 55 base::Unretained(backend_), facet_uri, cached_only, |
| 56 result_callback, base::ThreadTaskRunnerHandle::Get())); | 56 result_callback, base::ThreadTaskRunnerHandle::Get())); |
| 57 } | 57 } |
| 58 | 58 |
| 59 AffiliationService::CancelPrefetchingHandle AffiliationService::Prefetch( | 59 void AffiliationService::Prefetch(const FacetURI& facet_uri, |
| 60 const FacetURI& facet_uri, | 60 const base::Time& keep_fresh_until) { |
| 61 const base::Time& keep_fresh_until) { | |
| 62 DCHECK(thread_checker_.CalledOnValidThread()); | 61 DCHECK(thread_checker_.CalledOnValidThread()); |
| 63 DCHECK(backend_); | 62 DCHECK(backend_); |
| 64 backend_task_runner_->PostTask( | 63 backend_task_runner_->PostTask( |
| 65 FROM_HERE, | 64 FROM_HERE, |
| 66 base::Bind(&AffiliationBackend::Prefetch, base::Unretained(backend_), | 65 base::Bind(&AffiliationBackend::Prefetch, base::Unretained(backend_), |
| 67 facet_uri, keep_fresh_until)); | 66 facet_uri, keep_fresh_until)); |
| 68 return base::Bind(&AffiliationService::CancelPrefetch, | |
| 69 weak_ptr_factory_.GetWeakPtr(), facet_uri, | |
| 70 keep_fresh_until); | |
| 71 } | 67 } |
| 72 | 68 |
| 73 void AffiliationService::CancelPrefetch(const FacetURI& facet_uri, | 69 void AffiliationService::CancelPrefetch(const FacetURI& facet_uri, |
| 74 const base::Time& keep_fresh_until) { | 70 const base::Time& keep_fresh_until) { |
| 75 DCHECK(thread_checker_.CalledOnValidThread()); | 71 DCHECK(thread_checker_.CalledOnValidThread()); |
| 76 DCHECK(backend_); | 72 DCHECK(backend_); |
| 77 backend_task_runner_->PostTask( | 73 backend_task_runner_->PostTask( |
| 78 FROM_HERE, | 74 FROM_HERE, |
| 79 base::Bind(&AffiliationBackend::CancelPrefetch, | 75 base::Bind(&AffiliationBackend::CancelPrefetch, |
| 80 base::Unretained(backend_), facet_uri, keep_fresh_until)); | 76 base::Unretained(backend_), facet_uri, keep_fresh_until)); |
| 81 } | 77 } |
| 82 | 78 |
| 83 void AffiliationService::TrimCache() { | 79 void AffiliationService::TrimCache() { |
| 84 DCHECK(thread_checker_.CalledOnValidThread()); | 80 DCHECK(thread_checker_.CalledOnValidThread()); |
| 85 DCHECK(backend_); | 81 DCHECK(backend_); |
| 86 backend_task_runner_->PostTask( | 82 backend_task_runner_->PostTask( |
| 87 FROM_HERE, | 83 FROM_HERE, |
| 88 base::Bind(&AffiliationBackend::TrimCache, base::Unretained(backend_))); | 84 base::Bind(&AffiliationBackend::TrimCache, base::Unretained(backend_))); |
| 89 } | 85 } |
| 90 | 86 |
| 91 } // namespace password_manager | 87 } // namespace password_manager |
| OLD | NEW |