OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/device_orientation/motion.h" |
| 6 |
| 7 #include "content/common/device_motion_messages.h" |
| 8 |
| 9 namespace device_orientation { |
| 10 |
| 11 Motion::Motion() |
| 12 : can_provide_acceleration_x_(false), |
| 13 can_provide_acceleration_y_(false), |
| 14 can_provide_acceleration_z_(false), |
| 15 can_provide_acceleration_including_gravity_x_(false), |
| 16 can_provide_acceleration_including_gravity_y_(false), |
| 17 can_provide_acceleration_including_gravity_z_(false), |
| 18 can_provide_rotation_rate_alpha_(false), |
| 19 can_provide_rotation_rate_beta_(false), |
| 20 can_provide_rotation_rate_gamma_(false), |
| 21 can_provide_interval_(false) { |
| 22 } |
| 23 |
| 24 Motion::~Motion() { |
| 25 } |
| 26 |
| 27 IPC::Message* Motion::CreateIPCMessage(int render_view_id) const { |
| 28 DeviceMotionMsg_Updated_Params params; |
| 29 |
| 30 params.can_provide_acceleration_x = can_provide_acceleration_x_; |
| 31 params.acceleration_x = acceleration_x_; |
| 32 params.can_provide_acceleration_y = can_provide_acceleration_y_; |
| 33 params.acceleration_y = acceleration_y_; |
| 34 params.can_provide_acceleration_z = can_provide_acceleration_z_; |
| 35 params.acceleration_z = acceleration_z_; |
| 36 |
| 37 params.can_provide_acceleration_including_gravity_x = |
| 38 can_provide_acceleration_including_gravity_x_; |
| 39 params.acceleration_including_gravity_x = acceleration_including_gravity_x_; |
| 40 params.can_provide_acceleration_including_gravity_y = |
| 41 can_provide_acceleration_including_gravity_y_; |
| 42 params.acceleration_including_gravity_y = acceleration_including_gravity_y_; |
| 43 params.can_provide_acceleration_including_gravity_z = |
| 44 can_provide_acceleration_including_gravity_z_; |
| 45 params.acceleration_including_gravity_z = acceleration_including_gravity_z_; |
| 46 |
| 47 params.can_provide_rotation_rate_alpha = can_provide_rotation_rate_alpha_; |
| 48 params.rotation_rate_alpha = rotation_rate_alpha_; |
| 49 params.can_provide_rotation_rate_beta = can_provide_rotation_rate_beta_; |
| 50 params.rotation_rate_beta = rotation_rate_beta_; |
| 51 params.can_provide_rotation_rate_gamma = can_provide_rotation_rate_gamma_; |
| 52 params.rotation_rate_gamma = rotation_rate_gamma_; |
| 53 |
| 54 params.can_provide_interval = can_provide_interval_; |
| 55 params.interval = interval_; |
| 56 |
| 57 return new DeviceMotionMsg_Updated(render_view_id, params); |
| 58 } |
| 59 |
| 60 // Should always fire new motion events so that they occur at regular intervals. |
| 61 // The firing frequency is determined by the polling frequency in ProviderImpl. |
| 62 bool Motion::ShouldFireEvent(const DeviceData* old_data) const { |
| 63 return true; |
| 64 } |
| 65 |
| 66 }; // namespace device_orientation |
OLD | NEW |