Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: chrome/browser/chromeos/sensors_source_chromeos.h

Issue 7862020: chromeos: Add operations to monitor the screen orientation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Rebased with fixed line endings in DEPS Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/sensors_source_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/sensors_source_chromeos.h
diff --git a/chrome/browser/chromeos/sensors_source_chromeos.h b/chrome/browser/chromeos/sensors_source_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..fe8cc6f8cca8f016773f990ee7c5b0ae3dede3b5
--- /dev/null
+++ b/chrome/browser/chromeos/sensors_source_chromeos.h
@@ -0,0 +1,61 @@
+// 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 CHROME_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_
+#define CHROME_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_
+
+#include "base/memory/ref_counted.h"
+#include "content/browser/browser_thread.h"
+
+#include <string>
+
+namespace dbus {
+class Bus;
+class ObjectProxy;
+class Signal;
+} // namespace
+
+namespace sensors {
+
+// 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,
+ BrowserThread::DeleteOnUIThread> {
+ public:
+ // Creates an inactive sensors source.
+ SensorsSourceChromeos();
+
+ // Initializes this sensor source and begins listening for signals.
+ // Returns true on success.
+ //
+ // The sensor source performs DBus operations using BrowserThread::FILE,
+ // which must have been started before calling this method.
+ bool Init();
+
+ // Shuts down this sensors source and the underlying DBus connection.
+ void Stop();
+
+ private:
+ friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
+ friend class DeleteTask<SensorsSourceChromeos>;
+ virtual ~SensorsSourceChromeos();
+
+ // Called by dbus:: in 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 // CHROME_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/sensors_source_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698