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

Unified Diff: Source/modules/screen_orientation/LockOrientationCallback.h

Issue 283423005: Use Promises for screen.lockOrientation(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review commenst Created 6 years, 7 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
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/screen_orientation/LockOrientationCallback.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/screen_orientation/LockOrientationCallback.h
diff --git a/Source/modules/screen_orientation/LockOrientationCallback.h b/Source/modules/screen_orientation/LockOrientationCallback.h
new file mode 100644
index 0000000000000000000000000000000000000000..998453c5318595822a47d71101c7fd46f814c543
--- /dev/null
+++ b/Source/modules/screen_orientation/LockOrientationCallback.h
@@ -0,0 +1,37 @@
+// 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.
+
+#ifndef LockOrientationCallback_h
+#define LockOrientationCallback_h
+
+#include "public/platform/WebLockOrientationCallback.h"
+#include "public/platform/WebScreenOrientationType.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace WebCore {
+
+class ScriptPromiseResolverWithContext;
+
+// LockOrientationCallback is an implementation of WebLockOrientationCallback
+// that will resolve the underlying promise depending on the result passed to
+// the callback.
+class LockOrientationCallback FINAL : public blink::WebLockOrientationCallback {
+ WTF_MAKE_NONCOPYABLE(LockOrientationCallback);
+public:
+ explicit LockOrientationCallback(PassRefPtr<ScriptPromiseResolverWithContext>);
+ virtual ~LockOrientationCallback();
+
+ virtual void onSuccess(unsigned angle, blink::WebScreenOrientationType) OVERRIDE;
+ virtual void onError(ErrorType) OVERRIDE;
+
+private:
+ RefPtr<ScriptPromiseResolverWithContext> m_resolver;
+};
+
+} // namespace WebCore
+
+#endif // LockOrientationCallback_h
+
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/screen_orientation/LockOrientationCallback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698