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

Side by Side Diff: chrome/browser/chromeos/dbus/dbus_thread_manager.h

Issue 8375042: Chrome OS: Add bluetooth dbus clients for device discovery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 11
12 namespace base { 12 namespace base {
13 class Thread; 13 class Thread;
14 }; 14 };
15 15
16 namespace dbus { 16 namespace dbus {
17 class Bus; 17 class Bus;
18 }; 18 };
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 class BluetoothAdapterClient;
23 class BluetoothManagerClient;
22 class CrosDBusService; 24 class CrosDBusService;
23 class PowerManagerClient; 25 class PowerManagerClient;
24 class SessionManagerClient; 26 class SessionManagerClient;
25 class SensorsSource; 27 class SensorsSource;
26 class SpeechSynthesizerClient; 28 class SpeechSynthesizerClient;
27 29
28 // DBusThreadManager manages the D-Bus thread, the thread dedicated to 30 // DBusThreadManager manages the D-Bus thread, the thread dedicated to
29 // handling asynchronous D-Bus operations. 31 // handling asynchronous D-Bus operations.
30 // 32 //
31 // This class also manages D-Bus connections and D-Bus clients, which 33 // This class also manages D-Bus connections and D-Bus clients, which
(...skipping 17 matching lines...) Expand all
49 // We explicitly initialize and shut down the global object, rather than 51 // We explicitly initialize and shut down the global object, rather than
50 // making it a Singleton, to ensure clean startup and shutdown. 52 // making it a Singleton, to ensure clean startup and shutdown.
51 static void Initialize(); 53 static void Initialize();
52 54
53 // Destroys the global instance. 55 // Destroys the global instance.
54 static void Shutdown(); 56 static void Shutdown();
55 57
56 // Gets the global instance. Initialize() must be called first. 58 // Gets the global instance. Initialize() must be called first.
57 static DBusThreadManager* Get(); 59 static DBusThreadManager* Get();
58 60
61 // Returns the bluetooth manager client, owned by DBusThreadManager.
62 // Do not cache this pointer and use it after DBusThreadManager is shut
63 // down.
64 BluetoothManagerClient* bluetooth_manager_client() {
65 return bluetooth_manager_client_.get();
66 }
67
68 // Returns the bluetooth adapter client, owned by DBusThreadManager.
69 // Do not cache this pointer and use it after DBusThreadManager is shut
70 // down.
71 BluetoothAdapterClient* bluetooth_adapter_client() {
72 return bluetooth_adapter_client_.get();
73 }
74
59 // Returns the power manager client, owned by DBusThreadManager. 75 // Returns the power manager client, owned by DBusThreadManager.
60 // See also comments at session_manager_client(). 76 // See also comments at session_manager_client().
61 PowerManagerClient* power_manager_client() { 77 PowerManagerClient* power_manager_client() {
62 return power_manager_client_.get(); 78 return power_manager_client_.get();
63 } 79 }
64 80
65 // Returns the session manager client, owned by DBusThreadManager. 81 // Returns the session manager client, owned by DBusThreadManager.
66 // Do not cache this pointer and use it after DBusThreadManager is shut 82 // Do not cache this pointer and use it after DBusThreadManager is shut
67 // down. 83 // down.
68 SessionManagerClient* session_manager_client() { 84 SessionManagerClient* session_manager_client() {
(...skipping 13 matching lines...) Expand all
82 } 98 }
83 99
84 private: 100 private:
85 DBusThreadManager(); 101 DBusThreadManager();
86 virtual ~DBusThreadManager(); 102 virtual ~DBusThreadManager();
87 103
88 scoped_ptr<base::Thread> dbus_thread_; 104 scoped_ptr<base::Thread> dbus_thread_;
89 scoped_refptr<dbus::Bus> system_bus_; 105 scoped_refptr<dbus::Bus> system_bus_;
90 CrosDBusService* cros_dbus_service_; 106 CrosDBusService* cros_dbus_service_;
91 scoped_ptr<SensorsSource> sensors_source_; 107 scoped_ptr<SensorsSource> sensors_source_;
108 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
109 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
92 scoped_ptr<PowerManagerClient> power_manager_client_; 110 scoped_ptr<PowerManagerClient> power_manager_client_;
93 scoped_ptr<SessionManagerClient> session_manager_client_; 111 scoped_ptr<SessionManagerClient> session_manager_client_;
94 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; 112 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_;
95 113
96 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); 114 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager);
97 }; 115 };
98 116
99 } // namespace chromeos 117 } // namespace chromeos
100 118
101 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 119 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698