Index: Source/modules/screen_orientation/OrientationInformation.cpp |
diff --git a/Source/modules/screen_orientation/OrientationInformation.cpp b/Source/modules/screen_orientation/OrientationInformation.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e15bb01d3a966c4ba12b92c185d17e3b1a26f73c |
--- /dev/null |
+++ b/Source/modules/screen_orientation/OrientationInformation.cpp |
@@ -0,0 +1,77 @@ |
+// 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 "modules/screen_orientation/OrientationInformation.h" |
+ |
+#include "modules/screen_orientation/ScreenOrientation.h" |
+#include "wtf/text/WTFString.h" |
abarth-chromium
2014/07/02 18:25:09
You should move this include to the header because
mlamouri (slow - plz ping)
2014/07/02 19:18:11
Done.
|
+ |
+namespace WebCore { |
+ |
+// static |
+OrientationInformation* OrientationInformation::createFake() |
+{ |
+ OrientationInformation* orientation = new OrientationInformation(); |
+ orientation->m_type = blink::WebScreenOrientationPortraitPrimary; |
+ orientation->m_angle = 0; |
abarth-chromium
2014/07/02 18:25:09
Totally an unimportant nit, but we usually would c
mlamouri (slow - plz ping)
2014/07/02 19:18:11
Done.
|
+ |
+ return orientation; |
+} |
+ |
+OrientationInformation::OrientationInformation() |
+ : m_type(blink::WebScreenOrientationUndefined) |
+ , m_angle(0) |
+{ |
+ ScriptWrappable::init(this); |
+} |
+ |
+OrientationInformation::OrientationInformation(const OrientationInformation& other) |
+ : m_type(other.m_type) |
+ , m_angle(other.m_angle) |
+{ |
+ ScriptWrappable::init(this); |
+} |
+ |
+OrientationInformation::~OrientationInformation() |
+{ |
+} |
abarth-chromium
2014/07/02 18:25:09
Why do you need a destructor at all? You can use
mlamouri (slow - plz ping)
2014/07/02 19:18:11
Done.
|
+ |
+bool OrientationInformation::initialized() const |
+{ |
+ return m_type != blink::WebScreenOrientationUndefined; |
+} |
+ |
+bool OrientationInformation::operator==(const OrientationInformation& other) |
+{ |
+ return m_type == other.m_type && m_angle == other.m_angle; |
+} |
+ |
+bool OrientationInformation::operator!=(const OrientationInformation& other) |
+{ |
+ return !this->operator==(other); |
+} |
+ |
+String OrientationInformation::type() const |
+{ |
+ return ScreenOrientation::orientationTypeToString(m_type); |
+} |
+ |
+unsigned short OrientationInformation::angle() const |
+{ |
+ return m_angle; |
+} |
+ |
+void OrientationInformation::setType(blink::WebScreenOrientationType type) |
+{ |
+ ASSERT(type != blink::WebScreenOrientationUndefined); |
+ m_type = type; |
+} |
+ |
+void OrientationInformation::setAngle(unsigned short angle) |
+{ |
+ m_angle = angle; |
+} |
+ |
+} // namespace WebCore |