| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "device/generic_sensor/sensor_impl.h" | 5 #include "device/generic_sensor/sensor_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 namespace device { | 9 namespace device { |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 void SensorImpl::AddConfiguration( | 27 void SensorImpl::AddConfiguration( |
| 28 const PlatformSensorConfiguration& configuration, | 28 const PlatformSensorConfiguration& configuration, |
| 29 const AddConfigurationCallback& callback) { | 29 const AddConfigurationCallback& callback) { |
| 30 // TODO(Mikhail): To avoid overflowing browser by repeated AddConfigs | 30 // TODO(Mikhail): To avoid overflowing browser by repeated AddConfigs |
| 31 // (maybe limit the number of configs per client). | 31 // (maybe limit the number of configs per client). |
| 32 callback.Run(sensor_->StartListening(this, configuration)); | 32 callback.Run(sensor_->StartListening(this, configuration)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void SensorImpl::GetDefaultConfiguration( |
| 36 const GetDefaultConfigurationCallback& callback) { |
| 37 callback.Run(sensor_->GetDefaultConfiguration()); |
| 38 } |
| 39 |
| 35 void SensorImpl::RemoveConfiguration( | 40 void SensorImpl::RemoveConfiguration( |
| 36 const PlatformSensorConfiguration& configuration, | 41 const PlatformSensorConfiguration& configuration, |
| 37 const RemoveConfigurationCallback& callback) { | 42 const RemoveConfigurationCallback& callback) { |
| 38 callback.Run(sensor_->StopListening(this, configuration)); | 43 callback.Run(sensor_->StopListening(this, configuration)); |
| 39 } | 44 } |
| 40 | 45 |
| 41 void SensorImpl::Suspend() { | 46 void SensorImpl::Suspend() { |
| 42 suspended_ = true; | 47 suspended_ = true; |
| 43 sensor_->UpdateSensor(); | 48 sensor_->UpdateSensor(); |
| 44 } | 49 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 58 DCHECK(!suspended_); | 63 DCHECK(!suspended_); |
| 59 if (client_) | 64 if (client_) |
| 60 client_->RaiseError(); | 65 client_->RaiseError(); |
| 61 } | 66 } |
| 62 | 67 |
| 63 bool SensorImpl::IsNotificationSuspended() { | 68 bool SensorImpl::IsNotificationSuspended() { |
| 64 return suspended_; | 69 return suspended_; |
| 65 } | 70 } |
| 66 | 71 |
| 67 } // namespace device | 72 } // namespace device |
| OLD | NEW |