| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 base::FundamentalValue(static_cast<int>(index)), | 220 base::FundamentalValue(static_cast<int>(index)), |
| 221 base::StringValue(password_value)); | 221 base::StringValue(password_value)); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void PasswordManagerHandler::HandleUpdatePasswordLists( | 224 void PasswordManagerHandler::HandleUpdatePasswordLists( |
| 225 const base::ListValue* args) { | 225 const base::ListValue* args) { |
| 226 password_manager_presenter_.UpdatePasswordLists(); | 226 password_manager_presenter_.UpdatePasswordLists(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void PasswordManagerHandler::SetPasswordList( | 229 void PasswordManagerHandler::SetPasswordList( |
| 230 const std::vector<scoped_ptr<autofill::PasswordForm>>& password_list) { | 230 const std::vector<std::unique_ptr<autofill::PasswordForm>>& password_list) { |
| 231 base::ListValue entries; | 231 base::ListValue entries; |
| 232 base::string16 placeholder(base::ASCIIToUTF16(" ")); | 232 base::string16 placeholder(base::ASCIIToUTF16(" ")); |
| 233 for (const auto& saved_password : password_list) { | 233 for (const auto& saved_password : password_list) { |
| 234 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 234 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 235 CopyOriginInfoOfPasswordForm(*saved_password, entry.get()); | 235 CopyOriginInfoOfPasswordForm(*saved_password, entry.get()); |
| 236 | 236 |
| 237 entry->SetString(kUsernameField, saved_password->username_value); | 237 entry->SetString(kUsernameField, saved_password->username_value); |
| 238 // Use a placeholder value with the same length as the password. | 238 // Use a placeholder value with the same length as the password. |
| 239 entry->SetString( | 239 entry->SetString( |
| 240 kPasswordField, | 240 kPasswordField, |
| 241 base::string16(saved_password->password_value.length(), ' ')); | 241 base::string16(saved_password->password_value.length(), ' ')); |
| 242 if (!saved_password->federation_origin.unique()) { | 242 if (!saved_password->federation_origin.unique()) { |
| 243 entry->SetString( | 243 entry->SetString( |
| 244 kFederationField, | 244 kFederationField, |
| 245 l10n_util::GetStringFUTF16( | 245 l10n_util::GetStringFUTF16( |
| 246 IDS_PASSWORDS_VIA_FEDERATION, | 246 IDS_PASSWORDS_VIA_FEDERATION, |
| 247 base::UTF8ToUTF16(saved_password->federation_origin.host()))); | 247 base::UTF8ToUTF16(saved_password->federation_origin.host()))); |
| 248 } | 248 } |
| 249 | 249 |
| 250 entries.Append(entry.release()); | 250 entries.Append(entry.release()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 web_ui()->CallJavascriptFunction("PasswordManager.setSavedPasswordsList", | 253 web_ui()->CallJavascriptFunction("PasswordManager.setSavedPasswordsList", |
| 254 entries); | 254 entries); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void PasswordManagerHandler::SetPasswordExceptionList( | 257 void PasswordManagerHandler::SetPasswordExceptionList( |
| 258 const std::vector<scoped_ptr<autofill::PasswordForm>>& | 258 const std::vector<std::unique_ptr<autofill::PasswordForm>>& |
| 259 password_exception_list) { | 259 password_exception_list) { |
| 260 base::ListValue entries; | 260 base::ListValue entries; |
| 261 for (const auto& exception : password_exception_list) { | 261 for (const auto& exception : password_exception_list) { |
| 262 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 262 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 263 CopyOriginInfoOfPasswordForm(*exception, entry.get()); | 263 CopyOriginInfoOfPasswordForm(*exception, entry.get()); |
| 264 entries.Append(entry.release()); | 264 entries.Append(entry.release()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 267 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
| 268 entries); | 268 entries); |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace options | 271 } // namespace options |
| OLD | NEW |