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.
6 #include "modules/screen_orientation/ScreenOrientation.h"
8 #include "core/frame/DOMWindow.h"
9 #include "core/frame/Frame.h"
10 #include "core/frame/Screen.h"
14 ScreenOrientation::ScreenOrientation(Screen* screen)
15 : DOMWindowProperty(screen->frame())
19 const char* ScreenOrientation::supplementName()
21 return "ScreenOrientation";
24 ScreenOrientation* ScreenOrientation::from(Screen* screen)
26 ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<Screen>::from(screen, supplementName()));
29 supplement = new ScreenOrientation(screen);
30 provideTo(screen, supplementName(), adoptPtr(supplement));
35 ScreenOrientation::~ScreenOrientation()
39 Screen* ScreenOrientation::screen() const
41 Frame* frame = this->frame();
43 DOMWindow* window = frame->domWindow();
45 return window->screen();
48 const AtomicString& ScreenOrientation::orientation(Screen* screen)
51 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary", AtomicString::ConstructFromLiteral));
52 return portraitPrimary;
55 bool ScreenOrientation::lockOrientation(Screen* screen, const Vector<String>& orientations)
61 bool ScreenOrientation::lockOrientation(Screen* screen, const AtomicString& orientation)
67 void ScreenOrientation::unlockOrientation(Screen* screen)
72 } // namespace WebCore