Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Side by Side Diff: chrome/browser/ui/webui/options/password_manager_handler.h

Issue 9814030: get rid of old options pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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/memory/scoped_vector.h"
12 #include "chrome/browser/password_manager/password_store.h"
13 #include "chrome/browser/password_manager/password_store_consumer.h"
14 #include "chrome/browser/prefs/pref_member.h"
15 #include "chrome/browser/ui/webui/options/options_ui.h"
16
17 class PasswordManagerHandler : public OptionsPageUIHandler,
18 public PasswordStore::Observer {
19 public:
20 PasswordManagerHandler();
21 virtual ~PasswordManagerHandler();
22
23 // OptionsPageUIHandler implementation.
24 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE;
25 virtual void InitializeHandler() OVERRIDE;
26 virtual void RegisterMessages() OVERRIDE;
27
28 // PasswordStore::Observer implementation.
29 virtual void OnLoginsChanged() OVERRIDE;
30
31 // content::NotificationObserver implementation.
32 virtual void Observe(int type,
33 const content::NotificationSource& source,
34 const content::NotificationDetails& details) OVERRIDE;
35
36 private:
37 // The password store associated with the currently active profile.
38 PasswordStore* GetPasswordStore();
39
40 // Called when the JS PasswordManager object is initialized.
41 void UpdatePasswordLists(const ListValue* args);
42
43 // Remove an entry.
44 // @param value the entry index to be removed.
45 void RemoveSavedPassword(const ListValue* args);
46
47 // Remove an password exception.
48 // @param value the entry index to be removed.
49 void RemovePasswordException(const ListValue* args);
50
51 // Remove all saved passwords
52 void RemoveAllSavedPasswords(const ListValue* args);
53
54 // Remove All password exceptions
55 void RemoveAllPasswordExceptions(const ListValue* args);
56
57 // Get password value for the selected entry.
58 // @param value the selected entry index.
59 void ShowSelectedPassword(const ListValue* args);
60
61 // Sets the password and exception list contents to the given data.
62 // We take ownership of the PasswordForms in the vector.
63 void SetPasswordList();
64 void SetPasswordExceptionList();
65
66 // A short class to mediate requests to the password store.
67 class ListPopulater : public PasswordStoreConsumer {
68 public:
69 explicit ListPopulater(PasswordManagerHandler* page);
70 virtual ~ListPopulater();
71
72 // Send a query to the password store to populate a list.
73 virtual void Populate() = 0;
74
75 // Send the password store's reply back to the handler.
76 virtual void OnPasswordStoreRequestDone(
77 CancelableRequestProvider::Handle handle,
78 const std::vector<webkit::forms::PasswordForm*>& result) = 0;
79
80 protected:
81 PasswordManagerHandler* page_;
82 CancelableRequestProvider::Handle pending_login_query_;
83 };
84
85 // A short class to mediate requests to the password store for passwordlist.
86 class PasswordListPopulater : public ListPopulater {
87 public:
88 explicit PasswordListPopulater(PasswordManagerHandler* page);
89
90 // Send a query to the password store to populate a password list.
91 virtual void Populate() OVERRIDE;
92
93 // Send the password store's reply back to the handler.
94 virtual void OnPasswordStoreRequestDone(
95 CancelableRequestProvider::Handle handle,
96 const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE;
97 };
98
99 // A short class to mediate requests to the password store for exceptions.
100 class PasswordExceptionListPopulater : public ListPopulater {
101 public:
102 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page);
103
104 // Send a query to the password store to populate a passwordException list.
105 virtual void Populate() OVERRIDE;
106
107 // Send the password store's reply back to the handler.
108 virtual void OnPasswordStoreRequestDone(
109 CancelableRequestProvider::Handle handle,
110 const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE;
111 };
112
113 // Password store consumer for populating the password list and exceptions.
114 PasswordListPopulater populater_;
115 PasswordExceptionListPopulater exception_populater_;
116
117 ScopedVector<webkit::forms::PasswordForm> password_list_;
118 ScopedVector<webkit::forms::PasswordForm> password_exception_list_;
119
120 // User's pref
121 std::string languages_;
122
123 // Whether to show stored passwords or not.
124 BooleanPrefMember show_passwords_;
125
126 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler);
127 };
128
129 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698