| 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 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 5 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 9 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 10 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 10 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
| 11 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 11 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 12 #include "chrome/browser/chromeos/dbus/sensors_source.h" | 12 #include "chrome/browser/chromeos/dbus/sensors_source.h" |
| 13 #include "chrome/browser/chromeos/dbus/speech_synthesizer_client.h" |
| 13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 14 #include "dbus/bus.h" | 15 #include "dbus/bus.h" |
| 15 | 16 |
| 16 namespace chromeos { | 17 namespace chromeos { |
| 17 | 18 |
| 18 static DBusThreadManager* g_dbus_thread_manager = NULL; | 19 static DBusThreadManager* g_dbus_thread_manager = NULL; |
| 19 | 20 |
| 20 DBusThreadManager::DBusThreadManager() { | 21 DBusThreadManager::DBusThreadManager() { |
| 21 // Create the D-Bus thread. | 22 // Create the D-Bus thread. |
| 22 base::Thread::Options thread_options; | 23 base::Thread::Options thread_options; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 if (command_line.HasSwitch(switches::kEnableSensors)) { | 42 if (command_line.HasSwitch(switches::kEnableSensors)) { |
| 42 sensors_source_.reset(new SensorsSource); | 43 sensors_source_.reset(new SensorsSource); |
| 43 sensors_source_->Init(system_bus_.get()); | 44 sensors_source_->Init(system_bus_.get()); |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Create the power manager client. | 47 // Create the power manager client. |
| 47 power_manager_client_.reset(PowerManagerClient::Create(system_bus_.get())); | 48 power_manager_client_.reset(PowerManagerClient::Create(system_bus_.get())); |
| 48 // Create the session manager client. | 49 // Create the session manager client. |
| 49 session_manager_client_.reset( | 50 session_manager_client_.reset( |
| 50 SessionManagerClient::Create(system_bus_.get())); | 51 SessionManagerClient::Create(system_bus_.get())); |
| 52 // Create the speech synthesizer client. |
| 53 speech_synthesizer_client_.reset( |
| 54 SpeechSynthesizerClient::Create(system_bus_.get())); |
| 51 } | 55 } |
| 52 | 56 |
| 53 DBusThreadManager::~DBusThreadManager() { | 57 DBusThreadManager::~DBusThreadManager() { |
| 54 // Shut down the bus. During the browser shutdown, it's ok to shut down | 58 // Shut down the bus. During the browser shutdown, it's ok to shut down |
| 55 // the bus synchronously. | 59 // the bus synchronously. |
| 56 system_bus_->ShutdownOnDBusThreadAndBlock(); | 60 system_bus_->ShutdownOnDBusThreadAndBlock(); |
| 57 | 61 |
| 58 // Stop the D-Bus thread. | 62 // Stop the D-Bus thread. |
| 59 dbus_thread_->Stop(); | 63 dbus_thread_->Stop(); |
| 60 | 64 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 89 << "DBusThreadManager::Get() called before Initialize()"; | 93 << "DBusThreadManager::Get() called before Initialize()"; |
| 90 return g_dbus_thread_manager; | 94 return g_dbus_thread_manager; |
| 91 } | 95 } |
| 92 | 96 |
| 93 void DBusThreadManager::set_session_manager_client_for_testing( | 97 void DBusThreadManager::set_session_manager_client_for_testing( |
| 94 SessionManagerClient* session_manager_client) { | 98 SessionManagerClient* session_manager_client) { |
| 95 session_manager_client_.reset(session_manager_client); | 99 session_manager_client_.reset(session_manager_client); |
| 96 } | 100 } |
| 97 | 101 |
| 98 } // namespace chromeos | 102 } // namespace chromeos |
| OLD | NEW |