OLD | NEW |
---|---|
(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 "modules/screen_orientation/OrientationInformation.h" | |
7 | |
8 #include "modules/screen_orientation/ScreenOrientation.h" | |
9 #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.
| |
10 | |
11 namespace WebCore { | |
12 | |
13 // static | |
14 OrientationInformation* OrientationInformation::createFake() | |
15 { | |
16 OrientationInformation* orientation = new OrientationInformation(); | |
17 orientation->m_type = blink::WebScreenOrientationPortraitPrimary; | |
18 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.
| |
19 | |
20 return orientation; | |
21 } | |
22 | |
23 OrientationInformation::OrientationInformation() | |
24 : m_type(blink::WebScreenOrientationUndefined) | |
25 , m_angle(0) | |
26 { | |
27 ScriptWrappable::init(this); | |
28 } | |
29 | |
30 OrientationInformation::OrientationInformation(const OrientationInformation& oth er) | |
31 : m_type(other.m_type) | |
32 , m_angle(other.m_angle) | |
33 { | |
34 ScriptWrappable::init(this); | |
35 } | |
36 | |
37 OrientationInformation::~OrientationInformation() | |
38 { | |
39 } | |
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.
| |
40 | |
41 bool OrientationInformation::initialized() const | |
42 { | |
43 return m_type != blink::WebScreenOrientationUndefined; | |
44 } | |
45 | |
46 bool OrientationInformation::operator==(const OrientationInformation& other) | |
47 { | |
48 return m_type == other.m_type && m_angle == other.m_angle; | |
49 } | |
50 | |
51 bool OrientationInformation::operator!=(const OrientationInformation& other) | |
52 { | |
53 return !this->operator==(other); | |
54 } | |
55 | |
56 String OrientationInformation::type() const | |
57 { | |
58 return ScreenOrientation::orientationTypeToString(m_type); | |
59 } | |
60 | |
61 unsigned short OrientationInformation::angle() const | |
62 { | |
63 return m_angle; | |
64 } | |
65 | |
66 void OrientationInformation::setType(blink::WebScreenOrientationType type) | |
67 { | |
68 ASSERT(type != blink::WebScreenOrientationUndefined); | |
69 m_type = type; | |
70 } | |
71 | |
72 void OrientationInformation::setAngle(unsigned short angle) | |
73 { | |
74 m_angle = angle; | |
75 } | |
76 | |
77 } // namespace WebCore | |
OLD | NEW |