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

Unified Diff: ios/chrome/browser/payments/payment_request_utils.mm

Issue 2585233003: Upstream Chrome on iOS source code [2/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/payments/payment_request_utils.mm
diff --git a/ios/chrome/browser/payments/payment_request_utils.mm b/ios/chrome/browser/payments/payment_request_utils.mm
new file mode 100644
index 0000000000000000000000000000000000000000..bfe81e7ff4354f70dfcb5efeec824fdd4bb5ab82
--- /dev/null
+++ b/ios/chrome/browser/payments/payment_request_utils.mm
@@ -0,0 +1,29 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/payments/payment_request_utils.h"
+
+#include "base/strings/sys_string_conversions.h"
+#include "components/autofill/core/browser/autofill_profile.h"
+#include "ios/chrome/browser/application_context.h"
+
+namespace payment_request_utils {
+
+NSString* AddressLabelFromAutofillProfile(autofill::AutofillProfile* profile) {
+ // Name, company, and country are not included in the shipping address label.
+ std::vector<autofill::ServerFieldType> label_fields;
+ label_fields.push_back(autofill::ADDRESS_HOME_LINE1);
+ label_fields.push_back(autofill::ADDRESS_HOME_LINE2);
+ label_fields.push_back(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY);
+ label_fields.push_back(autofill::ADDRESS_HOME_CITY);
+ label_fields.push_back(autofill::ADDRESS_HOME_STATE);
+ label_fields.push_back(autofill::ADDRESS_HOME_ZIP);
+ label_fields.push_back(autofill::ADDRESS_HOME_SORTING_CODE);
+
+ return base::SysUTF16ToNSString(profile->ConstructInferredLabel(
+ label_fields, label_fields.size(),
+ GetApplicationContext()->GetApplicationLocale()));
+}
+
+} // namespace payment_request_utils
« no previous file with comments | « ios/chrome/browser/payments/payment_request_utils.h ('k') | ios/chrome/browser/payments/payment_request_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698