| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 5 #ifndef CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
| 6 #define CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 6 #define CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Index of each accelerometer axis in data stream. | 41 // Index of each accelerometer axis in data stream. |
| 42 int index[ui::ACCELEROMETER_SOURCE_COUNT][3]; | 42 int index[ui::ACCELEROMETER_SOURCE_COUNT][3]; |
| 43 }; | 43 }; |
| 44 typedef base::RefCountedData<ConfigurationData> Configuration; | 44 typedef base::RefCountedData<ConfigurationData> Configuration; |
| 45 typedef base::RefCountedData<char[12]> Reading; | 45 typedef base::RefCountedData<char[12]> Reading; |
| 46 | 46 |
| 47 // An interface to receive data from the AccelerometerReader. | 47 // An interface to receive data from the AccelerometerReader. |
| 48 class Delegate { | 48 class Delegate { |
| 49 public: | 49 public: |
| 50 virtual ~Delegate() {} |
| 51 |
| 50 virtual void HandleAccelerometerUpdate( | 52 virtual void HandleAccelerometerUpdate( |
| 51 const ui::AccelerometerUpdate& update) = 0; | 53 const ui::AccelerometerUpdate& update) = 0; |
| 52 }; | 54 }; |
| 53 | 55 |
| 54 AccelerometerReader(scoped_refptr<base::TaskRunner> blocking_task_runner, | 56 AccelerometerReader(scoped_refptr<base::TaskRunner> blocking_task_runner, |
| 55 Delegate* delegate); | 57 Delegate* delegate); |
| 56 ~AccelerometerReader(); | 58 ~AccelerometerReader(); |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 // Dispatched when initialization is complete. If |success|, |configuration| | 61 // Dispatched when initialization is complete. If |success|, |configuration| |
| (...skipping 22 matching lines...) Expand all Loading... |
| 82 scoped_refptr<Configuration> configuration_; | 84 scoped_refptr<Configuration> configuration_; |
| 83 | 85 |
| 84 base::WeakPtrFactory<AccelerometerReader> weak_factory_; | 86 base::WeakPtrFactory<AccelerometerReader> weak_factory_; |
| 85 | 87 |
| 86 DISALLOW_COPY_AND_ASSIGN(AccelerometerReader); | 88 DISALLOW_COPY_AND_ASSIGN(AccelerometerReader); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace chromeos | 91 } // namespace chromeos |
| 90 | 92 |
| 91 #endif // CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 93 #endif // CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
| OLD | NEW |