| 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 "chrome/browser/api/prefs/pref_member.h" | 12 #include "chrome/browser/api/prefs/pref_member.h" |
| 13 #include "chrome/browser/password_manager/password_store.h" | 13 #include "chrome/browser/password_manager/password_store.h" |
| 14 #include "chrome/browser/password_manager/password_store_consumer.h" | 14 #include "chrome/browser/password_manager/password_store_consumer.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui.h" | 15 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 16 | 16 |
| 17 namespace webkit { | 17 namespace content { |
| 18 namespace forms { | |
| 19 struct PasswordForm; | 18 struct PasswordForm; |
| 20 } | 19 } |
| 21 } | |
| 22 | 20 |
| 23 namespace options { | 21 namespace options { |
| 24 | 22 |
| 25 class PasswordManagerHandler : public OptionsPageUIHandler, | 23 class PasswordManagerHandler : public OptionsPageUIHandler, |
| 26 public PasswordStore::Observer { | 24 public PasswordStore::Observer { |
| 27 public: | 25 public: |
| 28 PasswordManagerHandler(); | 26 PasswordManagerHandler(); |
| 29 virtual ~PasswordManagerHandler(); | 27 virtual ~PasswordManagerHandler(); |
| 30 | 28 |
| 31 // OptionsPageUIHandler implementation. | 29 // OptionsPageUIHandler implementation. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 public: | 74 public: |
| 77 explicit ListPopulater(PasswordManagerHandler* page); | 75 explicit ListPopulater(PasswordManagerHandler* page); |
| 78 virtual ~ListPopulater(); | 76 virtual ~ListPopulater(); |
| 79 | 77 |
| 80 // Send a query to the password store to populate a list. | 78 // Send a query to the password store to populate a list. |
| 81 virtual void Populate() = 0; | 79 virtual void Populate() = 0; |
| 82 | 80 |
| 83 // Send the password store's reply back to the handler. | 81 // Send the password store's reply back to the handler. |
| 84 virtual void OnPasswordStoreRequestDone( | 82 virtual void OnPasswordStoreRequestDone( |
| 85 CancelableRequestProvider::Handle handle, | 83 CancelableRequestProvider::Handle handle, |
| 86 const std::vector<webkit::forms::PasswordForm*>& result) = 0; | 84 const std::vector<content::PasswordForm*>& result) = 0; |
| 87 | 85 |
| 88 protected: | 86 protected: |
| 89 PasswordManagerHandler* page_; | 87 PasswordManagerHandler* page_; |
| 90 CancelableRequestProvider::Handle pending_login_query_; | 88 CancelableRequestProvider::Handle pending_login_query_; |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 // 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. |
| 94 class PasswordListPopulater : public ListPopulater { | 92 class PasswordListPopulater : public ListPopulater { |
| 95 public: | 93 public: |
| 96 explicit PasswordListPopulater(PasswordManagerHandler* page); | 94 explicit PasswordListPopulater(PasswordManagerHandler* page); |
| 97 | 95 |
| 98 // 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. |
| 99 virtual void Populate() OVERRIDE; | 97 virtual void Populate() OVERRIDE; |
| 100 | 98 |
| 101 // Send the password store's reply back to the handler. | 99 // Send the password store's reply back to the handler. |
| 102 virtual void OnPasswordStoreRequestDone( | 100 virtual void OnPasswordStoreRequestDone( |
| 103 CancelableRequestProvider::Handle handle, | 101 CancelableRequestProvider::Handle handle, |
| 104 const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; | 102 const std::vector<content::PasswordForm*>& result) OVERRIDE; |
| 105 }; | 103 }; |
| 106 | 104 |
| 107 // 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. |
| 108 class PasswordExceptionListPopulater : public ListPopulater { | 106 class PasswordExceptionListPopulater : public ListPopulater { |
| 109 public: | 107 public: |
| 110 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); | 108 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); |
| 111 | 109 |
| 112 // 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. |
| 113 virtual void Populate() OVERRIDE; | 111 virtual void Populate() OVERRIDE; |
| 114 | 112 |
| 115 // Send the password store's reply back to the handler. | 113 // Send the password store's reply back to the handler. |
| 116 virtual void OnPasswordStoreRequestDone( | 114 virtual void OnPasswordStoreRequestDone( |
| 117 CancelableRequestProvider::Handle handle, | 115 CancelableRequestProvider::Handle handle, |
| 118 const std::vector<webkit::forms::PasswordForm*>& result) OVERRIDE; | 116 const std::vector<content::PasswordForm*>& result) OVERRIDE; |
| 119 }; | 117 }; |
| 120 | 118 |
| 121 // Password store consumer for populating the password list and exceptions. | 119 // Password store consumer for populating the password list and exceptions. |
| 122 PasswordListPopulater populater_; | 120 PasswordListPopulater populater_; |
| 123 PasswordExceptionListPopulater exception_populater_; | 121 PasswordExceptionListPopulater exception_populater_; |
| 124 | 122 |
| 125 ScopedVector<webkit::forms::PasswordForm> password_list_; | 123 ScopedVector<content::PasswordForm> password_list_; |
| 126 ScopedVector<webkit::forms::PasswordForm> password_exception_list_; | 124 ScopedVector<content::PasswordForm> password_exception_list_; |
| 127 | 125 |
| 128 // User's pref | 126 // User's pref |
| 129 std::string languages_; | 127 std::string languages_; |
| 130 | 128 |
| 131 // Whether to show stored passwords or not. | 129 // Whether to show stored passwords or not. |
| 132 BooleanPrefMember show_passwords_; | 130 BooleanPrefMember show_passwords_; |
| 133 | 131 |
| 134 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); | 132 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); |
| 135 }; | 133 }; |
| 136 | 134 |
| 137 } // namespace options | 135 } // namespace options |
| 138 | 136 |
| 139 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 137 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
| OLD | NEW |