OLD | NEW |
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 CrosDBusService; | 22 class CrosDBusService; |
23 class PowerManagerClient; | 23 class PowerManagerClient; |
24 class SessionManagerClient; | 24 class SessionManagerClient; |
25 class SensorsSource; | 25 class SensorsSource; |
| 26 class SpeechSynthesizerClient; |
26 | 27 |
27 // DBusThreadManager manages the D-Bus thread, the thread dedicated to | 28 // DBusThreadManager manages the D-Bus thread, the thread dedicated to |
28 // handling asynchronous D-Bus operations. | 29 // handling asynchronous D-Bus operations. |
29 // | 30 // |
30 // This class also manages D-Bus connections and D-Bus clients, which | 31 // This class also manages D-Bus connections and D-Bus clients, which |
31 // depend on the D-Bus thread to ensure the right order of shutdowns for | 32 // depend on the D-Bus thread to ensure the right order of shutdowns for |
32 // the D-Bus thread, the D-Bus connections, and the D-Bus clients. | 33 // the D-Bus thread, the D-Bus connections, and the D-Bus clients. |
33 // | 34 // |
34 // CALLBACKS IN D-BUS CLIENTS: | 35 // CALLBACKS IN D-BUS CLIENTS: |
35 // | 36 // |
(...skipping 30 matching lines...) Expand all Loading... |
66 // down. | 67 // down. |
67 SessionManagerClient* session_manager_client() { | 68 SessionManagerClient* session_manager_client() { |
68 return session_manager_client_.get(); | 69 return session_manager_client_.get(); |
69 } | 70 } |
70 | 71 |
71 // Sets the session manager client. Takes the ownership. | 72 // Sets the session manager client. Takes the ownership. |
72 // The function is exported for testing. | 73 // The function is exported for testing. |
73 void set_session_manager_client_for_testing( | 74 void set_session_manager_client_for_testing( |
74 SessionManagerClient* session_manager_client); | 75 SessionManagerClient* session_manager_client); |
75 | 76 |
| 77 // Returns the speech synthesizer client, owned by DBusThreadManager. |
| 78 // Do not cache this pointer and use it after DBusThreadManager is shut |
| 79 // down. |
| 80 SpeechSynthesizerClient* speech_synthesizer_client() { |
| 81 return speech_synthesizer_client_.get(); |
| 82 } |
| 83 |
76 private: | 84 private: |
77 DBusThreadManager(); | 85 DBusThreadManager(); |
78 virtual ~DBusThreadManager(); | 86 virtual ~DBusThreadManager(); |
79 | 87 |
80 scoped_ptr<base::Thread> dbus_thread_; | 88 scoped_ptr<base::Thread> dbus_thread_; |
81 scoped_refptr<dbus::Bus> system_bus_; | 89 scoped_refptr<dbus::Bus> system_bus_; |
82 CrosDBusService* cros_dbus_service_; | 90 CrosDBusService* cros_dbus_service_; |
83 scoped_ptr<SensorsSource> sensors_source_; | 91 scoped_ptr<SensorsSource> sensors_source_; |
84 scoped_ptr<PowerManagerClient> power_manager_client_; | 92 scoped_ptr<PowerManagerClient> power_manager_client_; |
85 scoped_ptr<SessionManagerClient> session_manager_client_; | 93 scoped_ptr<SessionManagerClient> session_manager_client_; |
| 94 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; |
86 | 95 |
87 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); | 96 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); |
88 }; | 97 }; |
89 | 98 |
90 } // namespace chromeos | 99 } // namespace chromeos |
91 | 100 |
92 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 101 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
OLD | NEW |