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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentAddress.cpp

Issue 2349133002: PaymentRequest: Make the PaymentResponse interface serializable. (Closed)
Patch Set: PaymentRequest: Make the PaymentResponse interface serializable. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/payments/PaymentAddress.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentAddress.cpp b/third_party/WebKit/Source/modules/payments/PaymentAddress.cpp
index fea61124fe053db5ece1068b381675bf26e49f04..c469066f9062fb53bc524613c52483b0fa1d771a 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentAddress.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentAddress.cpp
@@ -4,6 +4,8 @@
#include "modules/payments/PaymentAddress.h"
+#include "bindings/core/v8/ExceptionStatePlaceholder.h"
please use gerrit instead 2016/09/20 08:15:46 Why is this included?
zino 2016/09/20 16:55:43 Done.
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "wtf/text/StringBuilder.h"
namespace blink {
@@ -33,4 +35,21 @@ PaymentAddress::PaymentAddress(mojom::blink::PaymentAddressPtr address)
PaymentAddress::~PaymentAddress() {}
+ScriptValue PaymentAddress::toJSONForBinding(ScriptState* scriptState) const
+{
+ V8ObjectBuilder result(scriptState);
+ result.addString("country", country());
+ result.add("addressLine", addressLine());
+ result.addString("region", region());
+ result.addString("city", city());
+ result.addString("dependentLocality", dependentLocality());
+ result.addString("postalCode", postalCode());
+ result.addString("sortingCode", sortingCode());
+ result.addString("languageCode", languageCode());
+ result.addString("organization", organization());
+ result.addString("recipient", recipient());
+ result.addString("phone", phone());
+ return result.scriptValue();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698