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

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

Issue 132113006: Add initial Blink-side support for the Screen Orientation API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ScreenOrientation_h
6 #define ScreenOrientation_h
7
8 #include "core/events/EventTarget.h"
9 #include "core/frame/DOMWindowProperty.h"
10 #include "platform/Supplementable.h"
11 #include "wtf/Vector.h"
12 #include "wtf/text/AtomicString.h"
13 #include "wtf/text/WTFString.h"
14
15 namespace WebCore {
16
17 class Frame;
18 class Page;
19 class Screen;
20
21 enum ScreenOrientationValue {
22 OrientationInvalid = 0,
23 OrientationPortraitPrimary = 1,
kenneth.r.christiansen 2014/02/05 17:33:48 These arguments might change. Beverloo suggested "
24 OrientationLandscapePrimary = 1 << 1,
25 OrientationPortraitSecondary = 1 << 2,
26 OrientationLandscapeSecondary = 1 << 3,
27 OrientationPortrait = OrientationPortraitPrimary | OrientationPortraitSecond ary,
28 OrientationLandscape = OrientationLandscapePrimary | OrientationLandscapeSec ondary,
29 OrientationAny = OrientationPortrait | OrientationLandscape
30 };
31 typedef unsigned char ScreenOrientationValues;
32
33 class ScreenOrientation FINAL : public Supplement<Screen>, public DOMWindowPrope rty {
34 public:
35 static ScreenOrientation* from(Screen*);
36 virtual ~ScreenOrientation();
37
38 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(orientationchange);
39
40 static const AtomicString& orientation(Screen*);
41 static bool lockOrientation(Screen*, const Vector<String>& orientations);
kenneth.r.christiansen 2014/02/05 17:33:48 These will probably change to return a Promise. Th
42 static bool lockOrientation(Screen*, const AtomicString& orientation);
43 static void unlockOrientation(Screen*);
44
45 void orientationChanged();
46
47 private:
48 explicit ScreenOrientation(Screen*);
49 static const char* supplementName();
50
51 Page* page() const;
52
53 struct ScreenOrientationInfo {
54 const AtomicString& name;
55 ScreenOrientationValues orientation;
56 };
57 static ScreenOrientationInfo* orientationMap(unsigned& length);
58 static const AtomicString& orientationToString(ScreenOrientationValue);
59 static ScreenOrientationValues stringToOrientationValues(const AtomicString& );
60 bool lockOrientation(ScreenOrientationValues orientations);
61
62 Screen* m_screen;
63 ScreenOrientationValues m_allowedOrientation;
64 };
65
66 } // namespace WebCore
67
68 #endif // ScreenOrientation_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698