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/stl_util.h" | 9 #include "base/stl_util.h" |
9 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
10 #include "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h" | 11 #include "chrome/browser/chromeos/dbus/proxy_resolution_service_provider.h" |
11 #include "chrome/browser/chromeos/system/runtime_environment.h" | |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "dbus/bus.h" | 13 #include "dbus/bus.h" |
14 #include "dbus/exported_object.h" | 14 #include "dbus/exported_object.h" |
15 #include "dbus/object_path.h" | 15 #include "dbus/object_path.h" |
16 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 | 19 |
20 // The CrosDBusService implementation used in production, and unit tests. | 20 // The CrosDBusService implementation used in production, and unit tests. |
21 class CrosDBusServiceImpl : public CrosDBusService { | 21 class CrosDBusServiceImpl : public CrosDBusService { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 virtual ~CrosDBusServiceStubImpl() { | 92 virtual ~CrosDBusServiceStubImpl() { |
93 } | 93 } |
94 | 94 |
95 // CrosDBusService override. | 95 // CrosDBusService override. |
96 virtual void Start() { | 96 virtual void Start() { |
97 } | 97 } |
98 }; | 98 }; |
99 | 99 |
100 // static | 100 // static |
101 CrosDBusService* CrosDBusService::Create(dbus::Bus* bus) { | 101 CrosDBusService* CrosDBusService::Create(dbus::Bus* bus) { |
102 if (system::runtime_environment::IsRunningOnChromeOS()) { | 102 if (base::chromeos::IsRunningOnChromeOS()) { |
103 CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus); | 103 CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus); |
104 service->RegisterServiceProvider(ProxyResolutionServiceProvider::Create()); | 104 service->RegisterServiceProvider(ProxyResolutionServiceProvider::Create()); |
105 return service; | 105 return service; |
106 } else { | 106 } else { |
107 return new CrosDBusServiceStubImpl; | 107 return new CrosDBusServiceStubImpl; |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 CrosDBusService* CrosDBusService::CreateForTesting( | 112 CrosDBusService* CrosDBusService::CreateForTesting( |
113 dbus::Bus* bus, | 113 dbus::Bus* bus, |
114 ServiceProviderInterface* proxy_resolution_service) { | 114 ServiceProviderInterface* proxy_resolution_service) { |
115 CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus); | 115 CrosDBusServiceImpl* service = new CrosDBusServiceImpl(bus); |
116 service->RegisterServiceProvider(proxy_resolution_service); | 116 service->RegisterServiceProvider(proxy_resolution_service); |
117 return service; | 117 return service; |
118 } | 118 } |
119 | 119 |
120 CrosDBusService::~CrosDBusService() { | 120 CrosDBusService::~CrosDBusService() { |
121 } | 121 } |
122 | 122 |
123 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() { | 123 CrosDBusService::ServiceProviderInterface::~ServiceProviderInterface() { |
124 } | 124 } |
125 | 125 |
126 } // namespace chromeos | 126 } // namespace chromeos |
OLD | NEW |