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

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

Issue 23857010: Revert "Revert 223907 "[password generation] Upload possible account cre..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 "components/autofill/core/common/form_data.h" 5 #include "components/autofill/core/common/form_data.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/common/form_field_data.h" 10 #include "components/autofill/core/common/form_field_data.h"
10 11
11 namespace autofill { 12 namespace autofill {
12 13
13 namespace { 14 namespace {
14 15
15 const int kPickleVersion = 1; 16 const int kPickleVersion = 1;
16 17
17 bool ReadGURL(PickleIterator* iter, GURL* url) { 18 bool ReadGURL(PickleIterator* iter, GURL* url) {
18 std::string spec; 19 std::string spec;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 origin == form.origin && 72 origin == form.origin &&
72 action == form.action && 73 action == form.action &&
73 user_submitted == form.user_submitted && 74 user_submitted == form.user_submitted &&
74 fields == form.fields; 75 fields == form.fields;
75 } 76 }
76 77
77 bool FormData::operator!=(const FormData& form) const { 78 bool FormData::operator!=(const FormData& form) const {
78 return !operator==(form); 79 return !operator==(form);
79 } 80 }
80 81
82 std::ostream& operator<<(std::ostream& os, const FormData& form) {
83 os << UTF16ToUTF8(form.name) << " "
84 << UTF16ToUTF8(form.method) << " "
85 << form.origin << " "
86 << form.action << " "
87 << form.user_submitted << " "
88 << "Fields:";
89 for (size_t i = 0; i < form.fields.size(); ++i) {
90 os << form.fields[i] << ",";
91 }
92 return os;
93 }
94
81 void SerializeFormData(const FormData& form_data, Pickle* pickle) { 95 void SerializeFormData(const FormData& form_data, Pickle* pickle) {
82 pickle->WriteInt(kPickleVersion); 96 pickle->WriteInt(kPickleVersion);
83 pickle->WriteString16(form_data.name); 97 pickle->WriteString16(form_data.name);
84 pickle->WriteString16(form_data.method); 98 pickle->WriteString16(form_data.method);
85 pickle->WriteString(form_data.origin.spec()); 99 pickle->WriteString(form_data.origin.spec());
86 pickle->WriteString(form_data.action.spec()); 100 pickle->WriteString(form_data.action.spec());
87 pickle->WriteBool(form_data.user_submitted); 101 pickle->WriteBool(form_data.user_submitted);
88 SerializeFormFieldDataVector(form_data.fields, pickle); 102 SerializeFormFieldDataVector(form_data.fields, pickle);
89 } 103 }
90 104
(...skipping 19 matching lines...) Expand all
110 } 124 }
111 default: { 125 default: {
112 LOG(ERROR) << "Unknown FormData pickle version " << version; 126 LOG(ERROR) << "Unknown FormData pickle version " << version;
113 return false; 127 return false;
114 } 128 }
115 } 129 }
116 return true; 130 return true;
117 } 131 }
118 132
119 } // namespace autofill 133 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/common/form_data.h ('k') | components/autofill/core/common/password_form.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698