Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/events/EventTarget.h" | 8 #include "core/events/EventTarget.h" |
| 9 #include "core/frame/DOMWindowProperty.h" | 9 #include "core/frame/DOMWindowProperty.h" |
| 10 #include "platform/Supplementable.h" | 10 #include "platform/Supplementable.h" |
| 11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
| 12 #include "wtf/text/AtomicString.h" | 12 #include "wtf/text/AtomicString.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace WebCore { | 15 namespace WebCore { |
| 16 | 16 |
| 17 class Page; | |
| 17 class Screen; | 18 class Screen; |
| 18 | 19 |
| 20 enum ScreenOrientationValue { | |
| 21 OrientationInvalid = 0, | |
| 22 OrientationPortraitPrimary = 1, | |
| 23 OrientationLandscapePrimary = 1 << 1, | |
| 24 OrientationPortraitSecondary = 1 << 2, | |
| 25 OrientationLandscapeSecondary = 1 << 3, | |
| 26 OrientationPortrait = OrientationPortraitPrimary | OrientationPortraitSecond ary, | |
| 27 OrientationLandscape = OrientationLandscapePrimary | OrientationLandscapeSec ondary, | |
| 28 OrientationAny = OrientationPortrait | OrientationLandscape | |
| 29 }; | |
| 30 typedef unsigned char ScreenOrientationValues; | |
| 31 | |
| 19 class ScreenOrientation FINAL : public Supplement<Screen>, DOMWindowProperty { | 32 class ScreenOrientation FINAL : public Supplement<Screen>, DOMWindowProperty { |
| 20 public: | 33 public: |
| 21 static ScreenOrientation* from(Screen*); | 34 static ScreenOrientation* from(Screen*); |
| 22 virtual ~ScreenOrientation(); | 35 virtual ~ScreenOrientation(); |
| 23 | 36 |
| 24 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(orientationchange); | 37 DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(orientationchange); |
| 25 | 38 |
| 26 static const AtomicString& orientation(Screen*); | 39 static const AtomicString& orientation(Screen*); |
| 27 static bool lockOrientation(Screen*, const Vector<String>& orientations); | 40 static bool lockOrientation(Screen*, const Vector<String>& orientations); |
| 28 static bool lockOrientation(Screen*, const AtomicString& orientation); | 41 static bool lockOrientation(Screen*, const AtomicString& orientation); |
| 29 static void unlockOrientation(Screen*); | 42 static void unlockOrientation(Screen*); |
| 30 | 43 |
| 44 void orientationChanged(); | |
| 45 | |
| 46 Page* page() const; | |
|
abarth-chromium
2014/02/18 01:34:27
Should this be private?
Inactive
2014/02/18 20:52:47
Done. No longer needed.
| |
| 47 | |
| 31 private: | 48 private: |
| 32 explicit ScreenOrientation(Screen*); | 49 explicit ScreenOrientation(Screen*); |
| 50 | |
| 33 static const char* supplementName(); | 51 static const char* supplementName(); |
| 34 Screen* screen() const; | 52 Screen* screen() const; |
| 53 | |
| 54 static const AtomicString& orientationToString(ScreenOrientationValue); | |
| 35 }; | 55 }; |
| 36 | 56 |
| 37 } // namespace WebCore | 57 } // namespace WebCore |
| 38 | 58 |
| 39 #endif // ScreenOrientation_h | 59 #endif // ScreenOrientation_h |
| OLD | NEW |