| 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_backend.h" | 5 #include "components/password_manager/core/browser/affiliation_backend.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 cache_.reset(new AffiliationDatabase()); | 47 cache_.reset(new AffiliationDatabase()); |
| 48 if (!cache_->Init(db_path)) { | 48 if (!cache_->Init(db_path)) { |
| 49 // TODO(engedy): Implement this. crbug.com/437865. | 49 // TODO(engedy): Implement this. crbug.com/437865. |
| 50 NOTIMPLEMENTED(); | 50 NOTIMPLEMENTED(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 void AffiliationBackend::GetAffiliations( | 54 void AffiliationBackend::GetAffiliations( |
| 55 const FacetURI& facet_uri, | 55 const FacetURI& facet_uri, |
| 56 bool cached_only, | 56 StrategyOnCacheMiss cache_miss_strategy, |
| 57 const AffiliationService::ResultCallback& callback, | 57 const AffiliationService::ResultCallback& callback, |
| 58 const scoped_refptr<base::TaskRunner>& callback_task_runner) { | 58 const scoped_refptr<base::TaskRunner>& callback_task_runner) { |
| 59 DCHECK(thread_checker_ && thread_checker_->CalledOnValidThread()); | 59 DCHECK(thread_checker_ && thread_checker_->CalledOnValidThread()); |
| 60 | 60 |
| 61 FacetManager* facet_manager = GetOrCreateFacetManager(facet_uri); | 61 FacetManager* facet_manager = GetOrCreateFacetManager(facet_uri); |
| 62 DCHECK(facet_manager); | 62 DCHECK(facet_manager); |
| 63 facet_manager->GetAffiliations(cached_only, callback, callback_task_runner); | 63 facet_manager->GetAffiliations(cache_miss_strategy, callback, |
| 64 callback_task_runner); |
| 64 | 65 |
| 65 if (facet_manager->CanBeDiscarded()) | 66 if (facet_manager->CanBeDiscarded()) |
| 66 facet_managers_.erase(facet_uri); | 67 facet_managers_.erase(facet_uri); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void AffiliationBackend::Prefetch(const FacetURI& facet_uri, | 70 void AffiliationBackend::Prefetch(const FacetURI& facet_uri, |
| 70 const base::Time& keep_fresh_until) { | 71 const base::Time& keep_fresh_until) { |
| 71 DCHECK(thread_checker_ && thread_checker_->CalledOnValidThread()); | 72 DCHECK(thread_checker_ && thread_checker_->CalledOnValidThread()); |
| 72 | 73 |
| 73 FacetManager* facet_manager = GetOrCreateFacetManager(facet_uri); | 74 FacetManager* facet_manager = GetOrCreateFacetManager(facet_uri); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 fetcher_->StartRequest(); | 222 fetcher_->StartRequest(); |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 void AffiliationBackend::SetThrottlerForTesting( | 226 void AffiliationBackend::SetThrottlerForTesting( |
| 226 scoped_ptr<AffiliationFetchThrottler> throttler) { | 227 scoped_ptr<AffiliationFetchThrottler> throttler) { |
| 227 throttler_ = throttler.Pass(); | 228 throttler_ = throttler.Pass(); |
| 228 } | 229 } |
| 229 | 230 |
| 230 } // namespace password_manager | 231 } // namespace password_manager |
| OLD | NEW |