Chromium Code Reviews| Index: chrome/browser/password_manager/native_backend_libsecret.cc |
| diff --git a/chrome/browser/password_manager/native_backend_libsecret.cc b/chrome/browser/password_manager/native_backend_libsecret.cc |
| index 43673a3532b6f968a288df3228d4b56ad4fbd435..81498fa6323b2a1be6c5d07daef85e013601c0b9 100644 |
| --- a/chrome/browser/password_manager/native_backend_libsecret.cc |
| +++ b/chrome/browser/password_manager/native_backend_libsecret.cc |
| @@ -283,8 +283,8 @@ password_manager::PasswordStoreChangeList NativeBackendLibsecret::AddLogin( |
| // element, and signon_realm first, remove that, and then add the new entry. |
| // We'd add the new one first, and then delete the original, but then the |
| // delete might actually delete the newly-added entry! |
| - ScopedVector<autofill::PasswordForm> forms; |
| - AddUpdateLoginSearch(form, SEARCH_USE_SUBMIT, &forms); |
| + ScopedVector<autofill::PasswordForm> forms = |
| + AddUpdateLoginSearch(form, SEARCH_USE_SUBMIT); |
| password_manager::PasswordStoreChangeList changes; |
| if (forms.size() > 0) { |
| if (forms.size() > 1) { |
| @@ -316,8 +316,8 @@ bool NativeBackendLibsecret::UpdateLogin( |
| DCHECK(changes); |
| changes->clear(); |
| - ScopedVector<autofill::PasswordForm> forms; |
| - AddUpdateLoginSearch(form, SEARCH_IGNORE_SUBMIT, &forms); |
| + ScopedVector<autofill::PasswordForm> forms = |
| + AddUpdateLoginSearch(form, SEARCH_IGNORE_SUBMIT); |
| bool removed = false; |
| for (size_t i = 0; i < forms.size(); ++i) { |
| @@ -378,10 +378,10 @@ bool NativeBackendLibsecret::GetLogins( |
| return GetLoginsList(&form, ALL_LOGINS, forms); |
| } |
| -void NativeBackendLibsecret::AddUpdateLoginSearch( |
| +ScopedVector<autofill::PasswordForm> |
| +NativeBackendLibsecret::AddUpdateLoginSearch( |
| const autofill::PasswordForm& lookup_form, |
| - AddUpdateLoginSearchOptions options, |
| - ScopedVector<autofill::PasswordForm>* forms) { |
| + AddUpdateLoginSearchOptions options) { |
| LibsecretAttributesBuilder attrs; |
| attrs.Append("origin_url", lookup_form.origin.spec()); |
| attrs.Append("username_element", UTF16ToUTF8(lookup_form.username_element)); |
| @@ -403,10 +403,10 @@ void NativeBackendLibsecret::AddUpdateLoginSearch( |
| g_error_free(error); |
| if (found) |
| g_list_free(found); |
| - return; |
| + return ScopedVector<autofill::PasswordForm>(); |
| } |
| - ConvertFormList(found, &lookup_form, forms); |
| + return ConvertFormList(found, &lookup_form); |
| } |
| bool NativeBackendLibsecret::RawAddLogin(const PasswordForm& form) { |
| @@ -468,6 +468,7 @@ bool NativeBackendLibsecret::GetLoginsList( |
| const PasswordForm* lookup_form, |
| GetLoginsListOptions options, |
| ScopedVector<autofill::PasswordForm>* forms) { |
| + forms->clear(); |
| LibsecretAttributesBuilder attrs; |
| attrs.Append("application", app_string_); |
| if (options != ALL_LOGINS) |
| @@ -492,12 +493,8 @@ bool NativeBackendLibsecret::GetLoginsList( |
| return false; |
| } |
| - return ConvertFormList(found, lookup_form, forms); |
| -} |
| - |
| -bool NativeBackendLibsecret::GetAllLogins( |
| - ScopedVector<autofill::PasswordForm>* forms) { |
| - return GetLoginsList(nullptr, ALL_LOGINS, forms); |
| + *forms = ConvertFormList(found, lookup_form); |
| + return true; |
| } |
| bool NativeBackendLibsecret::GetLoginsBetween( |
| @@ -506,7 +503,7 @@ bool NativeBackendLibsecret::GetLoginsBetween( |
| TimestampToCompare date_to_compare, |
| ScopedVector<autofill::PasswordForm>* forms) { |
| ScopedVector<autofill::PasswordForm> all_forms; |
|
engedy
2015/02/25 15:17:48
Need to wipe |forms| here.
vabr (Chromium)
2015/03/09 10:56:19
Done.
|
| - if (!GetAllLogins(&all_forms)) |
| + if (!GetLoginsList(nullptr, ALL_LOGINS, &all_forms)) |
| return false; |
| base::Time autofill::PasswordForm::*date_member = |
| @@ -547,10 +544,10 @@ bool NativeBackendLibsecret::RemoveLoginsBetween( |
| return ok; |
| } |
| -bool NativeBackendLibsecret::ConvertFormList( |
| +ScopedVector<autofill::PasswordForm> NativeBackendLibsecret::ConvertFormList( |
| GList* found, |
| - const PasswordForm* lookup_form, |
| - ScopedVector<autofill::PasswordForm>* forms) { |
| + const PasswordForm* lookup_form) { |
| + ScopedVector<autofill::PasswordForm> forms; |
| password_manager::PSLDomainMatchMetric psl_domain_match_metric = |
| password_manager::PSL_DOMAIN_MATCH_NONE; |
| GError* error = nullptr; |
| @@ -588,7 +585,7 @@ bool NativeBackendLibsecret::ConvertFormList( |
| } else { |
| VLOG(1) << "Unable to access password from list element!"; |
| } |
| - forms->push_back(form.release()); |
| + forms.push_back(form.release()); |
| } else { |
| VLOG(1) << "Could not initialize PasswordForm from attributes!"; |
| } |
| @@ -606,7 +603,7 @@ bool NativeBackendLibsecret::ConvertFormList( |
| password_manager::PSL_DOMAIN_MATCH_COUNT); |
| } |
| g_list_free(found); |
| - return true; |
| + return forms.Pass(); |
| } |
| std::string NativeBackendLibsecret::GetProfileSpecificAppString( |