OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/dbus/dbus_thread_manager.h" | 5 #include "chromeos/dbus/dbus_thread_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/chromeos/chromeos_version.h" | |
10 #include "base/command_line.h" | 9 #include "base/command_line.h" |
11 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "base/sys_info.h" |
12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
13 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
14 #include "chromeos/dbus/bluetooth_adapter_client.h" | 14 #include "chromeos/dbus/bluetooth_adapter_client.h" |
15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
16 #include "chromeos/dbus/bluetooth_device_client.h" | 16 #include "chromeos/dbus/bluetooth_device_client.h" |
17 #include "chromeos/dbus/bluetooth_input_client.h" | 17 #include "chromeos/dbus/bluetooth_input_client.h" |
18 #include "chromeos/dbus/bluetooth_profile_manager_client.h" | 18 #include "chromeos/dbus/bluetooth_profile_manager_client.h" |
19 #include "chromeos/dbus/cras_audio_client.h" | 19 #include "chromeos/dbus/cras_audio_client.h" |
20 #include "chromeos/dbus/cros_disks_client.h" | 20 #include "chromeos/dbus/cros_disks_client.h" |
21 #include "chromeos/dbus/cryptohome_client.h" | 21 #include "chromeos/dbus/cryptohome_client.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // static | 414 // static |
415 void DBusThreadManager::Initialize() { | 415 void DBusThreadManager::Initialize() { |
416 // Ignore Initialize() if we set a test DBusThreadManager. | 416 // Ignore Initialize() if we set a test DBusThreadManager. |
417 if (g_dbus_thread_manager_set_for_testing) | 417 if (g_dbus_thread_manager_set_for_testing) |
418 return; | 418 return; |
419 // If we initialize DBusThreadManager twice we may also be shutting it down | 419 // If we initialize DBusThreadManager twice we may also be shutting it down |
420 // early; do not allow that. | 420 // early; do not allow that. |
421 CHECK(g_dbus_thread_manager == NULL); | 421 CHECK(g_dbus_thread_manager == NULL); |
422 // Determine whether we use stub or real client implementations. | 422 // Determine whether we use stub or real client implementations. |
423 DBusThreadManagerImpl* dbus_thread_manager_impl; | 423 DBusThreadManagerImpl* dbus_thread_manager_impl; |
424 if (base::chromeos::IsRunningOnChromeOS()) { | 424 if (base::SysInfo::IsRunningOnChromeOS()) { |
425 dbus_thread_manager_impl = | 425 dbus_thread_manager_impl = |
426 new DBusThreadManagerImpl(REAL_DBUS_CLIENT_IMPLEMENTATION); | 426 new DBusThreadManagerImpl(REAL_DBUS_CLIENT_IMPLEMENTATION); |
427 VLOG(1) << "DBusThreadManager initialized for ChromeOS"; | 427 VLOG(1) << "DBusThreadManager initialized for ChromeOS"; |
428 } else { | 428 } else { |
429 dbus_thread_manager_impl = | 429 dbus_thread_manager_impl = |
430 new DBusThreadManagerImpl(STUB_DBUS_CLIENT_IMPLEMENTATION); | 430 new DBusThreadManagerImpl(STUB_DBUS_CLIENT_IMPLEMENTATION); |
431 VLOG(1) << "DBusThreadManager initialized with Stub"; | 431 VLOG(1) << "DBusThreadManager initialized with Stub"; |
432 } | 432 } |
433 g_dbus_thread_manager = dbus_thread_manager_impl; | 433 g_dbus_thread_manager = dbus_thread_manager_impl; |
434 dbus_thread_manager_impl->InitializeClients(); | 434 dbus_thread_manager_impl->InitializeClients(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 } | 494 } |
495 | 495 |
496 // static | 496 // static |
497 DBusThreadManager* DBusThreadManager::Get() { | 497 DBusThreadManager* DBusThreadManager::Get() { |
498 CHECK(g_dbus_thread_manager) | 498 CHECK(g_dbus_thread_manager) |
499 << "DBusThreadManager::Get() called before Initialize()"; | 499 << "DBusThreadManager::Get() called before Initialize()"; |
500 return g_dbus_thread_manager; | 500 return g_dbus_thread_manager; |
501 } | 501 } |
502 | 502 |
503 } // namespace chromeos | 503 } // namespace chromeos |
OLD | NEW |