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

Side by Side Diff: components/autofill/core/browser/autofill_profile.h

Issue 2093363002: Autofill address editor in PaymentRequest UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contact-editor
Patch Set: Fix try-bot Created 4 years, 5 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // |UNKNOWN_TYPE| when |suggested_fields| is NULL. Each label includes at 152 // |UNKNOWN_TYPE| when |suggested_fields| is NULL. Each label includes at
153 // least |minimal_fields_shown| fields, if possible. 153 // least |minimal_fields_shown| fields, if possible.
154 static void CreateInferredLabels( 154 static void CreateInferredLabels(
155 const std::vector<AutofillProfile*>& profiles, 155 const std::vector<AutofillProfile*>& profiles,
156 const std::vector<ServerFieldType>* suggested_fields, 156 const std::vector<ServerFieldType>* suggested_fields,
157 ServerFieldType excluded_field, 157 ServerFieldType excluded_field,
158 size_t minimal_fields_shown, 158 size_t minimal_fields_shown,
159 const std::string& app_locale, 159 const std::string& app_locale,
160 std::vector<base::string16>* labels); 160 std::vector<base::string16>* labels);
161 161
162 // Builds inferred label from the first |num_fields_to_include| non-empty
163 // fields in |label_fields|. Uses as many fields as possible if there are not
164 // enough non-empty fields.
165 base::string16 ConstructInferredLabel(
166 const std::vector<ServerFieldType>& label_fields,
167 size_t num_fields_to_include,
168 const std::string& app_locale) const;
169
162 const std::string& language_code() const { return language_code_; } 170 const std::string& language_code() const { return language_code_; }
163 void set_language_code(const std::string& language_code) { 171 void set_language_code(const std::string& language_code) {
164 language_code_ = language_code; 172 language_code_ = language_code;
165 } 173 }
166 174
167 // Nonempty only when type() == SERVER_PROFILE. base::kSHA1Length bytes long. 175 // Nonempty only when type() == SERVER_PROFILE. base::kSHA1Length bytes long.
168 // Not necessarily valid UTF-8. 176 // Not necessarily valid UTF-8.
169 const std::string& server_id() const { return server_id_; } 177 const std::string& server_id() const { return server_id_; }
170 178
171 // Creates an identifier and saves it as |server_id_|. Only used for 179 // Creates an identifier and saves it as |server_id_|. Only used for
(...skipping 14 matching lines...) Expand all
186 // This string is designed for comparison purposes only and isn't suitable 194 // This string is designed for comparison purposes only and isn't suitable
187 // for storing or displaying to the user. 195 // for storing or displaying to the user.
188 static base::string16 CanonicalizeProfileString(const base::string16& str); 196 static base::string16 CanonicalizeProfileString(const base::string16& str);
189 197
190 private: 198 private:
191 typedef std::vector<const FormGroup*> FormGroupList; 199 typedef std::vector<const FormGroup*> FormGroupList;
192 200
193 // FormGroup: 201 // FormGroup:
194 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; 202 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override;
195 203
196 // Builds inferred label from the first |num_fields_to_include| non-empty
197 // fields in |label_fields|. Uses as many fields as possible if there are not
198 // enough non-empty fields.
199 base::string16 ConstructInferredLabel(
200 const std::vector<ServerFieldType>& label_fields,
201 size_t num_fields_to_include,
202 const std::string& app_locale) const;
203
204 // Creates inferred labels for |profiles| at indices corresponding to 204 // Creates inferred labels for |profiles| at indices corresponding to
205 // |indices|, and stores the results to the corresponding elements of 205 // |indices|, and stores the results to the corresponding elements of
206 // |labels|. These labels include enough fields to differentiate among the 206 // |labels|. These labels include enough fields to differentiate among the
207 // profiles, if possible; and also at least |num_fields_to_include| fields, if 207 // profiles, if possible; and also at least |num_fields_to_include| fields, if
208 // possible. The label fields are drawn from |fields|. 208 // possible. The label fields are drawn from |fields|.
209 static void CreateInferredLabelsHelper( 209 static void CreateInferredLabelsHelper(
210 const std::vector<AutofillProfile*>& profiles, 210 const std::vector<AutofillProfile*>& profiles,
211 const std::list<size_t>& indices, 211 const std::list<size_t>& indices,
212 const std::vector<ServerFieldType>& fields, 212 const std::vector<ServerFieldType>& fields,
213 size_t num_fields_to_include, 213 size_t num_fields_to_include,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // a hash of the contents. 245 // a hash of the contents.
246 std::string server_id_; 246 std::string server_id_;
247 }; 247 };
248 248
249 // So we can compare AutofillProfiles with EXPECT_EQ(). 249 // So we can compare AutofillProfiles with EXPECT_EQ().
250 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile); 250 std::ostream& operator<<(std::ostream& os, const AutofillProfile& profile);
251 251
252 } // namespace autofill 252 } // namespace autofill
253 253
254 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_ 254 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_PROFILE_H_
OLDNEW
« no previous file with comments | « chrome/test/data/android/payments/dynamic_shipping.js ('k') | components/autofill/core/browser/autofill_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698