1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
11 #include "base/prefs/pref_member.h"
12 #include "chrome/browser/ui/passwords/password_manager_presenter.h"
13 #include "chrome/browser/ui/passwords/password_ui_view.h"
14 #include "chrome/browser/ui/webui/options/options_ui.h"
18 // The WebUI based PasswordUIView. Displays passwords in the web ui.
19 class PasswordManagerHandler
: public OptionsPageUIHandler
,
20 public PasswordUIView
{
22 PasswordManagerHandler();
23 ~PasswordManagerHandler() override
;
25 // OptionsPageUIHandler implementation.
26 void GetLocalizedValues(base::DictionaryValue
* localized_strings
) override
;
27 void InitializeHandler() override
;
28 void InitializePage() override
;
29 void RegisterMessages() override
;
31 // PasswordUIView implementation.
32 Profile
* GetProfile() override
;
35 const std::string
& origin_url
,
36 const std::string
& username
,
37 const base::string16
& password_value
) override
;
39 const ScopedVector
<autofill::PasswordForm
>& password_list
,
40 bool show_passwords
) override
;
41 void SetPasswordExceptionList(const ScopedVector
<autofill::PasswordForm
>&
42 password_exception_list
) override
;
43 #if !defined(OS_ANDROID)
44 gfx::NativeWindow
GetNativeWindow() const override
;
47 // Clears and then populates the list of passwords and password exceptions.
48 // Called when the JS PasswordManager object is initialized.
49 void HandleUpdatePasswordLists(const base::ListValue
* args
);
51 // Removes a saved password entry.
52 // |value| the entry index to be removed.
53 void HandleRemoveSavedPassword(const base::ListValue
* args
);
55 // Removes a saved password exception.
56 // |value| the entry index to be removed.
57 void HandleRemovePasswordException(const base::ListValue
* args
);
59 // Requests the plain text password for an entry to be revealed.
60 // |index| The index of the entry.
61 void HandleRequestShowPassword(const base::ListValue
* args
);
63 // User pref for storing accept languages.
64 std::string languages_
;
66 // The PasswordManagerPresenter object owned by the this view.
67 PasswordManagerPresenter password_manager_presenter_
;
69 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler
);
72 } // namespace options
74 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_