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

Side by Side Diff: Source/WebCore/platform/chromium/support/WebDeviceMotionData.cpp

Issue 13866007: WebKit & WebCore part of the device motion implementation using the platform layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@devicemotion-webcore
Patch Set: added unregister in destructor of DeviceMotionController Created 7 years, 8 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
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "config.h"
27 #include <public/WebDeviceMotionData.h>
Peter Beverloo 2013/04/17 19:08:23 micro nit: newline between lines 26 and 27.
timvolodine 2013/04/18 12:37:38 hmm, unsure why this is needed. Other files in thi
28
29 #include "DeviceMotionData.h"
30 #include "WebDeviceMotionEventPump.h"
31
32 namespace WebKit {
33
34 using WebCore::DeviceMotionData;
35
36 WebDeviceMotionData::WebDeviceMotionData() :
37 m_hasAccelerationX(false),
38 m_hasAccelerationY(false),
39 m_hasAccelerationZ(false),
40 m_hasAccelerationIncludingGravityX(false),
41 m_hasAccelerationIncludingGravityY(false),
42 m_hasAccelerationIncludingGravityZ(false),
43 m_hasRotationRateAlpha(false),
44 m_hasRotationRateBeta(false),
45 m_hasRotationRateGamma(false)
46 {
47 }
48
49 void WebDeviceMotionData::setAccelerationX(double acceleration)
50 {
51 m_hasAccelerationX = true;
52 m_accelerationX = acceleration;
53 }
54
55 void WebDeviceMotionData::setAccelerationY(double acceleration)
56 {
57 m_hasAccelerationY = true;
58 m_accelerationY = acceleration;
59 }
60
61 void WebDeviceMotionData::setAccelerationZ(double acceleration)
62 {
63 m_hasAccelerationZ = true;
64 m_accelerationZ = acceleration;
65 }
66
67 void WebDeviceMotionData::setAccelerationIncludingGravityX(double acceleration)
68 {
69 m_hasAccelerationIncludingGravityX = true;
70 m_accelerationIncludingGravityX = acceleration;
71 }
72
73 void WebDeviceMotionData::setAccelerationIncludingGravityY(double acceleration)
74 {
75 m_hasAccelerationIncludingGravityY = true;
76 m_accelerationIncludingGravityY = acceleration;
77 }
78
79 void WebDeviceMotionData::setAccelerationIncludingGravityZ(double acceleration)
80 {
81 m_hasAccelerationIncludingGravityZ = true;
82 m_accelerationIncludingGravityZ = acceleration;
83 }
84
85 void WebDeviceMotionData::setRotationRateAlpha(double rate)
86 {
87 m_hasRotationRateAlpha = true;
88 m_rotationRateAlpha = rate;
89 }
90
91 void WebDeviceMotionData::setRotationRateBeta(double rate)
92 {
93 m_hasRotationRateBeta = true;
94 m_rotationRateBeta = rate;
95 }
96
97 void WebDeviceMotionData::setRotationRateGamma(double rate)
98 {
99 m_hasRotationRateGamma = true;
100 m_rotationRateGamma = rate;
101 }
102
103 WebDeviceMotionData::operator PassRefPtr<WebCore::DeviceMotionData>() const
104 {
105 return DeviceMotionData::create(
106 DeviceMotionData::Acceleration::create(
107 m_hasAccelerationX, m_accelerationX,
108 m_hasAccelerationY, m_accelerationY,
109 m_hasAccelerationZ, m_accelerationZ),
110 DeviceMotionData::Acceleration::create(
111 m_hasAccelerationIncludingGravityX, m_accelerationIncludingGravityX,
112 m_hasAccelerationIncludingGravityY, m_accelerationIncludingGravityY,
113 m_hasAccelerationIncludingGravityZ, m_accelerationIncludingGravityZ) ,
114 DeviceMotionData::RotationRate::create(
115 m_hasRotationRateAlpha, m_rotationRateAlpha,
116 m_hasRotationRateBeta, m_rotationRateBeta,
117 m_hasRotationRateGamma, m_rotationRateGamma),
118 true, WebDeviceMotionEventPump::kPumpDelayMilliSeconds);
119 }
120
121 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698