| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 base::FundamentalValue(static_cast<int>(index)), | 221 base::FundamentalValue(static_cast<int>(index)), |
| 222 base::StringValue(password_value)); | 222 base::StringValue(password_value)); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void PasswordManagerHandler::HandleUpdatePasswordLists( | 225 void PasswordManagerHandler::HandleUpdatePasswordLists( |
| 226 const base::ListValue* args) { | 226 const base::ListValue* args) { |
| 227 password_manager_presenter_.UpdatePasswordLists(); | 227 password_manager_presenter_.UpdatePasswordLists(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 void PasswordManagerHandler::SetPasswordList( | 230 void PasswordManagerHandler::SetPasswordList( |
| 231 const std::vector<scoped_ptr<autofill::PasswordForm>>& password_list, | 231 const std::vector<scoped_ptr<autofill::PasswordForm>>& password_list) { |
| 232 bool show_passwords) { | |
| 233 base::ListValue entries; | 232 base::ListValue entries; |
| 234 languages_ = GetProfile()->GetPrefs()->GetString(prefs::kAcceptLanguages); | 233 languages_ = GetProfile()->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 235 base::string16 placeholder(base::ASCIIToUTF16(" ")); | 234 base::string16 placeholder(base::ASCIIToUTF16(" ")); |
| 236 for (const auto& saved_password : password_list) { | 235 for (const auto& saved_password : password_list) { |
| 237 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 236 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 238 CopyOriginInfoOfPasswordForm(*saved_password, languages_, entry.get()); | 237 CopyOriginInfoOfPasswordForm(*saved_password, languages_, entry.get()); |
| 239 | 238 |
| 240 entry->SetString(kUsernameField, saved_password->username_value); | 239 entry->SetString(kUsernameField, saved_password->username_value); |
| 241 if (show_passwords) { | 240 // Use a placeholder value with the same length as the password. |
| 242 entry->SetString(kPasswordField, saved_password->password_value); | 241 entry->SetString( |
| 243 } else { | 242 kPasswordField, |
| 244 // Use a placeholder value with the same length as the password. | 243 base::string16(saved_password->password_value.length(), ' ')); |
| 245 entry->SetString( | |
| 246 kPasswordField, | |
| 247 base::string16(saved_password->password_value.length(), ' ')); | |
| 248 } | |
| 249 if (!saved_password->federation_origin.unique()) { | 244 if (!saved_password->federation_origin.unique()) { |
| 250 entry->SetString( | 245 entry->SetString( |
| 251 kFederationField, | 246 kFederationField, |
| 252 l10n_util::GetStringFUTF16( | 247 l10n_util::GetStringFUTF16( |
| 253 IDS_PASSWORDS_VIA_FEDERATION, | 248 IDS_PASSWORDS_VIA_FEDERATION, |
| 254 base::UTF8ToUTF16(saved_password->federation_origin.host()))); | 249 base::UTF8ToUTF16(saved_password->federation_origin.host()))); |
| 255 } | 250 } |
| 256 | 251 |
| 257 entries.Append(entry.release()); | 252 entries.Append(entry.release()); |
| 258 } | 253 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 269 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 264 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 270 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); | 265 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); |
| 271 entries.Append(entry.release()); | 266 entries.Append(entry.release()); |
| 272 } | 267 } |
| 273 | 268 |
| 274 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 269 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
| 275 entries); | 270 entries); |
| 276 } | 271 } |
| 277 | 272 |
| 278 } // namespace options | 273 } // namespace options |
| OLD | NEW |