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 #include "chrome/browser/ui/webui/options/password_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/password_manager_handler.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // If this is the case, initialize on demand. This is a hack. | 188 // If this is the case, initialize on demand. This is a hack. |
189 // TODO(mdm): remove this hack once it is no longer necessary. | 189 // TODO(mdm): remove this hack once it is no longer necessary. |
190 if (show_passwords_.GetPrefName().empty()) | 190 if (show_passwords_.GetPrefName().empty()) |
191 Initialize(); | 191 Initialize(); |
192 | 192 |
193 ListValue entries; | 193 ListValue entries; |
194 bool show_passwords = *show_passwords_; | 194 bool show_passwords = *show_passwords_; |
195 string16 empty; | 195 string16 empty; |
196 for (size_t i = 0; i < password_list_.size(); ++i) { | 196 for (size_t i = 0; i < password_list_.size(); ++i) { |
197 ListValue* entry = new ListValue(); | 197 ListValue* entry = new ListValue(); |
198 entry->Append(new StringValue(net::FormatUrl(password_list_[i]->origin, | 198 entry->Append(base::StringValue::New( |
199 languages_))); | 199 net::FormatUrl(password_list_[i]->origin, languages_))); |
200 entry->Append(new StringValue(password_list_[i]->username_value)); | 200 entry->Append(base::StringValue::New(password_list_[i]->username_value)); |
201 entry->Append(new StringValue( | 201 entry->Append(base::StringValue::New( |
202 show_passwords ? password_list_[i]->password_value : empty)); | 202 show_passwords ? password_list_[i]->password_value : empty)); |
203 entries.Append(entry); | 203 entries.Append(entry); |
204 } | 204 } |
205 | 205 |
206 web_ui_->CallJavascriptFunction("PasswordManager.setSavedPasswordsList", | 206 web_ui_->CallJavascriptFunction("PasswordManager.setSavedPasswordsList", |
207 entries); | 207 entries); |
208 } | 208 } |
209 | 209 |
210 void PasswordManagerHandler::SetPasswordExceptionList() { | 210 void PasswordManagerHandler::SetPasswordExceptionList() { |
211 ListValue entries; | 211 ListValue entries; |
212 for (size_t i = 0; i < password_exception_list_.size(); ++i) { | 212 for (size_t i = 0; i < password_exception_list_.size(); ++i) { |
213 entries.Append(new StringValue( | 213 entries.Append(base::StringValue::New( |
214 net::FormatUrl(password_exception_list_[i]->origin, languages_))); | 214 net::FormatUrl(password_exception_list_[i]->origin, languages_))); |
215 } | 215 } |
216 | 216 |
217 web_ui_->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 217 web_ui_->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
218 entries); | 218 entries); |
219 } | 219 } |
220 | 220 |
221 PasswordManagerHandler::ListPopulater::ListPopulater( | 221 PasswordManagerHandler::ListPopulater::ListPopulater( |
222 PasswordManagerHandler* page) | 222 PasswordManagerHandler* page) |
223 : page_(page), | 223 : page_(page), |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 OnPasswordStoreRequestDone( | 276 OnPasswordStoreRequestDone( |
277 CancelableRequestProvider::Handle handle, | 277 CancelableRequestProvider::Handle handle, |
278 const std::vector<webkit_glue::PasswordForm*>& result) { | 278 const std::vector<webkit_glue::PasswordForm*>& result) { |
279 DCHECK_EQ(pending_login_query_, handle); | 279 DCHECK_EQ(pending_login_query_, handle); |
280 pending_login_query_ = 0; | 280 pending_login_query_ = 0; |
281 page_->password_exception_list_.reset(); | 281 page_->password_exception_list_.reset(); |
282 page_->password_exception_list_.insert(page_->password_exception_list_.end(), | 282 page_->password_exception_list_.insert(page_->password_exception_list_.end(), |
283 result.begin(), result.end()); | 283 result.begin(), result.end()); |
284 page_->SetPasswordExceptionList(); | 284 page_->SetPasswordExceptionList(); |
285 } | 285 } |
OLD | NEW |