OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/experimental_bluetooth_profile_service_provider.h" | 5 #include "chromeos/dbus/experimental_bluetooth_profile_service_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/chromeos/chromeos_version.h" | 10 #include "base/chromeos/chromeos_version.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "chromeos/dbus/fake_bluetooth_profile_service_provider.h" |
14 #include "dbus/bus.h" | 15 #include "dbus/bus.h" |
15 #include "dbus/exported_object.h" | 16 #include "dbus/exported_object.h" |
16 #include "dbus/message.h" | 17 #include "dbus/message.h" |
17 #include "dbus/object_path.h" | 18 #include "dbus/object_path.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 | 22 |
22 // The ExperimentalBluetoothProfileServiceProvider implementation used in | 23 // The ExperimentalBluetoothProfileServiceProvider implementation used in |
23 // production. | 24 // production. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Weak pointer factory for generating 'this' pointers that might live longer | 247 // Weak pointer factory for generating 'this' pointers that might live longer |
247 // than we do. | 248 // than we do. |
248 // Note: This should remain the last member so it'll be destroyed and | 249 // Note: This should remain the last member so it'll be destroyed and |
249 // invalidate its weak pointers before any other members are destroyed. | 250 // invalidate its weak pointers before any other members are destroyed. |
250 base::WeakPtrFactory<ExperimentalBluetoothProfileServiceProviderImpl> | 251 base::WeakPtrFactory<ExperimentalBluetoothProfileServiceProviderImpl> |
251 weak_ptr_factory_; | 252 weak_ptr_factory_; |
252 | 253 |
253 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileServiceProviderImpl); | 254 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileServiceProviderImpl); |
254 }; | 255 }; |
255 | 256 |
256 // The ExperimentalBluetoothProfileServiceProvider implementation used on Linux | |
257 // desktop, which does nothing. | |
258 class ExperimentalBluetoothProfileServiceProviderStubImpl | |
259 : public ExperimentalBluetoothProfileServiceProvider { | |
260 public: | |
261 explicit ExperimentalBluetoothProfileServiceProviderStubImpl( | |
262 Delegate* delegate) { | |
263 } | |
264 | |
265 virtual ~ExperimentalBluetoothProfileServiceProviderStubImpl() { | |
266 } | |
267 }; | |
268 | |
269 ExperimentalBluetoothProfileServiceProvider:: | 257 ExperimentalBluetoothProfileServiceProvider:: |
270 ExperimentalBluetoothProfileServiceProvider() { | 258 ExperimentalBluetoothProfileServiceProvider() { |
271 } | 259 } |
272 | 260 |
273 ExperimentalBluetoothProfileServiceProvider:: | 261 ExperimentalBluetoothProfileServiceProvider:: |
274 ~ExperimentalBluetoothProfileServiceProvider() { | 262 ~ExperimentalBluetoothProfileServiceProvider() { |
275 } | 263 } |
276 | 264 |
277 // static | 265 // static |
278 ExperimentalBluetoothProfileServiceProvider* | 266 ExperimentalBluetoothProfileServiceProvider* |
279 ExperimentalBluetoothProfileServiceProvider::Create( | 267 ExperimentalBluetoothProfileServiceProvider::Create( |
280 dbus::Bus* bus, | 268 dbus::Bus* bus, |
281 const dbus::ObjectPath& object_path, | 269 const dbus::ObjectPath& object_path, |
282 Delegate* delegate) { | 270 Delegate* delegate) { |
283 if (base::chromeos::IsRunningOnChromeOS()) { | 271 if (base::chromeos::IsRunningOnChromeOS()) { |
284 return new ExperimentalBluetoothProfileServiceProviderImpl( | 272 return new ExperimentalBluetoothProfileServiceProviderImpl( |
285 bus, object_path, delegate); | 273 bus, object_path, delegate); |
286 } else { | 274 } else { |
287 return new ExperimentalBluetoothProfileServiceProviderStubImpl(delegate); | 275 return new FakeBluetoothProfileServiceProvider(object_path, delegate); |
288 } | 276 } |
289 } | 277 } |
290 | 278 |
291 } // namespace chromeos | 279 } // namespace chromeos |
OLD | NEW |