OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ |
| 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/shared_memory.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "content/common/device_motion_hardware_buffer.h" |
| 12 |
| 13 namespace content { |
| 14 class DataFetcherSharedMemory; |
| 15 |
| 16 // TODO(timvolodine) Implement this class properly. |
| 17 |
| 18 class CONTENT_EXPORT DeviceMotionProvider { |
| 19 public: |
| 20 DeviceMotionProvider(); |
| 21 virtual ~DeviceMotionProvider(); |
| 22 |
| 23 // Returns the shared memory handle of the device motion data duplicated |
| 24 // into the given process. |
| 25 base::SharedMemoryHandle GetSharedMemoryHandleForProcess( |
| 26 base::ProcessHandle renderer_process); |
| 27 |
| 28 // Pause and resume the background polling thread. Can be called from any |
| 29 // thread. |
| 30 void StartFetchingDeviceMotionData(); |
| 31 void StopFetchingDeviceMotionData(); |
| 32 |
| 33 private: |
| 34 static DeviceMotionProvider* instance_; |
| 35 |
| 36 base::SharedMemory device_motion_shared_memory_; |
| 37 |
| 38 DeviceMotionHardwareBuffer* SharedMemoryAsHardwareBuffer(); |
| 39 |
| 40 scoped_ptr<DataFetcherSharedMemory> data_fetcher_; |
| 41 |
| 42 bool is_started_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(DeviceMotionProvider); |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DEVICE_MOTION_PROVIDER_H_ |
OLD | NEW |