OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
timvolodine
2014/11/24 14:51:05
also should this file be called _chromeos, since i
jonross
2014/11/24 22:53:01
Done.
| |
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 x, double y, double z)> | |
18 OrientationDataCallback; | |
19 | |
20 // For platforms with a push API for accelerometer sensors this delegate can be | |
21 // implemented. Once notified to start fetching data, the callback provided can | |
22 // be used to send the data. | |
23 class CONTENT_EXPORT SensorManagerDelegate { | |
timvolodine
2014/11/24 14:51:05
The implementation uses lots of singletons (e.g. b
jonross
2014/11/24 22:53:01
This poses some problems with how the code is curr
| |
24 public: | |
25 SensorManagerDelegate(); | |
26 virtual ~SensorManagerDelegate(); | |
27 | |
28 // Returns the SensorManagerDelegate singleton | |
29 static SensorManagerDelegate* GetInstance(); | |
timvolodine
2014/11/24 14:51:05
you have both GetInstance() and public constructor
jonross
2014/11/24 22:53:01
I've moved the constructor to protected. GetInstan
| |
30 | |
31 // True if a SensorManagerDelegate has been set. | |
32 static bool HasInstance(); | |
33 | |
34 // Allows platforms to provide a delegate. | |
35 static void SetDelegate(SensorManagerDelegate* delegate); | |
36 | |
37 // Start processing accelerometer events for orientation. The values can be | |
38 // passed via |callback| | |
39 virtual void StartFetchingDeviceOrientationData( | |
40 const OrientationDataCallback& callback) = 0; | |
41 | |
42 // Stop processing accelerometer events for orientation. | |
43 virtual void StopFetchingDeviceOrientationData() = 0; | |
44 | |
45 private: | |
46 static SensorManagerDelegate* delegate_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(SensorManagerDelegate); | |
49 }; | |
50 | |
51 } // namespace content | |
52 | |
53 #endif // CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_ | |
OLD | NEW |