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

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

Issue 14460010: Implement the Blink part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed comments and removed reduntant core/platform layer classes Created 7 years, 7 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>
28
29 namespace WebKit {
30
31 WebDeviceMotionData::WebDeviceMotionData() :
32 m_hasAccelerationX(0),
33 m_hasAccelerationY(0),
34 m_hasAccelerationZ(0),
35 m_hasAccelerationIncludingGravityX(0),
36 m_hasAccelerationIncludingGravityY(0),
37 m_hasAccelerationIncludingGravityZ(0),
38 m_hasRotationRateAlpha(0),
39 m_hasRotationRateBeta(0),
40 m_hasRotationRateGamma(0),
41 m_interval(0)
42 {
43 }
44
45 void WebDeviceMotionData::setAccelerationX(double acceleration)
46 {
47 m_hasAccelerationX = 1;
abarth-chromium 2013/05/06 17:04:17 Shouldn't this be "= true" ?
timvolodine 2013/05/07 15:40:53 since m_hasAccelerationX is a bitfield of type cha
48 m_accelerationX = acceleration;
49 }
50
51 void WebDeviceMotionData::setAccelerationY(double acceleration)
52 {
53 m_hasAccelerationY = 1;
54 m_accelerationY = acceleration;
55 }
56
57 void WebDeviceMotionData::setAccelerationZ(double acceleration)
58 {
59 m_hasAccelerationZ = 1;
60 m_accelerationZ = acceleration;
61 }
62
63 void WebDeviceMotionData::setAccelerationIncludingGravityX(double acceleration)
64 {
65 m_hasAccelerationIncludingGravityX = 1;
66 m_accelerationIncludingGravityX = acceleration;
67 }
68
69 void WebDeviceMotionData::setAccelerationIncludingGravityY(double acceleration)
70 {
71 m_hasAccelerationIncludingGravityY = 1;
72 m_accelerationIncludingGravityY = acceleration;
73 }
74
75 void WebDeviceMotionData::setAccelerationIncludingGravityZ(double acceleration)
76 {
77 m_hasAccelerationIncludingGravityZ = 1;
78 m_accelerationIncludingGravityZ = acceleration;
79 }
80
81 void WebDeviceMotionData::setRotationRateAlpha(double rate)
82 {
83 m_hasRotationRateAlpha = 1;
84 m_rotationRateAlpha = rate;
85 }
86
87 void WebDeviceMotionData::setRotationRateBeta(double rate)
88 {
89 m_hasRotationRateBeta = 1;
90 m_rotationRateBeta = rate;
91 }
92
93 void WebDeviceMotionData::setRotationRateGamma(double rate)
94 {
95 m_hasRotationRateGamma = 1;
96 m_rotationRateGamma = rate;
97 }
98
99 void WebDeviceMotionData::setInterval(double interval)
100 {
101 m_interval = interval;
102 }
103
104 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698