Index: Source/modules/screen_orientation/ScreenOrientation.cpp |
diff --git a/Source/modules/screen_orientation/ScreenOrientation.cpp b/Source/modules/screen_orientation/ScreenOrientation.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cc003c6e63029c876646bc8eae3bfe5e622c79b5 |
--- /dev/null |
+++ b/Source/modules/screen_orientation/ScreenOrientation.cpp |
@@ -0,0 +1,82 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "ScreenOrientation.h" |
+ |
+#include "core/dom/Document.h" |
+#include "core/frame/DOMWindow.h" |
+#include "core/frame/Frame.h" |
+#include "core/frame/Screen.h" |
+ |
+namespace WebCore { |
+ |
+ScreenOrientation::ScreenOrientation(Screen* screen) |
+ : ActiveDOMObject(screen->frame()->document()) |
+{ |
+} |
+ |
+const char* ScreenOrientation::supplementName() |
+{ |
+ return "ScreenOrientation"; |
+} |
+ |
+ScreenOrientation* ScreenOrientation::from(Screen* screen) |
+{ |
+ ScreenOrientation* supplement = static_cast<ScreenOrientation*>(Supplement<Screen>::from(screen, supplementName())); |
+ if (!supplement) { |
+ ASSERT(screen); |
+ ASSERT(screen->frame()); |
+ supplement = new ScreenOrientation(screen); |
+ 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.
|
+ provideTo(screen, supplementName(), adoptPtr(supplement)); |
+ } |
+ return supplement; |
+} |
+ |
+ScreenOrientation::~ScreenOrientation() |
+{ |
+ |
abarth-chromium
2014/02/16 04:03:48
You've got an extra blank line here.
Inactive
2014/02/16 04:35:56
Done.
|
+} |
+ |
+Screen* ScreenOrientation::screen() const |
+{ |
+ Document* document = toDocument(executionContext()); |
+ ASSERT(document); |
+ DOMWindow* window = document->domWindow(); |
+ ASSERT(window); |
+ 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.
|
+} |
+ |
+const AtomicString& ScreenOrientation::orientation(Screen* screen) |
+{ |
+ // FIXME: Implement. |
+ DEFINE_STATIC_LOCAL(const AtomicString, portraitPrimary, ("portrait-primary", AtomicString::ConstructFromLiteral)); |
+ return portraitPrimary; |
+} |
+ |
+bool ScreenOrientation::lockOrientation(Screen* screen, const Vector<String>& orientations) |
+{ |
+ // FIXME: Implement. |
+ return false; |
+} |
+ |
+bool ScreenOrientation::lockOrientation(Screen* screen, const AtomicString& orientation) |
+{ |
+ // FIXME: Implement. |
+ return false; |
+} |
+ |
+void ScreenOrientation::unlockOrientation(Screen* screen) |
+{ |
+ // FIXME: Implement. |
+} |
+ |
+void ScreenOrientation::orientationChanged() |
+{ |
+ ASSERT(screen()); |
+ screen()->dispatchEvent(Event::create(EventTypeNames::orientationchange)); |
+} |
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.
|
+ |
+} // namespace WebCore |