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