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

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

Issue 168763002: Add initial Screen Orientation API support: IDL changes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase additional test 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 #include "config.h"
6 #include "ScreenOrientation.h"
7
8 #include "core/dom/Document.h"
9 #include "core/frame/DOMWindow.h"
10 #include "core/frame/Frame.h"
11 #include "core/frame/Screen.h"
12
13 namespace WebCore {
14
15 ScreenOrientation::ScreenOrientation(Screen* screen)
16 : ActiveDOMObject(screen->frame()->document())
17 {
18 }
19
20 const char* ScreenOrientation::supplementName()
21 {
22 return "ScreenOrientation";
23 }
24
25 ScreenOrientation* ScreenOrientation::from(Screen* screen)
26 {
27 ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<S creen>::from(screen, supplementName()));
28 if (!supplement) {
29 ASSERT(screen);
30 ASSERT(screen->frame());
31 supplement = new ScreenOrientation(screen);
32 supplement->suspendIfNeeded();
abarth-chromium 2014/02/16 04:03:48 These should be in a static create function. Howe
Inactive 2014/02/16 04:35:56 Done.
33 provideTo(screen, supplementName(), adoptPtr(supplement));
34 }
35 return supplement;
36 }
37
38 ScreenOrientation::~ScreenOrientation()
39 {
40
abarth-chromium 2014/02/16 04:03:48 You've got an extra blank line here.
Inactive 2014/02/16 04:35:56 Done.
41 }
42
43 Screen* ScreenOrientation::screen() const
44 {
45 Document* document = toDocument(executionContext());
46 ASSERT(document);
47 DOMWindow* window = document->domWindow();
48 ASSERT(window);
49 return window->screen();
abarth-chromium 2014/02/16 04:03:48 Once you're a DOMWindowProperty, this will change
Inactive 2014/02/16 04:35:56 Done.
50 }
51
52 const AtomicString& ScreenOrientation::orientation(Screen* screen)
53 {
54 // FIXME: Implement.
55 DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary" , AtomicString::ConstructFromLiteral));
56 return portraitPrimary;
57 }
58
59 bool ScreenOrientation::lockOrientation(Screen* screen, const Vector<String>& or ientations)
60 {
61 // FIXME: Implement.
62 return false;
63 }
64
65 bool ScreenOrientation::lockOrientation(Screen* screen, const AtomicString& orie ntation)
66 {
67 // FIXME: Implement.
68 return false;
69 }
70
71 void ScreenOrientation::unlockOrientation(Screen* screen)
72 {
73 // FIXME: Implement.
74 }
75
76 void ScreenOrientation::orientationChanged()
77 {
78 ASSERT(screen());
79 screen()->dispatchEvent(Event::create(EventTypeNames::orientationchange));
80 }
abarth-chromium 2014/02/16 04:03:48 This function don't appear to have any callers. C
Inactive 2014/02/16 04:35:56 Done.
81
82 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698