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_agent_service_provider.h" | 5 #include "chromeos/dbus/experimental_bluetooth_agent_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_agent_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 ExperimentalBluetoothAgentServiceProvider implementation used in | 23 // The ExperimentalBluetoothAgentServiceProvider implementation used in |
23 // production. | 24 // production. |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // Weak pointer factory for generating 'this' pointers that might live longer | 475 // Weak pointer factory for generating 'this' pointers that might live longer |
475 // than we do. | 476 // than we do. |
476 // Note: This should remain the last member so it'll be destroyed and | 477 // Note: This should remain the last member so it'll be destroyed and |
477 // invalidate its weak pointers before any other members are destroyed. | 478 // invalidate its weak pointers before any other members are destroyed. |
478 base::WeakPtrFactory<ExperimentalBluetoothAgentServiceProviderImpl> | 479 base::WeakPtrFactory<ExperimentalBluetoothAgentServiceProviderImpl> |
479 weak_ptr_factory_; | 480 weak_ptr_factory_; |
480 | 481 |
481 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentServiceProviderImpl); | 482 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothAgentServiceProviderImpl); |
482 }; | 483 }; |
483 | 484 |
484 // The ExperimentalBluetoothAgentServiceProvider implementation used on Linux | |
485 // desktop, which does nothing. | |
486 class ExperimentalBluetoothAgentServiceProviderStubImpl | |
487 : public ExperimentalBluetoothAgentServiceProvider { | |
488 public: | |
489 explicit ExperimentalBluetoothAgentServiceProviderStubImpl( | |
490 Delegate* delegate) { | |
491 } | |
492 | |
493 virtual ~ExperimentalBluetoothAgentServiceProviderStubImpl() { | |
494 } | |
495 }; | |
496 | |
497 ExperimentalBluetoothAgentServiceProvider:: | 485 ExperimentalBluetoothAgentServiceProvider:: |
498 ExperimentalBluetoothAgentServiceProvider() { | 486 ExperimentalBluetoothAgentServiceProvider() { |
499 } | 487 } |
500 | 488 |
501 ExperimentalBluetoothAgentServiceProvider:: | 489 ExperimentalBluetoothAgentServiceProvider:: |
502 ~ExperimentalBluetoothAgentServiceProvider() { | 490 ~ExperimentalBluetoothAgentServiceProvider() { |
503 } | 491 } |
504 | 492 |
505 // static | 493 // static |
506 ExperimentalBluetoothAgentServiceProvider* | 494 ExperimentalBluetoothAgentServiceProvider* |
507 ExperimentalBluetoothAgentServiceProvider::Create( | 495 ExperimentalBluetoothAgentServiceProvider::Create( |
508 dbus::Bus* bus, | 496 dbus::Bus* bus, |
509 const dbus::ObjectPath& object_path, | 497 const dbus::ObjectPath& object_path, |
510 Delegate* delegate) { | 498 Delegate* delegate) { |
511 if (base::chromeos::IsRunningOnChromeOS()) { | 499 if (base::chromeos::IsRunningOnChromeOS()) { |
512 return new ExperimentalBluetoothAgentServiceProviderImpl( | 500 return new ExperimentalBluetoothAgentServiceProviderImpl( |
513 bus, object_path, delegate); | 501 bus, object_path, delegate); |
514 } else { | 502 } else { |
515 return new ExperimentalBluetoothAgentServiceProviderStubImpl(delegate); | 503 return new FakeBluetoothAgentServiceProvider(object_path, delegate); |
516 } | 504 } |
517 } | 505 } |
518 | 506 |
519 } // namespace chromeos | 507 } // namespace chromeos |
OLD | NEW |