| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 entry->SetString(kUsernameField, saved_password->username_value); | 233 entry->SetString(kUsernameField, saved_password->username_value); |
| 234 if (show_passwords) { | 234 if (show_passwords) { |
| 235 entry->SetString(kPasswordField, saved_password->password_value); | 235 entry->SetString(kPasswordField, saved_password->password_value); |
| 236 } else { | 236 } else { |
| 237 // Use a placeholder value with the same length as the password. | 237 // Use a placeholder value with the same length as the password. |
| 238 entry->SetString( | 238 entry->SetString( |
| 239 kPasswordField, | 239 kPasswordField, |
| 240 base::string16(saved_password->password_value.length(), ' ')); | 240 base::string16(saved_password->password_value.length(), ' ')); |
| 241 } | 241 } |
| 242 const GURL& federation_url = saved_password->federation_url; | 242 if (!saved_password->federation_origin.unique()) { |
| 243 if (!federation_url.is_empty()) { | |
| 244 entry->SetString( | 243 entry->SetString( |
| 245 kFederationField, | 244 kFederationField, |
| 246 l10n_util::GetStringFUTF16(IDS_PASSWORDS_VIA_FEDERATION, | 245 l10n_util::GetStringFUTF16( |
| 247 base::UTF8ToUTF16(federation_url.host()))); | 246 IDS_PASSWORDS_VIA_FEDERATION, |
| 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<scoped_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 scoped_ptr<base::DictionaryValue> entry(new base::DictionaryValue); |
| 263 CopyOriginInfoOfPasswordForm(*exception, languages_, entry.get()); | 263 CopyOriginInfoOfPasswordForm(*exception, languages_, 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 |