OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/device_orientation/accelerometer_mac.h" | 5 #include "content/browser/device_orientation/accelerometer_mac.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/browser/device_orientation/orientation.h" | 10 #include "content/browser/device_orientation/orientation.h" |
11 #include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h" | 11 #include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h" |
12 | 12 |
13 namespace device_orientation { | 13 namespace content { |
14 | 14 |
15 // Create a AccelerometerMac object and return NULL if no valid sensor found. | 15 // Create a AccelerometerMac object and return NULL if no valid sensor found. |
16 DataFetcher* AccelerometerMac::Create() { | 16 DataFetcher* AccelerometerMac::Create() { |
17 scoped_ptr<AccelerometerMac> accelerometer(new AccelerometerMac); | 17 scoped_ptr<AccelerometerMac> accelerometer(new AccelerometerMac); |
18 return accelerometer->Init() ? accelerometer.release() : NULL; | 18 return accelerometer->Init() ? accelerometer.release() : NULL; |
19 } | 19 } |
20 | 20 |
21 AccelerometerMac::~AccelerometerMac() { | 21 AccelerometerMac::~AccelerometerMac() { |
22 } | 22 } |
23 | 23 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 DCHECK_LT(orientation->gamma(), 90.0); | 94 DCHECK_LT(orientation->gamma(), 90.0); |
95 | 95 |
96 return orientation.release(); | 96 return orientation.release(); |
97 } | 97 } |
98 | 98 |
99 bool AccelerometerMac::Init() { | 99 bool AccelerometerMac::Init() { |
100 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); | 100 sudden_motion_sensor_.reset(SuddenMotionSensor::Create()); |
101 return sudden_motion_sensor_.get() != NULL; | 101 return sudden_motion_sensor_.get() != NULL; |
102 } | 102 } |
103 | 103 |
104 } // namespace device_orientation | 104 } // namespace content |
OLD | NEW |