| 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"
|
| +
|
| +namespace WebCore {
|
| +
|
| +// static
|
| +OrientationInformation* OrientationInformation::createFake()
|
| +{
|
| + OrientationInformation* orientation = new OrientationInformation();
|
| + orientation->m_type = blink::WebScreenOrientationPortraitPrimary;
|
| + orientation->m_angle = 0;
|
| +
|
| + 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()
|
| +{
|
| +}
|
| +
|
| +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
|
|
|