Chromium Code Reviews| Index: content/browser/sensors/sensors_source_chromeos.h |
| diff --git a/content/browser/sensors/sensors_source_chromeos.h b/content/browser/sensors/sensors_source_chromeos.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dbba845caae7a778cc60498b62152769083c3603 |
| --- /dev/null |
| +++ b/content/browser/sensors/sensors_source_chromeos.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_ |
| +#define CONTENT_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| + |
| +#include <string> |
| + |
| +namespace dbus { |
| +class Bus; |
| +class ObjectProxy; |
| +class Signal; |
| +} // namespace |
| + |
| +namespace sensors { |
|
sky
2011/09/12 21:21:19
I'm not familiar with sensors, and it doesn't look
cwolfe
2011/09/12 22:15:55
Whoops. Fixed the macros.
I added content/browser
|
| + |
| +// Creates and manages a dbus signal receiver for device orientation changes, |
| +// and eventually receives data for other motion-related sensors. |
| +class SensorsSourceChromeos |
| + : public base::RefCountedThreadSafe<SensorsSourceChromeos> { |
| + public: |
| + // Creates an inactive sensors source. |
| + SensorsSourceChromeos(); |
| + |
| + // Initializes this sensor source and begins listening for signals. |
| + // Returns true if the |
|
sky
2011/09/12 21:21:19
update comment.
cwolfe
2011/09/12 22:15:55
Done.
|
| + // |
| + // The sensor source currently performs DBus operations using |
| + // BrowserThread::IO, which have been started before calling this method. |
| + bool Init(); |
| + |
| + // Shuts down this sensors source and the underlying DBus connection. |
| + void Stop(); |
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<SensorsSourceChromeos>; |
| + virtual ~SensorsSourceChromeos(); |
| + |
| + // Called by dbus:: when an orientation change signal is received. |
| + void OrientationChangedReceived(dbus::Signal* signal); |
| + |
| + // Called by dbus:: when the orientation change signal is initially connected. |
| + void OrientationChangedConnected(const std::string& interface_name, |
| + const std::string& signal_name, |
| + bool success); |
| + |
| + scoped_refptr<dbus::Bus> bus_; |
| + dbus::ObjectProxy* sensors_proxy_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SensorsSourceChromeos); |
| +}; |
| + |
| +} // namespace sensors |
| + |
| +#endif // CONTENT_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_ |