| 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" |
| 11 #include "base/memory/ptr_util.h" |
| 11 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 12 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 13 #include "base/time/default_clock.h" | 14 #include "base/time/default_clock.h" |
| 14 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
| 15 #include "components/password_manager/core/browser/affiliation_backend.h" | 16 #include "components/password_manager/core/browser/affiliation_backend.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 17 | 18 |
| 18 namespace password_manager { | 19 namespace password_manager { |
| 19 | 20 |
| 20 AffiliationService::AffiliationService( | 21 AffiliationService::AffiliationService( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 32 } | 33 } |
| 33 } | 34 } |
| 34 | 35 |
| 35 void AffiliationService::Initialize( | 36 void AffiliationService::Initialize( |
| 36 net::URLRequestContextGetter* request_context_getter, | 37 net::URLRequestContextGetter* request_context_getter, |
| 37 const base::FilePath& db_path) { | 38 const base::FilePath& db_path) { |
| 38 DCHECK(thread_checker_.CalledOnValidThread()); | 39 DCHECK(thread_checker_.CalledOnValidThread()); |
| 39 DCHECK(!backend_); | 40 DCHECK(!backend_); |
| 40 backend_ = | 41 backend_ = |
| 41 new AffiliationBackend(request_context_getter, backend_task_runner_, | 42 new AffiliationBackend(request_context_getter, backend_task_runner_, |
| 42 make_scoped_ptr(new base::DefaultClock), | 43 base::WrapUnique(new base::DefaultClock), |
| 43 make_scoped_ptr(new base::DefaultTickClock)); | 44 base::WrapUnique(new base::DefaultTickClock)); |
| 44 | 45 |
| 45 scoped_ptr<base::TickClock> tick_clock(new base::DefaultTickClock); | 46 std::unique_ptr<base::TickClock> tick_clock(new base::DefaultTickClock); |
| 46 backend_task_runner_->PostTask( | 47 backend_task_runner_->PostTask( |
| 47 FROM_HERE, base::Bind(&AffiliationBackend::Initialize, | 48 FROM_HERE, base::Bind(&AffiliationBackend::Initialize, |
| 48 base::Unretained(backend_), db_path)); | 49 base::Unretained(backend_), db_path)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void AffiliationService::GetAffiliations( | 52 void AffiliationService::GetAffiliations( |
| 52 const FacetURI& facet_uri, | 53 const FacetURI& facet_uri, |
| 53 StrategyOnCacheMiss cache_miss_strategy, | 54 StrategyOnCacheMiss cache_miss_strategy, |
| 54 const ResultCallback& result_callback) { | 55 const ResultCallback& result_callback) { |
| 55 DCHECK(thread_checker_.CalledOnValidThread()); | 56 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 100 |
| 100 // static | 101 // static |
| 101 void AffiliationService::DeleteCache( | 102 void AffiliationService::DeleteCache( |
| 102 const base::FilePath& db_path, | 103 const base::FilePath& db_path, |
| 103 base::SingleThreadTaskRunner* backend_task_runner) { | 104 base::SingleThreadTaskRunner* backend_task_runner) { |
| 104 backend_task_runner->PostTask( | 105 backend_task_runner->PostTask( |
| 105 FROM_HERE, base::Bind(&AffiliationBackend::DeleteCache, db_path)); | 106 FROM_HERE, base::Bind(&AffiliationBackend::DeleteCache, db_path)); |
| 106 } | 107 } |
| 107 | 108 |
| 108 } // namespace password_manager | 109 } // namespace password_manager |
| OLD | NEW |