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" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 bool ArePasswordFormUniqueKeyEqual(const PasswordForm& left, | 139 bool ArePasswordFormUniqueKeyEqual(const PasswordForm& left, |
140 const PasswordForm& right) { | 140 const PasswordForm& right) { |
141 return (left.signon_realm == right.signon_realm && | 141 return (left.signon_realm == right.signon_realm && |
142 left.origin == right.origin && | 142 left.origin == right.origin && |
143 left.username_element == right.username_element && | 143 left.username_element == right.username_element && |
144 left.username_value == right.username_value && | 144 left.username_value == right.username_value && |
145 left.password_element == right.password_element); | 145 left.password_element == right.password_element); |
146 } | 146 } |
147 | 147 |
148 bool LessThanUniqueKey::operator()(const PasswordForm* left, | 148 bool LessThanUniqueKey::operator()( |
149 const PasswordForm* right) const { | 149 const std::unique_ptr<PasswordForm>& left, |
| 150 const std::unique_ptr<PasswordForm>& right) const { |
150 int result = left->signon_realm.compare(right->signon_realm); | 151 int result = left->signon_realm.compare(right->signon_realm); |
151 if (result) | 152 if (result) |
152 return result < 0; | 153 return result < 0; |
153 | 154 |
154 result = left->username_element.compare(right->username_element); | 155 result = left->username_element.compare(right->username_element); |
155 if (result) | 156 if (result) |
156 return result < 0; | 157 return result < 0; |
157 | 158 |
158 result = left->username_value.compare(right->username_value); | 159 result = left->username_value.compare(right->username_value); |
159 if (result) | 160 if (result) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); | 201 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); |
201 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); | 202 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); |
202 return os << "PasswordForm(" << form_as_string << ")"; | 203 return os << "PasswordForm(" << form_as_string << ")"; |
203 } | 204 } |
204 | 205 |
205 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { | 206 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
206 return os << "&" << *form; | 207 return os << "&" << *form; |
207 } | 208 } |
208 | 209 |
209 } // namespace autofill | 210 } // namespace autofill |
OLD | NEW |