OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_SENSORS_PROVIDER_H_ | |
6 #define CONTENT_PUBLIC_BROWSER_SENSORS_PROVIDER_H_ | |
7 #pragma once | |
8 | |
9 #include "content/common/content_export.h" | |
10 #include "content/public/browser/sensors.h" | |
11 | |
12 // The sensors API will unify various types of sensor data into a set of | |
13 // channels, each of which provides change events and periodic updates. | |
14 // | |
15 // This version of the API is intended only to support the experimental screen | |
16 // rotation code and is not for general use. In particular, the final listener | |
17 // will declare generic |OnSensorChanged| and |OnSensorUpdated| methods, rather | |
18 // than the special-purpose |OnScreenOrientationChanged|. | |
19 | |
20 namespace content { | |
21 | |
22 class SensorsListener; | |
23 | |
24 // TODO(cwolfe): Finish defining the initial set of channels and replace this | |
25 // with the generic sensor provider. | |
26 class SensorsProvider { | |
27 public: | |
28 CONTENT_EXPORT static SensorsProvider* GetInstance(); | |
29 | |
30 // Adds a sensor listener. The listener will receive callbacks to indicate | |
31 // sensor changes and updates until it is removed. | |
32 // | |
33 // This method may be called in any thread. Callbacks on a listener will | |
34 // always be executed in the thread which added that listener. | |
35 virtual void AddListener(SensorsListener* listener) = 0; | |
36 | |
37 // Removes a sensor listener. | |
38 // | |
39 // This method must be called in the same thread which added the listener. | |
40 // If the listener is not currently subscribed, this method may be called in | |
41 // any thread. | |
42 virtual void RemoveListener(SensorsListener* listener) = 0; | |
43 | |
44 // Broadcasts a change to the coarse screen orientation. | |
45 // | |
46 // This method may be called in any thread. | |
47 virtual void ScreenOrientationChanged(ScreenOrientation change) = 0; | |
48 | |
49 protected: | |
50 virtual ~SensorsProvider() {} | |
51 }; | |
52 | |
53 } // namespace content | |
54 | |
55 #endif // CONTENT_PUBLIC_BROWSER_SENSORS_PROVIDER_H_ | |
OLD | NEW |