password_manager_handler.h revision f2477e01787aa58f445919b809d89e252beef54f
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. 4 5#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ 6#define CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ 7 8#include <string> 9#include <vector> 10 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" 15 16namespace options { 17 18// The WebUI based PasswordUIView. Displays passwords in the web ui. 19class PasswordManagerHandler : public OptionsPageUIHandler, 20 public PasswordUIView { 21 public: 22 PasswordManagerHandler(); 23 virtual ~PasswordManagerHandler(); 24 25 // OptionsPageUIHandler implementation. 26 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; 27 virtual void InitializeHandler() OVERRIDE; 28 virtual void RegisterMessages() OVERRIDE; 29 30 // PasswordUIView implementation. 31 virtual Profile* GetProfile() OVERRIDE; 32 virtual void ShowPassword(size_t index, const string16& password_value) 33 OVERRIDE; 34 virtual void SetPasswordList( 35 const ScopedVector<autofill::PasswordForm>& password_list, 36 bool show_passwords) OVERRIDE; 37 virtual void SetPasswordExceptionList( 38 const ScopedVector<autofill::PasswordForm>& password_exception_list) 39 OVERRIDE; 40 41 private: 42 // Clears and then populates the list of passwords and password exceptions. 43 // Called when the JS PasswordManager object is initialized. 44 void HandleUpdatePasswordLists(const ListValue* args); 45 46 // Removes a saved password entry. 47 // |value| the entry index to be removed. 48 void HandleRemoveSavedPassword(const ListValue* args); 49 50 // Removes a saved password exception. 51 // |value| the entry index to be removed. 52 void HandleRemovePasswordException(const ListValue* args); 53 54 // Requests the plain text password for an entry to be revealed. 55 // |index| The index of the entry. 56 void HandleRequestShowPassword(const ListValue* args); 57 58 // User pref for storing accept languages. 59 std::string languages_; 60 61 // The PasswordManagerPresenter object owned by the this view. 62 PasswordManagerPresenter password_manager_presenter_; 63 64 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); 65}; 66 67} // namespace options 68 69#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ 70