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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_SENSORS_SOURCE_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_
7
8 #include "base/memory/ref_counted.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 sensors {
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 SensorsSourceChromeos
24 : public base::RefCountedThreadSafe<SensorsSourceChromeos,
25 BrowserThread::DeleteOnUIThread> {
26 public:
27 // Creates an inactive sensors source.
28 SensorsSourceChromeos();
29
30 // Initializes this sensor source and begins listening for signals.
31 // Returns true on success.
32 //
33 // The sensor source performs DBus operations using BrowserThread::FILE,
34 // which must have been started before calling this method.
35 bool Init();
36
37 // Shuts down this sensors source and the underlying DBus connection.
38 void Stop();
39
40 private:
41 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
42 friend class DeleteTask<SensorsSourceChromeos>;
43 virtual ~SensorsSourceChromeos();
44
45 // Called by dbus:: in when an orientation change signal is received.
46 void OrientationChangedReceived(dbus::Signal* signal);
47
48 // Called by dbus:: when the orientation change signal is initially connected.
49 void OrientationChangedConnected(const std::string& interface_name,
50 const std::string& signal_name,
51 bool success);
52
53 scoped_refptr<dbus::Bus> bus_;
54 dbus::ObjectProxy* sensors_proxy_;
55
56 DISALLOW_COPY_AND_ASSIGN(SensorsSourceChromeos);
57 };
58
59 } // namespace sensors
60
61 #endif // CHROME_BROWSER_CHROMEOS_SENSORS_SOURCE_CHROMEOS_H_
OLDNEW
« 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