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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 const autofill::PasswordForm& form, | 115 const autofill::PasswordForm& form, |
116 AuthorizationPromptPolicy prompt_policy, | 116 AuthorizationPromptPolicy prompt_policy, |
117 const ConsumerCallbackRunner& callback_runner) { | 117 const ConsumerCallbackRunner& callback_runner) { |
118 ScopedVector<autofill::PasswordForm> matched_forms; | 118 ScopedVector<autofill::PasswordForm> matched_forms; |
119 if (login_db_) | 119 if (login_db_) |
120 login_db_->GetLogins(form, &matched_forms); | 120 login_db_->GetLogins(form, &matched_forms); |
121 callback_runner.Run(matched_forms.Pass()); | 121 callback_runner.Run(matched_forms.Pass()); |
122 } | 122 } |
123 | 123 |
124 void PasswordStoreDefault::GetAutofillableLoginsImpl( | 124 void PasswordStoreDefault::GetAutofillableLoginsImpl( |
125 GetLoginsRequest* request) { | 125 scoped_ptr<GetLoginsRequest> request) { |
126 // TODO(vabr) -- request should have a ScopedVector<autofill::PasswordForm> | |
127 // instead of using |logins| here. | |
128 DCHECK(request->result()->empty()); | 126 DCHECK(request->result()->empty()); |
129 ScopedVector<autofill::PasswordForm> logins; | 127 ScopedVector<autofill::PasswordForm> logins; |
130 FillAutofillableLogins(&logins); | 128 FillAutofillableLogins(&logins); |
vasilii
2015/02/09 10:08:35
Why not FillAutofillableLogins(request->result());
vabr (Chromium)
2015/02/09 11:36:06
Done.
| |
131 logins.swap(*request->result()); | 129 logins.swap(*request->result()); |
132 ForwardLoginsResult(request); | 130 ForwardLoginsResult(request.Pass()); |
133 } | 131 } |
134 | 132 |
135 void PasswordStoreDefault::GetBlacklistLoginsImpl(GetLoginsRequest* request) { | 133 void PasswordStoreDefault::GetBlacklistLoginsImpl( |
136 // TODO(vabr) -- request should have a ScopedVector<autofill::PasswordForm> | 134 scoped_ptr<GetLoginsRequest> request) { |
137 // instead of using |logins| here. | |
138 DCHECK(request->result()->empty()); | 135 DCHECK(request->result()->empty()); |
139 ScopedVector<autofill::PasswordForm> logins; | 136 ScopedVector<autofill::PasswordForm> logins; |
140 FillBlacklistLogins(&logins); | 137 FillBlacklistLogins(&logins); |
141 logins.swap(*request->result()); | 138 logins.swap(*request->result()); |
142 ForwardLoginsResult(request); | 139 ForwardLoginsResult(request.Pass()); |
143 } | 140 } |
144 | 141 |
145 bool PasswordStoreDefault::FillAutofillableLogins( | 142 bool PasswordStoreDefault::FillAutofillableLogins( |
146 ScopedVector<autofill::PasswordForm>* forms) { | 143 ScopedVector<autofill::PasswordForm>* forms) { |
147 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); | 144 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); |
148 return login_db_ && login_db_->GetAutofillableLogins(forms); | 145 return login_db_ && login_db_->GetAutofillableLogins(forms); |
149 } | 146 } |
150 | 147 |
151 bool PasswordStoreDefault::FillBlacklistLogins( | 148 bool PasswordStoreDefault::FillBlacklistLogins( |
152 ScopedVector<autofill::PasswordForm>* forms) { | 149 ScopedVector<autofill::PasswordForm>* forms) { |
153 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); | 150 DCHECK(GetBackgroundTaskRunner()->BelongsToCurrentThread()); |
154 return login_db_ && login_db_->GetBlacklistLogins(forms); | 151 return login_db_ && login_db_->GetBlacklistLogins(forms); |
155 } | 152 } |
156 | 153 |
157 } // namespace password_manager | 154 } // namespace password_manager |
OLD | NEW |