OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
| 12 #include "base/prefs/public/pref_observer.h" |
12 #include "chrome/browser/api/prefs/pref_member.h" | 13 #include "chrome/browser/api/prefs/pref_member.h" |
13 #include "chrome/browser/password_manager/password_store.h" | 14 #include "chrome/browser/password_manager/password_store.h" |
14 #include "chrome/browser/password_manager/password_store_consumer.h" | 15 #include "chrome/browser/password_manager/password_store_consumer.h" |
15 #include "chrome/browser/ui/webui/options/options_ui.h" | 16 #include "chrome/browser/ui/webui/options/options_ui.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 struct PasswordForm; | 19 struct PasswordForm; |
19 } | 20 } |
20 | 21 |
21 namespace options { | 22 namespace options { |
22 | 23 |
23 class PasswordManagerHandler : public OptionsPageUIHandler, | 24 class PasswordManagerHandler : public OptionsPageUIHandler, |
24 public PasswordStore::Observer { | 25 public PasswordStore::Observer, |
| 26 public PrefObserver { |
25 public: | 27 public: |
26 PasswordManagerHandler(); | 28 PasswordManagerHandler(); |
27 virtual ~PasswordManagerHandler(); | 29 virtual ~PasswordManagerHandler(); |
28 | 30 |
29 // OptionsPageUIHandler implementation. | 31 // OptionsPageUIHandler implementation. |
30 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 32 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
31 virtual void InitializeHandler() OVERRIDE; | 33 virtual void InitializeHandler() OVERRIDE; |
32 virtual void RegisterMessages() OVERRIDE; | 34 virtual void RegisterMessages() OVERRIDE; |
33 | 35 |
34 // PasswordStore::Observer implementation. | 36 // PasswordStore::Observer implementation. |
35 virtual void OnLoginsChanged() OVERRIDE; | 37 virtual void OnLoginsChanged() OVERRIDE; |
36 | 38 |
37 // content::NotificationObserver implementation. | 39 // PrefObserver implementation. |
38 virtual void Observe(int type, | 40 virtual void OnPreferenceChanged(PrefServiceBase* service, |
39 const content::NotificationSource& source, | 41 const std::string& pref_name) OVERRIDE; |
40 const content::NotificationDetails& details) OVERRIDE; | |
41 | 42 |
42 private: | 43 private: |
43 // The password store associated with the currently active profile. | 44 // The password store associated with the currently active profile. |
44 PasswordStore* GetPasswordStore(); | 45 PasswordStore* GetPasswordStore(); |
45 | 46 |
46 // Called when the JS PasswordManager object is initialized. | 47 // Called when the JS PasswordManager object is initialized. |
47 void UpdatePasswordLists(const ListValue* args); | 48 void UpdatePasswordLists(const ListValue* args); |
48 | 49 |
49 // Remove an entry. | 50 // Remove an entry. |
50 // @param value the entry index to be removed. | 51 // @param value the entry index to be removed. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 129 |
129 // Whether to show stored passwords or not. | 130 // Whether to show stored passwords or not. |
130 BooleanPrefMember show_passwords_; | 131 BooleanPrefMember show_passwords_; |
131 | 132 |
132 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); | 133 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); |
133 }; | 134 }; |
134 | 135 |
135 } // namespace options | 136 } // namespace options |
136 | 137 |
137 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 138 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
OLD | NEW |