Chromium Code Reviews| Index: chrome/browser/password_manager/password_store_win.cc |
| diff --git a/chrome/browser/password_manager/password_store_win.cc b/chrome/browser/password_manager/password_store_win.cc |
| index 5d67dafb97a3aac4a620cd828670df97375b0c12..5db4d0e670c592f7875c0d0674932002614fd458 100644 |
| --- a/chrome/browser/password_manager/password_store_win.cc |
| +++ b/chrome/browser/password_manager/password_store_win.cc |
| @@ -54,9 +54,9 @@ class PasswordStoreWin::DBHandler : public WebDataServiceConsumer { |
| // Gets logins from IE7 if no others are found. Also copies them into |
| // Chrome's WebDatabase so we don't need to look next time. |
| - std::vector<autofill::PasswordForm*> GetIE7Results( |
| - const WDTypedResult* result, |
| - const PasswordForm& form); |
| + void GetIE7Results(const WDTypedResult* result, |
| + const PasswordForm& form, |
| + ScopedVector<autofill::PasswordForm>* matched_forms); |
| // WebDataServiceConsumer implementation. |
| virtual void OnWebDataServiceRequestDone( |
| @@ -97,12 +97,11 @@ void PasswordStoreWin::DBHandler::GetIE7Login( |
| RequestInfo(new PasswordForm(form), callback_runner); |
| } |
| -std::vector<PasswordForm*> PasswordStoreWin::DBHandler::GetIE7Results( |
| - const WDTypedResult *result, |
| - const PasswordForm& form) { |
| +void PasswordStoreWin::DBHandler::GetIE7Results( |
|
vasilii
2015/01/27 20:45:51
I think it's cleaner to return ScopedVector<autofi
vabr (Chromium)
2015/01/28 13:27:36
Done.
|
| + const WDTypedResult* result, |
| + const PasswordForm& form, |
| + ScopedVector<autofill::PasswordForm>* matched_forms) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| - std::vector<PasswordForm*> matching_forms; |
| - |
| const WDResult<IE7PasswordInfo>* r = |
| static_cast<const WDResult<IE7PasswordInfo>*>(result); |
| IE7PasswordInfo info = r->GetValue(); |
| @@ -127,14 +126,13 @@ std::vector<PasswordForm*> PasswordStoreWin::DBHandler::GetIE7Results( |
| autofill->ssl_valid = form.origin.SchemeIsSecure(); |
| autofill->date_created = info.date_created; |
| - matching_forms.push_back(autofill); |
| + matched_forms->push_back(autofill); |
| // Add this PasswordForm to the saved password table. We're on the DB |
| // thread already, so we use AddLoginImpl. |
| password_store_->AddLoginImpl(*autofill); |
| } |
| } |
| } |
| - return matching_forms; |
| } |
| void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone( |
| @@ -153,15 +151,16 @@ void PasswordStoreWin::DBHandler::OnWebDataServiceRequestDone( |
| if (!result) { |
| // The WDS returns NULL if it is shutting down. Run callback with empty |
| // result. |
| - callback_runner.Run(std::vector<autofill::PasswordForm*>()); |
| + ScopedVector<autofill::PasswordForm> dummy; |
| + callback_runner.Run(&dummy); |
| return; |
| } |
| DCHECK_EQ(PASSWORD_IE7_RESULT, result->GetType()); |
| - std::vector<autofill::PasswordForm*> matched_forms = |
| - GetIE7Results(result, *form); |
| + ScopedVector<autofill::PasswordForm> matched_forms; |
| + GetIE7Results(result, *form, &matched_forms); |
| - callback_runner.Run(matched_forms); |
| + callback_runner.Run(&matched_forms); |
| } |
| PasswordStoreWin::PasswordStoreWin( |
| @@ -193,9 +192,9 @@ void PasswordStoreWin::Shutdown() { |
| void PasswordStoreWin::GetIE7LoginIfNecessary( |
| const PasswordForm& form, |
| const ConsumerCallbackRunner& callback_runner, |
| - const std::vector<autofill::PasswordForm*>& matched_forms) { |
| + ScopedVector<autofill::PasswordForm>* matched_forms) { |
|
vasilii
2015/01/27 20:45:51
If you change the type of ConsumerCallbackRunner t
vabr (Chromium)
2015/01/28 13:27:36
Done.
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| - if (matched_forms.empty() && db_handler_.get()) { |
| + if (matched_forms->empty() && db_handler_) { |
| db_handler_->GetIE7Login(form, callback_runner); |
| } else { |
| // No need to get IE7 login. |