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 d23ac4512d3f69b61d61869b237cd5619c4c8da2..4693ceab24e736005e9c632f17c90eb72563ac41 100644 |
--- a/chrome/browser/password_manager/native_backend_libsecret.cc |
+++ b/chrome/browser/password_manager/native_backend_libsecret.cc |
@@ -279,8 +279,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) { |
@@ -312,8 +312,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) { |
@@ -374,10 +374,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)); |
@@ -399,10 +399,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) { |
@@ -463,6 +463,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) |
@@ -487,12 +488,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( |
@@ -501,7 +498,7 @@ bool NativeBackendLibsecret::GetLoginsBetween( |
TimestampToCompare date_to_compare, |
ScopedVector<autofill::PasswordForm>* forms) { |
ScopedVector<autofill::PasswordForm> all_forms; |
- if (!GetAllLogins(&all_forms)) |
+ if (!GetLoginsList(nullptr, ALL_LOGINS, forms)) |
return false; |
base::Time autofill::PasswordForm::*date_member = |
@@ -542,10 +539,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; |
@@ -583,7 +580,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!"; |
} |
@@ -601,7 +598,7 @@ bool NativeBackendLibsecret::ConvertFormList( |
password_manager::PSL_DOMAIN_MATCH_COUNT); |
} |
g_list_free(found); |
- return true; |
+ return forms.Pass(); |
} |
std::string NativeBackendLibsecret::GetProfileSpecificAppString( |