| 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_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/scoped_vector.h" |
| 11 #include "chrome/browser/password_manager/password_store.h" | 12 #include "chrome/browser/password_manager/password_store.h" |
| 12 #include "chrome/browser/ui/webui/options/options_ui.h" | 13 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 13 | 14 |
| 14 class PasswordManagerHandler : public OptionsPageUIHandler, | 15 class PasswordManagerHandler : public OptionsPageUIHandler, |
| 15 public PasswordStore::Observer { | 16 public PasswordStore::Observer { |
| 16 public: | 17 public: |
| 17 PasswordManagerHandler(); | 18 PasswordManagerHandler(); |
| 18 virtual ~PasswordManagerHandler(); | 19 virtual ~PasswordManagerHandler(); |
| 19 | 20 |
| 20 // OptionsPageUIHandler implementation. | 21 // OptionsPageUIHandler implementation. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 class ListPopulater : public PasswordStoreConsumer { | 60 class ListPopulater : public PasswordStoreConsumer { |
| 60 public: | 61 public: |
| 61 explicit ListPopulater(PasswordManagerHandler* page); | 62 explicit ListPopulater(PasswordManagerHandler* page); |
| 62 virtual ~ListPopulater(); | 63 virtual ~ListPopulater(); |
| 63 | 64 |
| 64 // Send a query to the password store to populate a list. | 65 // Send a query to the password store to populate a list. |
| 65 virtual void Populate() = 0; | 66 virtual void Populate() = 0; |
| 66 | 67 |
| 67 // Send the password store's reply back to the handler. | 68 // Send the password store's reply back to the handler. |
| 68 virtual void OnPasswordStoreRequestDone( | 69 virtual void OnPasswordStoreRequestDone( |
| 69 int handle, const std::vector<webkit_glue::PasswordForm*>& result) = 0; | 70 PasswordStore::Handle handle, |
| 71 const std::vector<webkit_glue::PasswordForm*>& result) = 0; |
| 70 | 72 |
| 71 protected: | 73 protected: |
| 72 PasswordManagerHandler* page_; | 74 PasswordManagerHandler* page_; |
| 73 int pending_login_query_; | 75 PasswordStore::Handle pending_login_query_; |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 // A short class to mediate requests to the password store for passwordlist. | 78 // A short class to mediate requests to the password store for passwordlist. |
| 77 class PasswordListPopulater : public ListPopulater { | 79 class PasswordListPopulater : public ListPopulater { |
| 78 public: | 80 public: |
| 79 explicit PasswordListPopulater(PasswordManagerHandler* page); | 81 explicit PasswordListPopulater(PasswordManagerHandler* page); |
| 80 | 82 |
| 81 // 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. |
| 82 virtual void Populate(); | 84 virtual void Populate(); |
| 83 | 85 |
| 84 // Send the password store's reply back to the handler. | 86 // Send the password store's reply back to the handler. |
| 85 virtual void OnPasswordStoreRequestDone( | 87 virtual void OnPasswordStoreRequestDone( |
| 86 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 88 PasswordStore::Handle handle, |
| 89 const std::vector<webkit_glue::PasswordForm*>& result); |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 // A short class to mediate requests to the password store for exceptions. | 92 // A short class to mediate requests to the password store for exceptions. |
| 90 class PasswordExceptionListPopulater : public ListPopulater { | 93 class PasswordExceptionListPopulater : public ListPopulater { |
| 91 public: | 94 public: |
| 92 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); | 95 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); |
| 93 | 96 |
| 94 // Send a query to the password store to populate a passwordException list. | 97 // Send a query to the password store to populate a passwordException list. |
| 95 virtual void Populate(); | 98 virtual void Populate(); |
| 96 | 99 |
| 97 // Send the password store's reply back to the handler. | 100 // Send the password store's reply back to the handler. |
| 98 virtual void OnPasswordStoreRequestDone( | 101 virtual void OnPasswordStoreRequestDone( |
| 99 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 102 PasswordStore::Handle handle, |
| 103 const std::vector<webkit_glue::PasswordForm*>& result); |
| 100 }; | 104 }; |
| 101 | 105 |
| 102 // Password store consumer for populating the password list and exceptions. | 106 // Password store consumer for populating the password list and exceptions. |
| 103 PasswordListPopulater populater_; | 107 PasswordListPopulater populater_; |
| 104 PasswordExceptionListPopulater exception_populater_; | 108 PasswordExceptionListPopulater exception_populater_; |
| 105 | 109 |
| 106 std::vector<webkit_glue::PasswordForm*> password_list_; | 110 ScopedVector<webkit_glue::PasswordForm> password_list_; |
| 107 std::vector<webkit_glue::PasswordForm*> password_exception_list_; | 111 ScopedVector<webkit_glue::PasswordForm> password_exception_list_; |
| 108 | 112 |
| 109 // User's pref | 113 // User's pref |
| 110 std::string languages_; | 114 std::string languages_; |
| 111 | 115 |
| 112 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); | 116 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ | 119 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ |
| OLD | NEW |