Chromium Code Reviews| Index: chrome/browser/ui/passwords/password_manager_presenter.cc |
| diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc |
| index 5b468a0a4b68cdeae84ad526100cc31b5bfb68be..8229d8fc94215b5e1ce99d4aeaf833bf0b2e0614 100644 |
| --- a/chrome/browser/ui/passwords/password_manager_presenter.cc |
| +++ b/chrome/browser/ui/passwords/password_manager_presenter.cc |
| @@ -21,6 +21,7 @@ |
| #include "chrome/common/url_constants.h" |
| #include "components/autofill/core/common/password_form.h" |
| #include "components/password_manager/core/browser/affiliation_utils.h" |
| +#include "components/password_manager/core/browser/import/password_importer.h" |
| #include "components/password_manager/core/browser/password_manager_util.h" |
| #include "components/password_manager/core/common/password_manager_pref_names.h" |
| #include "content/public/browser/user_metrics.h" |
| @@ -122,6 +123,34 @@ void PasswordManagerPresenter::RemovePasswordException(size_t index) { |
| base::UserMetricsAction("PasswordManager_RemovePasswordException")); |
| } |
| +bool PasswordManagerPresenter::AddPasswordsToStore( |
| + const std::vector<autofill::PasswordForm>& forms) { |
| + PasswordStore* store = GetPasswordStore(); |
| + if (!store) |
| + return false; |
| + |
| + for (std::vector<autofill::PasswordForm>::const_iterator it = forms.begin(); |
| + it != forms.end(); ++it) { |
| + if (!password_manager_sync_metrics::IsSyncAccountCredential( |
|
Garrett Casto
2015/06/23 23:42:35
I think that we decided for now that we were going
xunlu
2015/06/25 17:12:15
Done.
|
| + password_view_->GetProfile(), |
| + base::UTF16ToUTF8((*it).username_value), (*it).signon_realm)) { |
| + store->AddLogin(*it); |
| + } |
| + } |
| + return true; |
| +} |
| + |
| +bool PasswordManagerPresenter::RequestToExportPassword() { |
| + if (IsAuthenticationRequired()) { |
| + if (password_manager_util::AuthenticateUser( |
| + password_view_->GetNativeWindow())) |
| + last_authentication_time_ = base::TimeTicks::Now(); |
| + else |
| + return false; |
| + } |
| + return true; |
| +} |
| + |
| void PasswordManagerPresenter::RequestShowPassword(size_t index) { |
| #if !defined(OS_ANDROID) // This is never called on Android. |
| if (index >= password_list_.size()) { |
| @@ -157,6 +186,13 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) { |
| #endif |
| } |
| +ScopedVector<autofill::PasswordForm> |
| +PasswordManagerPresenter::GetAllPasswords() { |
| + ScopedVector<autofill::PasswordForm> retVal = password_list_.Pass(); |
|
Garrett Casto
2015/06/23 23:42:35
Why aren't you just returning password_list_.Pass(
xunlu
2015/06/25 17:12:15
If I just return password_list_.Pass(), I will nee
Garrett Casto
2015/06/26 21:13:48
Got it. What I was actually thinking is that this
xunlu
2015/06/30 23:06:09
Done.
|
| + UpdatePasswordLists(); |
| + return retVal.Pass(); |
| +} |
| + |
| const autofill::PasswordForm* PasswordManagerPresenter::GetPassword( |
| size_t index) { |
| if (index >= password_list_.size()) { |