Index: Source/modules/screen_orientation/LockOrientationCallback.cpp |
diff --git a/Source/modules/screen_orientation/LockOrientationCallback.cpp b/Source/modules/screen_orientation/LockOrientationCallback.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b4f3588fe2eb58b8444efda4cd0da5cd53a014e9 |
--- /dev/null |
+++ b/Source/modules/screen_orientation/LockOrientationCallback.cpp |
@@ -0,0 +1,34 @@ |
+// Copyright 2014 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 "config.h" |
+#include "modules/screen_orientation/LockOrientationCallback.h" |
+ |
+#include "bindings/v8/ScriptPromiseResolverWithContext.h" |
+#include "bindings/v8/V8Binding.h" |
+#include "modules/screen_orientation/ScreenOrientation.h" |
+#include "public/platform/WebDOMException.h" |
+ |
+namespace WebCore { |
+ |
+LockOrientationCallback::LockOrientationCallback(PassRefPtr<ScriptPromiseResolverWithContext> resolver) |
+ : m_resolver(resolver) |
+{ |
+} |
+ |
+LockOrientationCallback::~LockOrientationCallback() |
+{ |
+} |
+ |
+void LockOrientationCallback::onSuccess(blink::WebScreenOrientationType* orientation) |
+{ |
+ m_resolver->resolve(ScreenOrientation::orientationTypeToString(*orientation)); |
+} |
+ |
+void LockOrientationCallback::onError(blink::WebDOMException* error) |
+{ |
+ m_resolver->reject(error->toV8Value()); |
+} |
+ |
+} // namespace WebCore |