Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1165)

Side by Side Diff: chrome/browser/ui/webui/options/password_manager_handler.h

Issue 6646051: Fix DCHECK, memory leak, and refactor PasswordStore to use CancelableRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try works all platforms now. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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: 16 public:
16 PasswordManagerHandler(); 17 PasswordManagerHandler();
17 virtual ~PasswordManagerHandler(); 18 virtual ~PasswordManagerHandler();
18 19
19 // OptionsPageUIHandler implementation. 20 // OptionsPageUIHandler implementation.
20 virtual void GetLocalizedValues(DictionaryValue* localized_strings); 21 virtual void GetLocalizedValues(DictionaryValue* localized_strings);
(...skipping 29 matching lines...) Expand all
50 51
51 // Sets the password and exception list contents to the given data. 52 // Sets the password and exception list contents to the given data.
52 // We take ownership of the PasswordForms in the vector. 53 // We take ownership of the PasswordForms in the vector.
53 void SetPasswordList(); 54 void SetPasswordList();
54 void SetPasswordExceptionList(); 55 void SetPasswordExceptionList();
55 56
56 // A short class to mediate requests to the password store. 57 // A short class to mediate requests to the password store.
57 class ListPopulater : public PasswordStoreConsumer { 58 class ListPopulater : public PasswordStoreConsumer {
58 public: 59 public:
59 explicit ListPopulater(PasswordManagerHandler* page); 60 explicit ListPopulater(PasswordManagerHandler* page);
60 virtual ~ListPopulater(); 61 virtual ~ListPopulater() {}
James Hawkins 2011/03/16 22:39:35 Please keep implementations in the source file.
Sheridan Rawlins 2011/03/20 08:13:11 Done.
61 62
62 // Send a query to the password store to populate a list. 63 // Send a query to the password store to populate a list.
63 virtual void Populate() = 0; 64 virtual void Populate() = 0;
64 65
65 // Send the password store's reply back to the handler. 66 // Send the password store's reply back to the handler.
66 virtual void OnPasswordStoreRequestDone( 67 virtual void OnPasswordStoreRequestDone(
67 int handle, const std::vector<webkit_glue::PasswordForm*>& result) = 0; 68 PasswordStore::Handle handle,
69 const std::vector<webkit_glue::PasswordForm*>& result) = 0;
68 70
69 protected: 71 protected:
70 PasswordManagerHandler* page_; 72 PasswordManagerHandler* page_;
71 int pending_login_query_; 73 int pending_login_query_;
72 }; 74 };
73 75
74 // 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.
75 class PasswordListPopulater : public ListPopulater { 77 class PasswordListPopulater : public ListPopulater {
76 public: 78 public:
77 explicit PasswordListPopulater(PasswordManagerHandler* page); 79 explicit PasswordListPopulater(PasswordManagerHandler* page);
78 80
79 // Send a query to the password store to populate a password list. 81 // Send a query to the password store to populate a password list.
80 virtual void Populate(); 82 virtual void Populate();
81 83
82 // Send the password store's reply back to the handler. 84 // Send the password store's reply back to the handler.
83 virtual void OnPasswordStoreRequestDone( 85 virtual void OnPasswordStoreRequestDone(
84 int handle, const std::vector<webkit_glue::PasswordForm*>& result); 86 PasswordStore::Handle handle,
87 const std::vector<webkit_glue::PasswordForm*>& result);
85 }; 88 };
86 89
87 // A short class to mediate requests to the password store for exceptions. 90 // A short class to mediate requests to the password store for exceptions.
88 class PasswordExceptionListPopulater : public ListPopulater { 91 class PasswordExceptionListPopulater : public ListPopulater {
89 public: 92 public:
90 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page); 93 explicit PasswordExceptionListPopulater(PasswordManagerHandler* page);
91 94
92 // Send a query to the password store to populate a passwordException list. 95 // Send a query to the password store to populate a passwordException list.
93 virtual void Populate(); 96 virtual void Populate();
94 97
95 // Send the password store's reply back to the handler. 98 // Send the password store's reply back to the handler.
96 virtual void OnPasswordStoreRequestDone( 99 virtual void OnPasswordStoreRequestDone(
97 int handle, const std::vector<webkit_glue::PasswordForm*>& result); 100 PasswordStore::Handle handle,
101 const std::vector<webkit_glue::PasswordForm*>& result);
98 }; 102 };
99 103
100 // Password store consumer for populating the password list and exceptions. 104 // Password store consumer for populating the password list and exceptions.
101 PasswordListPopulater populater_; 105 PasswordListPopulater populater_;
102 PasswordExceptionListPopulater exception_populater_; 106 PasswordExceptionListPopulater exception_populater_;
103 107
104 std::vector<webkit_glue::PasswordForm*> password_list_; 108 ScopedVector<webkit_glue::PasswordForm> password_list_;
105 std::vector<webkit_glue::PasswordForm*> password_exception_list_; 109 ScopedVector<webkit_glue::PasswordForm> password_exception_list_;
106 110
107 // User's pref 111 // User's pref
108 std::string languages_; 112 std::string languages_;
109 113
110 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler); 114 DISALLOW_COPY_AND_ASSIGN(PasswordManagerHandler);
111 }; 115 };
112 116
113 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_ 117 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_PASSWORD_MANAGER_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698