| 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 <ostream> | 5 #include <ostream> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "components/autofill/core/common/password_form.h" | 13 #include "components/autofill/core/common/password_form.h" |
| 14 | 14 |
| 15 namespace autofill { | 15 namespace autofill { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 // Serializes a PasswordForm to a JSON object. Used only for logging in tests. | 19 // Serializes a PasswordForm to a JSON object. Used only for logging in tests. |
| 20 void PasswordFormToJSON(const PasswordForm& form, | 20 void PasswordFormToJSON(const PasswordForm& form, |
| 21 base::DictionaryValue* target) { | 21 base::DictionaryValue* target) { |
| 22 target->SetInteger("scheme", form.scheme); | 22 target->SetInteger("scheme", form.scheme); |
| 23 target->SetString("signon_realm", form.signon_realm); | 23 target->SetString("signon_realm", form.signon_realm); |
| 24 target->SetString("signon_realm", form.signon_realm); | |
| 25 target->SetString("original_signon_realm", form.original_signon_realm); | 24 target->SetString("original_signon_realm", form.original_signon_realm); |
| 26 target->SetString("origin", form.origin.possibly_invalid_spec()); | 25 target->SetString("origin", form.origin.possibly_invalid_spec()); |
| 27 target->SetString("action", form.action.possibly_invalid_spec()); | 26 target->SetString("action", form.action.possibly_invalid_spec()); |
| 28 target->SetString("submit_element", form.submit_element); | 27 target->SetString("submit_element", form.submit_element); |
| 29 target->SetString("username_elem", form.username_element); | 28 target->SetString("username_elem", form.username_element); |
| 30 target->SetBoolean("username_marked_by_site", form.username_marked_by_site); | 29 target->SetBoolean("username_marked_by_site", form.username_marked_by_site); |
| 31 target->SetString("username_value", form.username_value); | 30 target->SetString("username_value", form.username_value); |
| 32 target->SetString("password_elem", form.password_element); | 31 target->SetString("password_elem", form.password_element); |
| 33 target->SetString("password_value", form.password_value); | 32 target->SetString("password_value", form.password_value); |
| 34 target->SetBoolean("password_value_is_default", | 33 target->SetBoolean("password_value_is_default", |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); | 205 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); |
| 207 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); | 206 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); |
| 208 return os << "PasswordForm(" << form_as_string << ")"; | 207 return os << "PasswordForm(" << form_as_string << ")"; |
| 209 } | 208 } |
| 210 | 209 |
| 211 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { | 210 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
| 212 return os << "&" << *form; | 211 return os << "&" << *form; |
| 213 } | 212 } |
| 214 | 213 |
| 215 } // namespace autofill | 214 } // namespace autofill |
| OLD | NEW |