OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DOM_UI_OPTIONS_PASSWORDS_EXCEPTIONS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
6 #define CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORDS_EXCEPTIONS_HANDLER_H_ | 6 #define CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/browser/dom_ui/options/options_ui.h" | 11 #include "chrome/browser/dom_ui/options/options_ui.h" |
12 #include "chrome/browser/password_manager/password_store.h" | 12 #include "chrome/browser/password_manager/password_store.h" |
13 | 13 |
14 class PasswordsExceptionsHandler : public OptionsPageUIHandler { | 14 class PasswordManagerHandler : public OptionsPageUIHandler { |
15 public: | 15 public: |
16 PasswordsExceptionsHandler(); | 16 PasswordManagerHandler(); |
17 virtual ~PasswordsExceptionsHandler(); | 17 virtual ~PasswordManagerHandler(); |
18 | 18 |
19 // OptionsUIHandler implementation. | 19 // OptionsUIHandler implementation. |
20 virtual void GetLocalizedValues(DictionaryValue* localized_strings); | 20 virtual void GetLocalizedValues(DictionaryValue* localized_strings); |
21 | 21 |
22 virtual void Initialize(); | 22 virtual void Initialize(); |
23 | 23 |
24 virtual void RegisterMessages(); | 24 virtual void RegisterMessages(); |
25 | 25 |
26 private: | 26 private: |
27 // The password store associated with the currently active profile. | 27 // The password store associated with the currently active profile. |
(...skipping 21 matching lines...) Expand all Loading... |
49 void ShowSelectedPassword(const ListValue* args); | 49 void ShowSelectedPassword(const ListValue* args); |
50 | 50 |
51 // Sets the password and exception list contents to the given data. | 51 // Sets the password and exception list contents to the given data. |
52 // We take ownership of the PasswordForms in the vector. | 52 // We take ownership of the PasswordForms in the vector. |
53 void SetPasswordList(); | 53 void SetPasswordList(); |
54 void SetPasswordExceptionList(); | 54 void SetPasswordExceptionList(); |
55 | 55 |
56 // A short class to mediate requests to the password store. | 56 // A short class to mediate requests to the password store. |
57 class ListPopulater : public PasswordStoreConsumer { | 57 class ListPopulater : public PasswordStoreConsumer { |
58 public: | 58 public: |
59 explicit ListPopulater(PasswordsExceptionsHandler* page) | 59 explicit ListPopulater(PasswordManagerHandler* page) |
60 : page_(page), | 60 : page_(page), |
61 pending_login_query_(0) { | 61 pending_login_query_(0) { |
62 } | 62 } |
63 | 63 |
64 // Send a query to the password store to populate a list. | 64 // Send a query to the password store to populate a list. |
65 virtual void Populate() = 0; | 65 virtual void Populate() = 0; |
66 | 66 |
67 // Send the password store's reply back to the handler. | 67 // Send the password store's reply back to the handler. |
68 virtual void OnPasswordStoreRequestDone( | 68 virtual void OnPasswordStoreRequestDone( |
69 int handle, const std::vector<webkit_glue::PasswordForm*>& result) = 0; | 69 int handle, const std::vector<webkit_glue::PasswordForm*>& result) = 0; |
70 | 70 |
71 protected: | 71 protected: |
72 PasswordsExceptionsHandler* page_; | 72 PasswordManagerHandler* page_; |
73 int pending_login_query_; | 73 int pending_login_query_; |
74 }; | 74 }; |
75 | 75 |
76 // A short class to mediate requests to the password store for passwordlist. | 76 // A short class to mediate requests to the password store for passwordlist. |
77 class PasswordListPopulater : public ListPopulater { | 77 class PasswordListPopulater : public ListPopulater { |
78 public: | 78 public: |
79 explicit PasswordListPopulater(PasswordsExceptionsHandler* page) | 79 explicit PasswordListPopulater(PasswordManagerHandler* page) |
80 : ListPopulater(page) { | 80 : ListPopulater(page) { |
81 } | 81 } |
82 | 82 |
83 // Send a query to the password store to populate a password list. | 83 // Send a query to the password store to populate a password list. |
84 virtual void Populate(); | 84 virtual void Populate(); |
85 | 85 |
86 // Send the password store's reply back to the handler. | 86 // Send the password store's reply back to the handler. |
87 virtual void OnPasswordStoreRequestDone( | 87 virtual void OnPasswordStoreRequestDone( |
88 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 88 int handle, const std::vector<webkit_glue::PasswordForm*>& result); |
89 }; | 89 }; |
90 | 90 |
91 // A short class to mediate requests to the password store for exceptions. | 91 // A short class to mediate requests to the password store for exceptions. |
92 class PasswordExceptionListPopulater : public ListPopulater { | 92 class PasswordExceptionListPopulater : public ListPopulater { |
93 public: | 93 public: |
94 explicit PasswordExceptionListPopulater( | 94 explicit PasswordExceptionListPopulater( |
95 PasswordsExceptionsHandler* page) : ListPopulater(page) { | 95 PasswordManagerHandler* page) : ListPopulater(page) { |
96 } | 96 } |
97 | 97 |
98 // Send a query to the password store to populate a passwordException list. | 98 // Send a query to the password store to populate a passwordException list. |
99 virtual void Populate(); | 99 virtual void Populate(); |
100 | 100 |
101 // Send the password store's reply back to the handler. | 101 // Send the password store's reply back to the handler. |
102 virtual void OnPasswordStoreRequestDone( | 102 virtual void OnPasswordStoreRequestDone( |
103 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 103 int handle, const std::vector<webkit_glue::PasswordForm*>& result); |
104 }; | 104 }; |
105 | 105 |
106 // Password store consumer for populating the password list and exceptions. | 106 // Password store consumer for populating the password list and exceptions. |
107 PasswordListPopulater populater_; | 107 PasswordListPopulater populater_; |
108 PasswordExceptionListPopulater exception_populater_; | 108 PasswordExceptionListPopulater exception_populater_; |
109 | 109 |
110 std::vector<webkit_glue::PasswordForm*> password_list_; | 110 std::vector<webkit_glue::PasswordForm*> password_list_; |
111 std::vector<webkit_glue::PasswordForm*> password_exception_list_; | 111 std::vector<webkit_glue::PasswordForm*> password_exception_list_; |
112 | 112 |
113 // User's pref | 113 // User's pref |
114 std::string languages_; | 114 std::string languages_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(PasswordsExceptionsHandler); | 116 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); |
117 }; | 117 }; |
118 | 118 |
119 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORDS_EXCEPTIONS_HANDLER_H_ | 119 #endif // CHROME_BROWSER_DOM_UI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
OLD | NEW |