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..cd884fa047def18cef42ab88f8da320a242a1f26 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,20 +123,28 @@ void PasswordManagerPresenter::RemovePasswordException(size_t index) { | 
| base::UserMetricsAction("PasswordManager_RemovePasswordException")); | 
| } | 
| +bool PasswordManagerPresenter::RequestToExportPassword() { | 
| 
 
vabr (Chromium)
2015/07/07 12:58:05
This method now adds nothing to calling IsUserAuth
 
xunlu
2015/07/07 18:42:47
Done.
 
 | 
| +#if defined(OS_ANDROID) | 
| + NOTREACHED(); | 
| + return false; | 
| +#else | 
| + return IsUserAuthenticated(); | 
| +#endif | 
| +} | 
| + | 
| void PasswordManagerPresenter::RequestShowPassword(size_t index) { | 
| -#if !defined(OS_ANDROID) // This is never called on Android. | 
| +#if defined(OS_ANDROID) | 
| + NOTREACHED(); | 
| +#else | 
| if (index >= password_list_.size()) { | 
| // |index| out of bounds might come from a compromised renderer, don't let | 
| // it crash the browser. http://crbug.com/362054 | 
| NOTREACHED(); | 
| return; | 
| } | 
| - if (IsAuthenticationRequired()) { | 
| - if (password_manager_util::AuthenticateUser( | 
| - password_view_->GetNativeWindow())) | 
| - last_authentication_time_ = base::TimeTicks::Now(); | 
| - else | 
| - return; | 
| + | 
| + if (!IsUserAuthenticated()) { | 
| + return; | 
| } | 
| if (password_manager_sync_metrics::IsSyncAccountCredential( | 
| @@ -157,6 +166,17 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) { | 
| #endif | 
| } | 
| +ScopedVector<autofill::PasswordForm> | 
| +PasswordManagerPresenter::GetAllPasswords() { | 
| + ScopedVector<autofill::PasswordForm> ret_val; | 
| + | 
| + for (const autofill::PasswordForm* form : password_list_.get()) { | 
| + ret_val.push_back(new autofill::PasswordForm(*form)); | 
| + } | 
| + | 
| + return ret_val.Pass(); | 
| +} | 
| + | 
| const autofill::PasswordForm* PasswordManagerPresenter::GetPassword( | 
| size_t index) { | 
| if (index >= password_list_.size()) { | 
| @@ -202,6 +222,22 @@ bool PasswordManagerPresenter::IsAuthenticationRequired() { | 
| (base::TimeTicks::Now() - last_authentication_time_) > delta; | 
| } | 
| +bool PasswordManagerPresenter::IsUserAuthenticated() { | 
| +#if defined(OS_ANDROID) | 
| + NOTREACHED(); | 
| + return false; | 
| +#else | 
| + if (IsAuthenticationRequired()) { | 
| + if (password_manager_util::AuthenticateUser( | 
| + password_view_->GetNativeWindow())) | 
| + last_authentication_time_ = base::TimeTicks::Now(); | 
| + else | 
| + return false; | 
| + } | 
| + return true; | 
| +#endif | 
| +} | 
| + | 
| PasswordManagerPresenter::ListPopulater::ListPopulater( | 
| PasswordManagerPresenter* page) : page_(page) { | 
| } |