| 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/command_line.h" | 8 #include "base/command_line.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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 entry->SetString(kUsernameField, saved_password->username_value); | 235 entry->SetString(kUsernameField, saved_password->username_value); |
| 236 if (show_passwords) { | 236 if (show_passwords) { |
| 237 entry->SetString(kPasswordField, saved_password->password_value); | 237 entry->SetString(kPasswordField, saved_password->password_value); |
| 238 } else { | 238 } else { |
| 239 // Use a placeholder value with the same length as the password. | 239 // Use a placeholder value with the same length as the password. |
| 240 entry->SetString( | 240 entry->SetString( |
| 241 kPasswordField, | 241 kPasswordField, |
| 242 base::string16(saved_password->password_value.length(), ' ')); | 242 base::string16(saved_password->password_value.length(), ' ')); |
| 243 } | 243 } |
| 244 const GURL& federation_url = saved_password->federation_url; | 244 if (!saved_password->federation_origin.unique()) { |
| 245 if (!federation_url.is_empty()) { | |
| 246 entry->SetString( | 245 entry->SetString( |
| 247 kFederationField, | 246 kFederationField, |
| 248 l10n_util::GetStringFUTF16(IDS_PASSWORDS_VIA_FEDERATION, | 247 l10n_util::GetStringFUTF16( |
| 249 base::UTF8ToUTF16(federation_url.host()))); | 248 IDS_PASSWORDS_VIA_FEDERATION, |
| 249 base::UTF8ToUTF16(saved_password->federation_origin.host()))); |
| 250 } | 250 } |
| 251 | 251 |
| 252 entries.Append(entry.release()); | 252 entries.Append(entry.release()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 web_ui()->CallJavascriptFunction("PasswordManager.setSavedPasswordsList", | 255 web_ui()->CallJavascriptFunction("PasswordManager.setSavedPasswordsList", |
| 256 entries); | 256 entries); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void PasswordManagerHandler::SetPasswordExceptionList( | 259 void PasswordManagerHandler::SetPasswordExceptionList( |
| 260 const std::vector<scoped_ptr<autofill::PasswordForm>>& | 260 const std::vector<scoped_ptr<autofill::PasswordForm>>& |
| 261 password_exception_list) { | 261 password_exception_list) { |
| 262 base::ListValue entries; | 262 base::ListValue entries; |
| 263 for (const auto& exception : password_exception_list) { | 263 for (const auto& exception : password_exception_list) { |
| 264 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); | 264 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 265 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); | 265 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); |
| 266 entries.Append(entry.release()); | 266 entries.Append(entry.release()); |
| 267 } | 267 } |
| 268 | 268 |
| 269 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", | 269 web_ui()->CallJavascriptFunction("PasswordManager.setPasswordExceptionsList", |
| 270 entries); | 270 entries); |
| 271 } | 271 } |
| 272 | 272 |
| 273 } // namespace options | 273 } // namespace options |
| OLD | NEW |