| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_DBUS_SENSORS_SOURCE_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_SENSORS_SOURCE_H_ | |
| 7 | |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 #include "content/browser/browser_thread.h" | |
| 10 | |
| 11 #include <string> | |
| 12 | |
| 13 namespace dbus { | |
| 14 class Bus; | |
| 15 class ObjectProxy; | |
| 16 class Signal; | |
| 17 } // namespace | |
| 18 | |
| 19 namespace chromeos { | |
| 20 | |
| 21 // Creates and manages a dbus signal receiver for device orientation changes, | |
| 22 // and eventually receives data for other motion-related sensors. | |
| 23 class SensorsSource { | |
| 24 public: | |
| 25 // Creates an inactive sensors source. | |
| 26 SensorsSource(); | |
| 27 virtual ~SensorsSource(); | |
| 28 | |
| 29 // Initializes this sensor source and begins listening for signals. | |
| 30 // Returns true on success. | |
| 31 void Init(dbus::Bus* bus); | |
| 32 | |
| 33 private: | |
| 34 // Called by dbus:: in when an orientation change signal is received. | |
| 35 void OrientationChangedReceived(dbus::Signal* signal); | |
| 36 | |
| 37 // Called by dbus:: when the orientation change signal is initially connected. | |
| 38 void OrientationChangedConnected(const std::string& interface_name, | |
| 39 const std::string& signal_name, | |
| 40 bool success); | |
| 41 | |
| 42 dbus::ObjectProxy* sensors_proxy_; | |
| 43 base::WeakPtrFactory<SensorsSource> weak_ptr_factory_; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(SensorsSource); | |
| 46 }; | |
| 47 | |
| 48 } // namespace chromeos | |
| 49 | |
| 50 #endif // CHROME_BROWSER_CHROMEOS_DBUS_SENSORS_SOURCE_H_ | |
| OLD | NEW |