OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_OPTIONS2_PASSWORD_MANAGER_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_PASSWORD_MANAGER_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_PASSWORD_MANAGER_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_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 "chrome/browser/password_manager/password_store.h" | 12 #include "chrome/browser/password_manager/password_store.h" |
13 #include "chrome/browser/password_manager/password_store_consumer.h" | 13 #include "chrome/browser/password_manager/password_store_consumer.h" |
14 #include "chrome/browser/prefs/pref_member.h" | 14 #include "chrome/browser/prefs/pref_member.h" |
15 #include "chrome/browser/ui/webui/options2/options_ui2.h" | 15 #include "chrome/browser/ui/webui/options2/options_ui2.h" |
16 | 16 |
| 17 namespace webkit { |
| 18 namespace forms { |
| 19 struct PasswordForm; |
| 20 } |
| 21 } |
| 22 |
17 class PasswordManagerHandler : public OptionsPage2UIHandler, | 23 class PasswordManagerHandler : public OptionsPage2UIHandler, |
18 public PasswordStore::Observer { | 24 public PasswordStore::Observer { |
19 public: | 25 public: |
20 PasswordManagerHandler(); | 26 PasswordManagerHandler(); |
21 virtual ~PasswordManagerHandler(); | 27 virtual ~PasswordManagerHandler(); |
22 | 28 |
23 // OptionsPage2UIHandler implementation. | 29 // OptionsPage2UIHandler implementation. |
24 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; | 30 virtual void GetLocalizedValues(DictionaryValue* localized_strings) OVERRIDE; |
25 virtual void Initialize() OVERRIDE; | 31 virtual void Initialize() OVERRIDE; |
26 virtual void RegisterMessages() OVERRIDE; | 32 virtual void RegisterMessages() OVERRIDE; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 public: | 74 public: |
69 explicit ListPopulater(PasswordManagerHandler* page); | 75 explicit ListPopulater(PasswordManagerHandler* page); |
70 virtual ~ListPopulater(); | 76 virtual ~ListPopulater(); |
71 | 77 |
72 // Send a query to the password store to populate a list. | 78 // Send a query to the password store to populate a list. |
73 virtual void Populate() = 0; | 79 virtual void Populate() = 0; |
74 | 80 |
75 // Send the password store's reply back to the handler. | 81 // Send the password store's reply back to the handler. |
76 virtual void OnPasswordStoreRequestDone( | 82 virtual void OnPasswordStoreRequestDone( |
77 CancelableRequestProvider::Handle handle, | 83 CancelableRequestProvider::Handle handle, |
78 const std::vector<webkit_glue::PasswordForm*>& result) = 0; | 84 const std::vector<webkit::forms::PasswordForm*>& result) = 0; |
79 | 85 |
80 protected: | 86 protected: |
81 PasswordManagerHandler* page_; | 87 PasswordManagerHandler* page_; |
82 CancelableRequestProvider::Handle pending_login_query_; | 88 CancelableRequestProvider::Handle pending_login_query_; |
83 }; | 89 }; |
84 | 90 |
85 // A short class to mediate requests to the password store for passwordlist. | 91 // A short class to mediate requests to the password store for passwordlist. |
86 class PasswordListPopulater : public ListPopulater { | 92 class PasswordListPopulater : public ListPopulater { |
87 public: | 93 public: |
88 explicit PasswordListPopulater(PasswordManagerHandler* page); | 94 explicit PasswordListPopulater(PasswordManagerHandler* page); |
89 | 95 |
90 // Send a query to the password store to populate a password list. | 96 // Send a query to the password store to populate a password list. |
91 virtual void Populate() OVERRIDE; | 97 virtual void Populate() OVERRIDE; |
92 | 98 |
93 // Send the password store's reply back to the handler. | 99 // Send the password store's reply back to the handler. |
94 virtual void OnPasswordStoreRequestDone( | 100 virtual void OnPasswordStoreRequestDone( |
95 CancelableRequestProvider::Handle handle, | 101 CancelableRequestProvider::Handle handle, |
96 const std::vector<webkit_glue::PasswordForm*>& result) OVERRIDE; | 102 const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; |
97 }; | 103 }; |
98 | 104 |
99 // A short class to mediate requests to the password store for exceptions. | 105 // A short class to mediate requests to the password store for exceptions. |
100 class PasswordExceptionListPopulater : public ListPopulater { | 106 class PasswordExceptionListPopulater : public ListPopulater { |
101 public: | 107 public: |
102 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); | 108 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); |
103 | 109 |
104 // Send a query to the password store to populate a passwordException list. | 110 // Send a query to the password store to populate a passwordException list. |
105 virtual void Populate() OVERRIDE; | 111 virtual void Populate() OVERRIDE; |
106 | 112 |
107 // Send the password store's reply back to the handler. | 113 // Send the password store's reply back to the handler. |
108 virtual void OnPasswordStoreRequestDone( | 114 virtual void OnPasswordStoreRequestDone( |
109 CancelableRequestProvider::Handle handle, | 115 CancelableRequestProvider::Handle handle, |
110 const std::vector<webkit_glue::PasswordForm*>& result) OVERRIDE; | 116 const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; |
111 }; | 117 }; |
112 | 118 |
113 // Password store consumer for populating the password list and exceptions. | 119 // Password store consumer for populating the password list and exceptions. |
114 PasswordListPopulater populater_; | 120 PasswordListPopulater populater_; |
115 PasswordExceptionListPopulater exception_populater_; | 121 PasswordExceptionListPopulater exception_populater_; |
116 | 122 |
117 ScopedVector<webkit_glue::PasswordForm> password_list_; | 123 ScopedVector<webkit::forms::PasswordForm> password_list_; |
118 ScopedVector<webkit_glue::PasswordForm> password_exception_list_; | 124 ScopedVector<webkit::forms::PasswordForm> password_exception_list_; |
119 | 125 |
120 // User's pref | 126 // User's pref |
121 std::string languages_; | 127 std::string languages_; |
122 | 128 |
123 // Whether to show stored passwords or not. | 129 // Whether to show stored passwords or not. |
124 BooleanPrefMember show_passwords_; | 130 BooleanPrefMember show_passwords_; |
125 | 131 |
126 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); | 132 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); |
127 }; | 133 }; |
128 | 134 |
129 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_PASSWORD_MANAGER_HANDLER_H_ | 135 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_PASSWORD_MANAGER_HANDLER_H_ |
OLD | NEW |