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_DATA_FETCHER_SHARED_MEMORY_H_ |
| 6 #define CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_ |
| 7 |
| 8 #include "content/browser/device_orientation/device_data.h" |
| 9 #include "content/common/device_motion_hardware_buffer.h" |
| 10 |
| 11 namespace WebKit { |
| 12 class WebDeviceMotionData; |
| 13 } |
| 14 |
| 15 namespace content { |
| 16 |
| 17 class DataFetcherSharedMemory { |
| 18 public: |
| 19 DataFetcherSharedMemory() : device_motion_buffer_(NULL) { } |
| 20 virtual ~DataFetcherSharedMemory(); |
| 21 |
| 22 // Returns true if this fetcher needs explicit calls to fetch the data. |
| 23 virtual bool NeedsPolling(); |
| 24 |
| 25 // If this fetcher NeedsPolling() is true, this method will update the |
| 26 // buffer with the latest device motion data. |
| 27 // This method will do nothing if NeedsPolling() is false. |
| 28 // Returns true if there was any motion data to update the buffer with. |
| 29 virtual bool FetchDeviceMotionDataIntoBuffer(); |
| 30 |
| 31 // Returns true if the relevant sensors could be successfully activated. |
| 32 // This method should be called before any calls to |
| 33 // FetchDeviceMotionDataIntoBuffer(). |
| 34 virtual bool StartFetchingDeviceMotionData( |
| 35 DeviceMotionHardwareBuffer* buffer); |
| 36 |
| 37 // Indicates to the fetcher to stop fetching device data. |
| 38 virtual void StopFetchingDeviceMotionData(); |
| 39 |
| 40 private: |
| 41 DeviceMotionHardwareBuffer* device_motion_buffer_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); |
| 44 }; |
| 45 |
| 46 } // namespace content |
| 47 |
| 48 #endif // CONTENT_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_SHARED_MEMORY_H_ |
OLD | NEW |