OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
csilv
2011/01/21 02:18:21
bump copyright date
James Hawkins
2011/01/21 02:21:50
Done.
| |
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 #include "chrome/browser/dom_ui/options/password_manager_handler.h" | 5 #include "chrome/browser/dom_ui/options/password_manager_handler.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 ListValue entries; | 146 ListValue entries; |
147 for (size_t i = 0; i < password_exception_list_.size(); ++i) { | 147 for (size_t i = 0; i < password_exception_list_.size(); ++i) { |
148 entries.Append(new StringValue( | 148 entries.Append(new StringValue( |
149 net::FormatUrl(password_exception_list_[i]->origin, languages_))); | 149 net::FormatUrl(password_exception_list_[i]->origin, languages_))); |
150 } | 150 } |
151 | 151 |
152 dom_ui_->CallJavascriptFunction( | 152 dom_ui_->CallJavascriptFunction( |
153 L"PasswordManager.setPasswordExceptionsList", entries); | 153 L"PasswordManager.setPasswordExceptionsList", entries); |
154 } | 154 } |
155 | 155 |
156 PasswordManagerHandler::ListPopulater::ListPopulater( | |
157 PasswordManagerHandler* page) : page_(page), | |
158 pending_login_query_(0) { | |
159 } | |
160 | |
161 PasswordManagerHandler::ListPopulater::~ListPopulater() { | |
162 page_->GetPasswordStore()->CancelLoginsQuery(pending_login_query_); | |
163 } | |
164 | |
165 PasswordManagerHandler::PasswordListPopulater::PasswordListPopulater( | |
166 PasswordManagerHandler* page) : ListPopulater(page) { | |
167 } | |
168 | |
156 void PasswordManagerHandler::PasswordListPopulater::Populate() { | 169 void PasswordManagerHandler::PasswordListPopulater::Populate() { |
157 DCHECK(!pending_login_query_); | 170 DCHECK(!pending_login_query_); |
158 PasswordStore* store = page_->GetPasswordStore(); | 171 PasswordStore* store = page_->GetPasswordStore(); |
159 if (store != NULL) | 172 if (store != NULL) |
160 pending_login_query_ = store->GetAutofillableLogins(this); | 173 pending_login_query_ = store->GetAutofillableLogins(this); |
161 else | 174 else |
162 LOG(ERROR) << "No password store! Cannot display passwords."; | 175 LOG(ERROR) << "No password store! Cannot display passwords."; |
163 } | 176 } |
164 | 177 |
165 void PasswordManagerHandler::PasswordListPopulater:: | 178 void PasswordManagerHandler::PasswordListPopulater:: |
166 OnPasswordStoreRequestDone(int handle, | 179 OnPasswordStoreRequestDone(int handle, |
167 const std::vector<webkit_glue::PasswordForm*>& result) { | 180 const std::vector<webkit_glue::PasswordForm*>& result) { |
168 DCHECK_EQ(pending_login_query_, handle); | 181 DCHECK_EQ(pending_login_query_, handle); |
169 pending_login_query_ = 0; | 182 pending_login_query_ = 0; |
170 page_->password_list_ = result; | 183 page_->password_list_ = result; |
171 page_->SetPasswordList(); | 184 page_->SetPasswordList(); |
172 } | 185 } |
173 | 186 |
187 PasswordManagerHandler::PasswordExceptionListPopulater:: | |
188 PasswordExceptionListPopulater(PasswordManagerHandler* page) | |
189 : ListPopulater(page) { | |
190 } | |
191 | |
174 void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { | 192 void PasswordManagerHandler::PasswordExceptionListPopulater::Populate() { |
175 DCHECK(!pending_login_query_); | 193 DCHECK(!pending_login_query_); |
176 PasswordStore* store = page_->GetPasswordStore(); | 194 PasswordStore* store = page_->GetPasswordStore(); |
177 if (store != NULL) | 195 if (store != NULL) |
178 pending_login_query_ = store->GetBlacklistLogins(this); | 196 pending_login_query_ = store->GetBlacklistLogins(this); |
179 else | 197 else |
180 LOG(ERROR) << "No password store! Cannot display exceptions."; | 198 LOG(ERROR) << "No password store! Cannot display exceptions."; |
181 } | 199 } |
182 | 200 |
183 void PasswordManagerHandler::PasswordExceptionListPopulater:: | 201 void PasswordManagerHandler::PasswordExceptionListPopulater:: |
184 OnPasswordStoreRequestDone(int handle, | 202 OnPasswordStoreRequestDone(int handle, |
185 const std::vector<webkit_glue::PasswordForm*>& result) { | 203 const std::vector<webkit_glue::PasswordForm*>& result) { |
186 DCHECK_EQ(pending_login_query_, handle); | 204 DCHECK_EQ(pending_login_query_, handle); |
187 pending_login_query_ = 0; | 205 pending_login_query_ = 0; |
188 page_->password_exception_list_ = result; | 206 page_->password_exception_list_ = result; |
189 page_->SetPasswordExceptionList(); | 207 page_->SetPasswordExceptionList(); |
190 } | 208 } |
OLD | NEW |