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 // For platforms with a push API for accelerometer sensors this delegate can be | |
| 18 // implemented. Once notified to start fetching data, the callback provided can | |
| 19 // be used to send the data. | |
| 20 class CONTENT_EXPORT SensorManagerDelegate { | |
| 21 public: | |
| 22 SensorManagerDelegate(); | |
| 23 virtual ~SensorManagerDelegate(); | |
| 24 | |
| 25 // Returns the SensorManagerDelegate singleton | |
| 26 static SensorManagerDelegate* GetInstance(); | |
| 27 | |
| 28 // True if a SensorManagerDelegate has been set. | |
| 29 static bool HasInstance(); | |
| 30 | |
| 31 // Allows platforms to provide a delegate. | |
| 32 static void SetDelegate(SensorManagerDelegate* delegate); | |
| 33 | |
| 34 // Start processing accelerometer events for orientation. The values can be | |
| 35 // passed via |callback| | |
| 36 virtual void StartFetchingDeviceOrientationData( | |
| 37 const base::Callback<void(double, double, double)>& callback) = 0; | |
|
flackr
2014/11/13 00:07:34
Can you typedef this callback type? Include x, y,
jonross
2014/11/13 01:34:05
Done.
| |
| 38 | |
| 39 // Stop processing accelerometer events for orientation. | |
| 40 virtual void StopFetchingDeviceOrientationData() = 0; | |
| 41 | |
| 42 private: | |
| 43 static SensorManagerDelegate* delegate_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(SensorManagerDelegate); | |
| 46 }; | |
| 47 | |
| 48 } // namespace content | |
| 49 | |
| 50 #endif // CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_ | |
| OLD | NEW |