| 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/affiliated_match_helper.h" | 5 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
| 11 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
| 12 #include "components/password_manager/core/browser/affiliation_service.h" | 14 #include "components/password_manager/core/browser/affiliation_service.h" |
| 13 | 15 |
| 14 namespace password_manager { | 16 namespace password_manager { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 30 } // namespace | 32 } // namespace |
| 31 | 33 |
| 32 // static | 34 // static |
| 33 const int64_t AffiliatedMatchHelper::kInitializationDelayOnStartupInSeconds; | 35 const int64_t AffiliatedMatchHelper::kInitializationDelayOnStartupInSeconds; |
| 34 | 36 |
| 35 AffiliatedMatchHelper::AffiliatedMatchHelper( | 37 AffiliatedMatchHelper::AffiliatedMatchHelper( |
| 36 PasswordStore* password_store, | 38 PasswordStore* password_store, |
| 37 scoped_ptr<AffiliationService> affiliation_service) | 39 scoped_ptr<AffiliationService> affiliation_service) |
| 38 : password_store_(password_store), | 40 : password_store_(password_store), |
| 39 task_runner_for_waiting_(base::ThreadTaskRunnerHandle::Get()), | 41 task_runner_for_waiting_(base::ThreadTaskRunnerHandle::Get()), |
| 40 affiliation_service_(affiliation_service.Pass()), | 42 affiliation_service_(std::move(affiliation_service)), |
| 41 weak_ptr_factory_(this) { | 43 weak_ptr_factory_(this) {} |
| 42 } | |
| 43 | 44 |
| 44 AffiliatedMatchHelper::~AffiliatedMatchHelper() { | 45 AffiliatedMatchHelper::~AffiliatedMatchHelper() { |
| 45 if (password_store_) | 46 if (password_store_) |
| 46 password_store_->RemoveObserver(this); | 47 password_store_->RemoveObserver(this); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void AffiliatedMatchHelper::Initialize() { | 50 void AffiliatedMatchHelper::Initialize() { |
| 50 DCHECK(password_store_); | 51 DCHECK(password_store_); |
| 51 DCHECK(affiliation_service_); | 52 DCHECK(affiliation_service_); |
| 52 task_runner_for_waiting_->PostDelayedTask( | 53 task_runner_for_waiting_->PostDelayedTask( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void AffiliatedMatchHelper::OnGetPasswordStoreResults( | 178 void AffiliatedMatchHelper::OnGetPasswordStoreResults( |
| 178 ScopedVector<autofill::PasswordForm> results) { | 179 ScopedVector<autofill::PasswordForm> results) { |
| 179 for (autofill::PasswordForm* form : results) { | 180 for (autofill::PasswordForm* form : results) { |
| 180 FacetURI facet_uri; | 181 FacetURI facet_uri; |
| 181 if (IsAndroidApplicationCredential(*form, &facet_uri)) | 182 if (IsAndroidApplicationCredential(*form, &facet_uri)) |
| 182 affiliation_service_->Prefetch(facet_uri, base::Time::Max()); | 183 affiliation_service_->Prefetch(facet_uri, base::Time::Max()); |
| 183 } | 184 } |
| 184 } | 185 } |
| 185 | 186 |
| 186 } // namespace password_manager | 187 } // namespace password_manager |
| OLD | NEW |