| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ |
| 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ | 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ |
| 7 | 7 |
| 8 #include <SensorsApi.h> | 8 #include <SensorsApi.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 virtual ~DataFetcherImplWin(); | 30 virtual ~DataFetcherImplWin(); |
| 31 | 31 |
| 32 // Factory function. It returns NULL on error. | 32 // Factory function. It returns NULL on error. |
| 33 // The created object listens for events for the whole lifetime. | 33 // The created object listens for events for the whole lifetime. |
| 34 static DataFetcher* Create(); | 34 static DataFetcher* Create(); |
| 35 | 35 |
| 36 // Implement DataFetcher. | 36 // Implement DataFetcher. |
| 37 virtual const DeviceData* GetDeviceData(DeviceData::Type type) OVERRIDE; | 37 virtual const DeviceData* GetDeviceData(DeviceData::Type type) OVERRIDE; |
| 38 | 38 |
| 39 void Stop(); |
| 40 |
| 39 private: | 41 private: |
| 40 class SensorEventSink; | 42 class SensorEventSink; |
| 41 friend SensorEventSink; | 43 friend SensorEventSink; |
| 42 | 44 |
| 45 static DataFetcherImplWin* instance(); |
| 46 |
| 43 DataFetcherImplWin(); | 47 DataFetcherImplWin(); |
| 44 bool Initialize(); | 48 bool Initialize(); |
| 45 void OnOrientationData(Orientation* orientation); | 49 void OnOrientationData(Orientation* orientation); |
| 46 const Orientation* GetOrientation(); | 50 const Orientation* GetOrientation(); |
| 47 | 51 |
| 48 base::win::ScopedComPtr<ISensor> sensor_; | 52 base::win::ScopedComPtr<ISensor> sensor_; |
| 49 | 53 |
| 50 // Value returned by GetDeviceData. | 54 // Value returned by GetDeviceData. |
| 51 scoped_refptr<Orientation> current_orientation_; | 55 scoped_refptr<Orientation> current_orientation_; |
| 52 | 56 |
| 53 // The 1-element buffer follows DataFetcherImplAndroid implementation. | 57 // The 1-element buffer follows DataFetcherImplAndroid implementation. |
| 54 // It is written by OnOrientationData and read by GetDeviceData. | 58 // It is written by OnOrientationData and read by GetDeviceData. |
| 55 base::Lock next_orientation_lock_; | 59 base::Lock next_orientation_lock_; |
| 56 scoped_refptr<Orientation> next_orientation_; | 60 scoped_refptr<Orientation> next_orientation_; |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplWin); | 62 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplWin); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace content | 65 } // namespace content |
| 62 | 66 |
| 63 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ | 67 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_WIN_H_ |
| OLD | NEW |