| 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 841f9c471d7ff12b68bd8c0379b9e51379a9910f..1383f55e1561768769f38cfb12a59870afd0d4e7 100644
|
| --- a/chrome/browser/ui/passwords/password_manager_presenter.cc
|
| +++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
|
| @@ -25,10 +25,12 @@
|
| #include "components/autofill/core/common/password_form.h"
|
| #include "components/browser_sync/browser/profile_sync_service.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 "components/password_manager/sync/browser/password_sync_util.h"
|
| #include "components/prefs/pref_service.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/user_metrics.h"
|
| #include "content/public/browser/web_contents.h"
|
|
|
| @@ -142,20 +144,9 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) {
|
| NOTREACHED();
|
| return;
|
| }
|
| - if (require_reauthentication_ &&
|
| - (base::TimeTicks::Now() - last_authentication_time_) >
|
| - base::TimeDelta::FromSeconds(60)) {
|
| - bool authenticated = true;
|
| -#if defined(OS_WIN)
|
| - authenticated = password_manager_util_win::AuthenticateUser(
|
| - password_view_->GetNativeWindow());
|
| -#elif defined(OS_MACOSX)
|
| - authenticated = password_manager_util_mac::AuthenticateUser();
|
| -#endif
|
| - if (authenticated)
|
| - last_authentication_time_ = base::TimeTicks::Now();
|
| - else
|
| - return;
|
| +
|
| + if (!IsUserAuthenticated()) {
|
| + return;
|
| }
|
|
|
| sync_driver::SyncService* sync_service = nullptr;
|
| @@ -182,6 +173,17 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) {
|
| #endif
|
| }
|
|
|
| +std::vector<scoped_ptr<autofill::PasswordForm>>
|
| +PasswordManagerPresenter::GetAllPasswords() {
|
| + std::vector<scoped_ptr<autofill::PasswordForm>> ret_val;
|
| +
|
| + for (const auto& form : password_list_) {
|
| + ret_val.push_back(make_scoped_ptr(new autofill::PasswordForm(*form)));
|
| + }
|
| +
|
| + return ret_val;
|
| +}
|
| +
|
| const autofill::PasswordForm* PasswordManagerPresenter::GetPassword(
|
| size_t index) {
|
| if (index >= password_list_.size()) {
|
| @@ -221,6 +223,27 @@ void PasswordManagerPresenter::SetPasswordExceptionList() {
|
| password_view_->SetPasswordExceptionList(password_exception_list_);
|
| }
|
|
|
| +bool PasswordManagerPresenter::IsUserAuthenticated() {
|
| +#if defined(OS_ANDROID)
|
| + NOTREACHED();
|
| +#endif
|
| + if (require_reauthentication_ &&
|
| + (base::TimeTicks::Now() - last_authentication_time_) >
|
| + base::TimeDelta::FromSeconds(60)) {
|
| + bool authenticated = true;
|
| +#if defined(OS_WIN)
|
| + authenticated = password_manager_util_win::AuthenticateUser(
|
| + password_view_->GetNativeWindow());
|
| +#elif defined(OS_MACOSX)
|
| + authenticated = password_manager_util_mac::AuthenticateUser();
|
| +#endif
|
| + if (authenticated)
|
| + last_authentication_time_ = base::TimeTicks::Now();
|
| + return authenticated;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| PasswordManagerPresenter::ListPopulater::ListPopulater(
|
| PasswordManagerPresenter* page) : page_(page) {
|
| }
|
|
|