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

Side by Side Diff: Source/modules/screen_orientation/ScreenOrientation.h

Issue 283423005: Use Promises for screen.lockOrientation(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cdumez comments 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ScreenOrientation_h 5 #ifndef ScreenOrientation_h
6 #define ScreenOrientation_h 6 #define ScreenOrientation_h
7 7
8 #include "core/frame/DOMWindowProperty.h" 8 #include "core/frame/DOMWindowProperty.h"
9 #include "platform/Supplementable.h" 9 #include "platform/Supplementable.h"
10 #include "platform/Timer.h" 10 #include "platform/Timer.h"
11 #include "platform/heap/Handle.h" 11 #include "platform/heap/Handle.h"
12 #include "public/platform/WebScreenOrientationLockType.h" 12 #include "public/platform/WebScreenOrientationLockType.h"
13 #include "public/platform/WebScreenOrientationType.h"
13 #include "wtf/text/AtomicString.h" 14 #include "wtf/text/AtomicString.h"
14 #include "wtf/text/WTFString.h" 15 #include "wtf/text/WTFString.h"
15 16
16 namespace WebCore { 17 namespace WebCore {
17 18
18 class Document; 19 class Document;
19 class ExceptionState; 20 class ExecutionContext;
20 class Screen; 21 class Screen;
22 class ScriptPromise;
yhirano 2014/05/22 03:48:43 I think this forward declaration is meaningless be
mlamouri (slow - plz ping) 2014/05/22 08:58:56 The forward declaration appears to be needed. It d
21 23
22 class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<Scr eenOrientation>, public WillBeHeapSupplement<Screen>, DOMWindowProperty { 24 class ScreenOrientation FINAL : public NoBaseWillBeGarbageCollectedFinalized<Scr eenOrientation>, public WillBeHeapSupplement<Screen>, DOMWindowProperty {
23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation); 25 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ScreenOrientation);
24 public: 26 public:
25 static ScreenOrientation& from(Screen&); 27 static ScreenOrientation& from(Screen&);
26 virtual ~ScreenOrientation(); 28 virtual ~ScreenOrientation();
27 29
28 static const AtomicString& orientation(Screen&); 30 static const AtomicString& orientation(Screen&);
29 static bool lockOrientation(Screen&, const AtomicString& orientation, Except ionState&); 31 static ScriptPromise lockOrientation(ExecutionContext*, Screen&, const Atomi cString& orientation);
30 static void unlockOrientation(Screen&); 32 static void unlockOrientation(Screen&);
31 33
34 // Helper being used by this class and LockOrientationCallback.
35 static const AtomicString& orientationTypeToString(blink::WebScreenOrientati onType);
36
32 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen> ::trace(visitor); } 37 virtual void trace(Visitor* visitor) OVERRIDE { WillBeHeapSupplement<Screen> ::trace(visitor); }
33 38
34 private: 39 private:
35 explicit ScreenOrientation(Screen&); 40 explicit ScreenOrientation(Screen&);
36 41
37 void lockOrientationAsync(blink::WebScreenOrientationLockType);
38 void orientationLockTimerFired(Timer<ScreenOrientation>*);
39
40 static const char* supplementName(); 42 static const char* supplementName();
41 Document* document() const; 43 Document* document() const;
42
43 Timer<ScreenOrientation> m_orientationLockTimer;
44 blink::WebScreenOrientationLockType m_prospectiveLock;
45 }; 44 };
46 45
47 } // namespace WebCore 46 } // namespace WebCore
48 47
49 #endif // ScreenOrientation_h 48 #endif // ScreenOrientation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698