| 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 "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 5 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual ~CrosDBusServiceStubImpl() { | 98 virtual ~CrosDBusServiceStubImpl() { |
| 99 } | 99 } |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 // static | 102 // static |
| 103 void CrosDBusService::Initialize() { | 103 void CrosDBusService::Initialize() { |
| 104 if (g_cros_dbus_service) { | 104 if (g_cros_dbus_service) { |
| 105 LOG(WARNING) << "CrosDBusService was already initialized"; | 105 LOG(WARNING) << "CrosDBusService was already initialized"; |
| 106 return; | 106 return; |
| 107 } | 107 } |
| 108 if (base::chromeos::IsRunningOnChromeOS()) { | 108 dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus(); |
| 109 dbus::Bus* bus = DBusThreadManager::Get()->GetSystemBus(); | 109 if (base::chromeos::IsRunningOnChromeOS() && bus) { |
| 110 CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus); | 110 CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus); |
| 111 service->RegisterServiceProvider(ProxyResolutionServiceProvider::Create()); | 111 service->RegisterServiceProvider(ProxyResolutionServiceProvider::Create()); |
| 112 g_cros_dbus_service = service; | 112 g_cros_dbus_service = service; |
| 113 service->Start(); | 113 service->Start(); |
| 114 } else { | 114 } else { |
| 115 g_cros_dbus_service = new CrosDBusServiceStubImpl; | 115 g_cros_dbus_service = new CrosDBusServiceStubImpl; |
| 116 } | 116 } |
| 117 VLOG(1) << "CrosDBusService initialized"; | 117 VLOG(1) << "CrosDBusService initialized"; |
| 118 } | 118 } |
| 119 | 119 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 139 VLOG(1) << "CrosDBusService Shutdown completed"; | 139 VLOG(1) << "CrosDBusService Shutdown completed"; |
| 140 } | 140 } |
| 141 | 141 |
| 142 CrosDBusService::~CrosDBusService() { | 142 CrosDBusService::~CrosDBusService() { |
| 143 } | 143 } |
| 144 | 144 |
| 145 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() { | 145 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() { |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace chromeos | 148 } // namespace chromeos |
| OLD | NEW |