| Index: chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
|
| diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
|
| index d762a4d1ba3820be0e3f5c82c863ac36eb38299b..8b1927999ae5a7ec588fe0dc130c9c06654b146d 100644
|
| --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
|
| +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
|
| @@ -6,6 +6,8 @@
|
|
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "build/build_config.h"
|
| +#include "chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h"
|
| +#include "chrome/browser/extensions/api/passwords_private/passwords_private_event_router_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -41,20 +43,18 @@ PasswordsPrivateDelegateImpl::PasswordsPrivateDelegateImpl(Profile* profile)
|
|
|
| PasswordsPrivateDelegateImpl::~PasswordsPrivateDelegateImpl() {}
|
|
|
| -void PasswordsPrivateDelegateImpl::AddObserver(Observer* observer) {
|
| - observers_.AddObserver(observer);
|
| -
|
| - // Send the current cached lists to the new observer.
|
| - ExecuteFunction(base::Bind(
|
| - &PasswordsPrivateDelegateImpl::SendSavedPasswordsList,
|
| - base::Unretained(this)));
|
| - ExecuteFunction(base::Bind(
|
| - &PasswordsPrivateDelegateImpl::SendPasswordExceptionsList,
|
| - base::Unretained(this)));
|
| +void PasswordsPrivateDelegateImpl::SendSavedPasswordsList() {
|
| + PasswordsPrivateEventRouter* router =
|
| + PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
|
| + if (router)
|
| + router->OnSavedPasswordsListChanged(current_entries_);
|
| }
|
|
|
| -void PasswordsPrivateDelegateImpl::RemoveObserver(Observer* observer) {
|
| - observers_.RemoveObserver(observer);
|
| +void PasswordsPrivateDelegateImpl::SendPasswordExceptionsList() {
|
| + PasswordsPrivateEventRouter* router =
|
| + PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
|
| + if (router)
|
| + router->OnPasswordExceptionsListChanged(current_exceptions_);
|
| }
|
|
|
| void PasswordsPrivateDelegateImpl::RemoveSavedPassword(
|
| @@ -139,10 +139,12 @@ void PasswordsPrivateDelegateImpl::ShowPassword(
|
| const std::string& origin_url,
|
| const std::string& username,
|
| const base::string16& password_value) {
|
| - FOR_EACH_OBSERVER(
|
| - Observer, observers_,
|
| - OnPlaintextPasswordFetched(origin_url, username,
|
| - base::UTF16ToUTF8(password_value)));
|
| + PasswordsPrivateEventRouter* router =
|
| + PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
|
| + if (router) {
|
| + router->OnPlaintextPasswordFetched(origin_url, username,
|
| + base::UTF16ToUTF8(password_value));
|
| + }
|
| }
|
|
|
| void PasswordsPrivateDelegateImpl::SetPasswordList(
|
| @@ -181,11 +183,6 @@ void PasswordsPrivateDelegateImpl::SetPasswordList(
|
| InitializeIfNecessary();
|
| }
|
|
|
| -void PasswordsPrivateDelegateImpl::SendSavedPasswordsList() {
|
| - FOR_EACH_OBSERVER(Observer, observers_,
|
| - OnSavedPasswordsListChanged(current_entries_));
|
| -}
|
| -
|
| void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
|
| const std::vector<scoped_ptr<autofill::PasswordForm>>&
|
| password_exception_list) {
|
| @@ -211,12 +208,6 @@ void PasswordsPrivateDelegateImpl::SetPasswordExceptionList(
|
| InitializeIfNecessary();
|
| }
|
|
|
| -void PasswordsPrivateDelegateImpl::SendPasswordExceptionsList() {
|
| - FOR_EACH_OBSERVER(
|
| - Observer, observers_,
|
| - Observer::OnPasswordExceptionsListChanged(current_exceptions_));
|
| -}
|
| -
|
| #if !defined(OS_ANDROID)
|
| gfx::NativeWindow PasswordsPrivateDelegateImpl::GetNativeWindow() const {
|
| DCHECK(web_contents_);
|
|
|