Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / screen_orientation / ScreenOrientation.cpp
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 #include "config.h"
6 #include "modules/screen_orientation/ScreenOrientation.h"
7
8 #include "core/frame/DOMWindow.h"
9 #include "core/frame/Frame.h"
10 #include "core/frame/Screen.h"
11
12 namespace WebCore {
13
14 ScreenOrientation::ScreenOrientation(Screen* screen)
15     : DOMWindowProperty(screen->frame())
16 {
17 }
18
19 const char* ScreenOrientation::supplementName()
20 {
21     return "ScreenOrientation";
22 }
23
24 ScreenOrientation* ScreenOrientation::from(Screen* screen)
25 {
26     ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<Screen>::from(screen, supplementName()));
27     if (!supplement) {
28         ASSERT(screen);
29         supplement = new ScreenOrientation(screen);
30         provideTo(screen, supplementName(), adoptPtr(supplement));
31     }
32     return supplement;
33 }
34
35 ScreenOrientation::~ScreenOrientation()
36 {
37 }
38
39 Screen* ScreenOrientation::screen() const
40 {
41     Frame* frame = this->frame();
42     ASSERT(frame);
43     DOMWindow* window = frame->domWindow();
44     ASSERT(window);
45     return window->screen();
46 }
47
48 const AtomicString& ScreenOrientation::orientation(Screen* screen)
49 {
50     // FIXME: Implement.
51     DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary", AtomicString::ConstructFromLiteral));
52     return portraitPrimary;
53 }
54
55 bool ScreenOrientation::lockOrientation(Screen* screen, const Vector<String>& orientations)
56 {
57     // FIXME: Implement.
58     return false;
59 }
60
61 bool ScreenOrientation::lockOrientation(Screen* screen, const AtomicString& orientation)
62 {
63     // FIXME: Implement.
64     return false;
65 }
66
67 void ScreenOrientation::unlockOrientation(Screen* screen)
68 {
69     // FIXME: Implement.
70 }
71
72 } // namespace WebCore