Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_PASSWORDS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PASSWORDS_HANDLER_H_ |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | 7 |
| 10 #include <string> | 8 #include <string> |
| 11 #include <vector> | 9 #include <vector> |
| 12 | 10 |
| 13 #include "base/macros.h" | 11 #include "base/macros.h" |
| 14 #include "base/prefs/pref_member.h" | |
| 15 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 16 #include "chrome/browser/ui/passwords/password_manager_presenter.h" | 13 #include "chrome/browser/ui/passwords/password_manager_presenter.h" |
| 17 #include "chrome/browser/ui/passwords/password_ui_view.h" | 14 #include "chrome/browser/ui/passwords/password_ui_view.h" |
| 18 #include "chrome/browser/ui/webui/options/options_ui.h" | 15 #include "chrome/browser/ui/webui/settings/md_settings_ui.h" |
| 19 | 16 |
| 20 namespace options { | 17 namespace settings { |
| 21 | 18 |
| 22 // The WebUI based PasswordUIView. Displays passwords in the web ui. | 19 // The WebUI based PasswordUIView. Displays passwords in the web ui. |
| 23 class PasswordManagerHandler : public OptionsPageUIHandler, | 20 class PasswordsHandler : public SettingsPageUIHandler, public PasswordUIView { |
| 24 public PasswordUIView { | |
| 25 public: | 21 public: |
| 26 PasswordManagerHandler(); | 22 PasswordsHandler(); |
| 27 ~PasswordManagerHandler() override; | 23 ~PasswordsHandler() override; |
| 28 | 24 |
| 29 // OptionsPageUIHandler implementation. | 25 // SettingsPageUIHandler implementation. |
| 30 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | |
| 31 void InitializeHandler() override; | |
| 32 void RegisterMessages() override; | 26 void RegisterMessages() override; |
| 33 | 27 |
| 34 // PasswordUIView implementation. | 28 // PasswordUIView implementation. |
| 35 Profile* GetProfile() override; | 29 Profile* GetProfile() override; |
| 36 void ShowPassword( | 30 void ShowPassword(size_t index, |
| 37 size_t index, | 31 const std::string& origin_url, |
| 38 const std::string& origin_url, | 32 const std::string& username, |
| 39 const std::string& username, | 33 const base::string16& password_value) override; |
| 40 const base::string16& password_value) override; | |
| 41 void SetPasswordList( | 34 void SetPasswordList( |
| 42 const std::vector<scoped_ptr<autofill::PasswordForm>>& password_list, | 35 const std::vector<scoped_ptr<autofill::PasswordForm>>& password_list, |
| 43 bool show_passwords) override; | 36 bool show_passwords) override; |
| 44 void SetPasswordExceptionList( | 37 void SetPasswordExceptionList( |
| 45 const std::vector<scoped_ptr<autofill::PasswordForm>>& | 38 const std::vector<scoped_ptr<autofill::PasswordForm>>& |
| 46 password_exception_list) override; | 39 password_exception_list) override; |
| 47 #if !defined(OS_ANDROID) | 40 #if !defined(OS_ANDROID) |
|
michaelpg
2016/01/22 20:54:17
ditto
| |
| 48 gfx::NativeWindow GetNativeWindow() const override; | 41 gfx::NativeWindow GetNativeWindow() const override; |
| 49 #endif | 42 #endif |
| 43 | |
| 50 private: | 44 private: |
| 51 // Clears and then populates the list of passwords and password exceptions. | 45 // Clears and then populates the list of passwords and password exceptions. |
| 52 // Called when the JS PasswordManager object is initialized. | 46 // Called when the JS PasswordManager object is initialized. |
| 53 void HandleUpdatePasswordLists(const base::ListValue* args); | 47 void HandleUpdatePasswordLists(const base::ListValue* args); |
| 54 | 48 |
| 55 // Removes a saved password entry. | 49 // Removes a saved password entry. |
| 56 // |value| the entry index to be removed. | 50 // |value| the entry index to be removed. |
| 57 void HandleRemoveSavedPassword(const base::ListValue* args); | 51 void HandleRemoveSavedPassword(const base::ListValue* args); |
| 58 | 52 |
| 59 // Removes a saved password exception. | 53 // Removes a saved password exception. |
| 60 // |value| the entry index to be removed. | 54 // |value| the entry index to be removed. |
| 61 void HandleRemovePasswordException(const base::ListValue* args); | 55 void HandleRemovePasswordException(const base::ListValue* args); |
| 62 | 56 |
| 63 // Requests the plain text password for an entry to be revealed. | 57 // Requests the plain text password for an entry to be revealed. |
| 64 // |index| The index of the entry. | 58 // |index| The index of the entry. |
| 65 void HandleRequestShowPassword(const base::ListValue* args); | 59 void HandleRequestShowPassword(const base::ListValue* args); |
| 66 | 60 |
| 67 // User pref for storing accept languages. | 61 // User pref for storing accept languages. |
| 68 std::string languages_; | 62 std::string languages_; |
| 69 | 63 |
| 70 // The PasswordManagerPresenter object owned by the this view. | 64 // The PasswordManagerPresenter object owned by the this view. |
| 71 PasswordManagerPresenter password_manager_presenter_; | 65 PasswordManagerPresenter password_manager_presenter_; |
| 72 | 66 |
| 73 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); | 67 DISALLOW_COPY_AND_ASSIGN(PasswordsHandler); |
| 74 }; | 68 }; |
| 75 | 69 |
| 76 } // namespace options | 70 } // namespace settings |
| 77 | 71 |
| 78 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 72 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PASSWORDS_HANDLER_H_ |
| OLD | NEW |