| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/password_store_default.h" | 5 #include "components/password_manager/core/browser/password_store_default.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 ScopedVector<autofill::PasswordForm> PasswordStoreDefault::FillMatchingLogins( | 119 ScopedVector<autofill::PasswordForm> PasswordStoreDefault::FillMatchingLogins( |
| 120 const autofill::PasswordForm& form, | 120 const autofill::PasswordForm& form, |
| 121 AuthorizationPromptPolicy prompt_policy) { | 121 AuthorizationPromptPolicy prompt_policy) { |
| 122 ScopedVector<autofill::PasswordForm> matched_forms; | 122 ScopedVector<autofill::PasswordForm> matched_forms; |
| 123 if (login_db_ && !login_db_->GetLogins(form, &matched_forms)) | 123 if (login_db_ && !login_db_->GetLogins(form, &matched_forms)) |
| 124 return ScopedVector<autofill::PasswordForm>(); | 124 return ScopedVector<autofill::PasswordForm>(); |
| 125 return matched_forms.Pass(); | 125 return matched_forms.Pass(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void PasswordStoreDefault::GetAutofillableLoginsImpl( | |
| 129 scoped_ptr<GetLoginsRequest> request) { | |
| 130 ScopedVector<PasswordForm> logins; | |
| 131 if (!FillAutofillableLogins(&logins)) | |
| 132 logins.clear(); | |
| 133 request->NotifyConsumerWithResults(logins.Pass()); | |
| 134 } | |
| 135 | |
| 136 void PasswordStoreDefault::GetBlacklistLoginsImpl( | |
| 137 scoped_ptr<GetLoginsRequest> request) { | |
| 138 ScopedVector<PasswordForm> logins; | |
| 139 if (!FillBlacklistLogins(&logins)) | |
| 140 logins.clear(); | |
| 141 request->NotifyConsumerWithResults(logins.Pass()); | |
| 142 } | |
| 143 | |
| 144 bool PasswordStoreDefault::FillAutofillableLogins( | 128 bool PasswordStoreDefault::FillAutofillableLogins( |
| 145 ScopedVector<PasswordForm>* forms) { | 129 ScopedVector<PasswordForm>* forms) { |
| 146 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); | 130 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); |
| 147 return login_db_ && login_db_->GetAutofillableLogins(forms); | 131 return login_db_ && login_db_->GetAutofillableLogins(forms); |
| 148 } | 132 } |
| 149 | 133 |
| 150 bool PasswordStoreDefault::FillBlacklistLogins( | 134 bool PasswordStoreDefault::FillBlacklistLogins( |
| 151 ScopedVector<PasswordForm>* forms) { | 135 ScopedVector<PasswordForm>* forms) { |
| 152 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); | 136 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); |
| 153 return login_db_ && login_db_->GetBlacklistLogins(forms); | 137 return login_db_ && login_db_->GetBlacklistLogins(forms); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 171 return login_db_ ? login_db_->stats_table().GetRow(origin_domain) | 155 return login_db_ ? login_db_->stats_table().GetRow(origin_domain) |
| 172 : scoped_ptr<InteractionsStats>(); | 156 : scoped_ptr<InteractionsStats>(); |
| 173 } | 157 } |
| 174 | 158 |
| 175 void PasswordStoreDefault::ResetLoginDB() { | 159 void PasswordStoreDefault::ResetLoginDB() { |
| 176 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); | 160 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); |
| 177 login_db_.reset(); | 161 login_db_.reset(); |
| 178 } | 162 } |
| 179 | 163 |
| 180 } // namespace password_manager | 164 } // namespace password_manager |
| OLD | NEW |