Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 | |
| 12 template <typename T> | |
| 13 struct DefaultSingletonTraits; | |
| 14 | |
| 15 namespace content { | |
| 16 | |
| 17 typedef base::Callback<void(double, double, double)> OrientationDataXYZCallback; | |
|
flackr
2014/11/13 21:09:22
nit: double x, double y, double z
Also s/Orientati
jonross
2014/11/17 21:54:10
Done.
| |
| 18 | |
| 19 // For platforms with a push API for accelerometer sensors this delegate can be | |
| 20 // implemented. Once notified to start fetching data, the callback provided can | |
| 21 // be used to send the data. | |
| 22 class CONTENT_EXPORT SensorManagerDelegate { | |
| 23 public: | |
| 24 SensorManagerDelegate(); | |
| 25 virtual ~SensorManagerDelegate(); | |
| 26 | |
| 27 // Returns the SensorManagerDelegate singleton | |
| 28 static SensorManagerDelegate* GetInstance(); | |
| 29 | |
| 30 // True if a SensorManagerDelegate has been set. | |
| 31 static bool HasInstance(); | |
| 32 | |
| 33 // Allows platforms to provide a delegate. | |
| 34 static void SetDelegate(SensorManagerDelegate* delegate); | |
| 35 | |
| 36 // Start processing accelerometer events for orientation. The values can be | |
| 37 // passed via |callback| | |
| 38 virtual void StartFetchingDeviceOrientationData( | |
| 39 const OrientationDataXYZCallback& callback) = 0; | |
| 40 | |
| 41 // Stop processing accelerometer events for orientation. | |
| 42 virtual void StopFetchingDeviceOrientationData() = 0; | |
| 43 | |
| 44 private: | |
| 45 static SensorManagerDelegate* delegate_; | |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(SensorManagerDelegate); | |
| 48 }; | |
| 49 | |
| 50 } // namespace content | |
| 51 | |
| 52 #endif // CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_ | |
| OLD | NEW |