Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: components/autofill/core/common/password_form.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 !it_default_key_values.IsAtEnd(); it_default_key_values.Advance()) { 153 !it_default_key_values.IsAtEnd(); it_default_key_values.Advance()) {
154 const base::Value* actual_value; 154 const base::Value* actual_value;
155 if (form_json.Get(it_default_key_values.key(), &actual_value) && 155 if (form_json.Get(it_default_key_values.key(), &actual_value) &&
156 it_default_key_values.value().Equals(actual_value)) { 156 it_default_key_values.value().Equals(actual_value)) {
157 form_json.Remove(it_default_key_values.key(), nullptr); 157 form_json.Remove(it_default_key_values.key(), nullptr);
158 } 158 }
159 } 159 }
160 160
161 std::string form_as_string; 161 std::string form_as_string;
162 base::JSONWriter::WriteWithOptions( 162 base::JSONWriter::WriteWithOptions(
163 &form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); 163 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string);
164 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); 164 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string);
165 return os << "PasswordForm(" << form_as_string << ")"; 165 return os << "PasswordForm(" << form_as_string << ")";
166 } 166 }
167 167
168 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { 168 std::ostream& operator<<(std::ostream& os, PasswordForm* form) {
169 return os << "&" << *form; 169 return os << "&" << *form;
170 } 170 }
171 171
172 } // namespace autofill 172 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698