Index: third_party/WebKit/Source/modules/payments/PaymentResponse.cpp |
diff --git a/third_party/WebKit/Source/modules/payments/PaymentResponse.cpp b/third_party/WebKit/Source/modules/payments/PaymentResponse.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ffb030504e6398c4ff6b1ec7747c382b920acda5 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/payments/PaymentResponse.cpp |
@@ -0,0 +1,45 @@ |
+// 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. |
+ |
+#include "modules/payments/PaymentResponse.h" |
+ |
+#include "bindings/core/v8/ExceptionState.h" |
+#include "bindings/core/v8/ScriptState.h" |
+#include "bindings/core/v8/V8Binding.h" |
+#include "bindings/core/v8/V8BindingMacros.h" |
+#include "core/dom/DOMException.h" |
+#include "core/dom/ExceptionCode.h" |
+ |
+namespace blink { |
+ |
+PaymentResponse::PaymentResponse() |
+{ |
+} |
+ |
+PaymentResponse::~PaymentResponse() |
+{ |
+} |
+ |
+ScriptValue PaymentResponse::details(ScriptState* scriptState, ExceptionState& exceptionState) const |
+{ |
+ v8::Isolate* isolate = scriptState->isolate(); |
+ v8::Local<v8::Value> parsed; |
+ v8::TryCatch tryCatch(isolate); |
+ |
+ if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, m_stringifiedDetails)), parsed, tryCatch)) { |
haraken
2016/03/01 02:33:47
Could you introduce a helper method like fromJSONV
please use gerrit instead
2016/03/02 00:32:53
Done.
|
+ if (tryCatch.HasCaught()) |
+ exceptionState.rethrowV8Exception(tryCatch.Exception()); |
+ |
+ return ScriptValue(); |
+ } |
+ |
+ return ScriptValue(scriptState, parsed); |
+} |
+ |
+ScriptPromise PaymentResponse::complete(ScriptState* scriptState, bool success) |
+{ |
+ return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError, "Not implemented.")); |
+} |
+ |
+} // namespace blink |