OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chromeos/dbus/fake_old_bluetooth_manager_client.h" |
| 6 |
| 7 namespace chromeos { |
| 8 |
| 9 FakeOldBluetoothManagerClient::Properties::Properties( |
| 10 const PropertyChangedCallback& callback) : |
| 11 BluetoothManagerClient::Properties(NULL, callback) { |
| 12 } |
| 13 |
| 14 FakeOldBluetoothManagerClient::Properties::~Properties() { |
| 15 } |
| 16 |
| 17 void FakeOldBluetoothManagerClient::Properties::Get( |
| 18 dbus::PropertyBase* property, |
| 19 dbus::PropertySet::GetCallback callback) { |
| 20 VLOG(1)<< "Get " << property->name(); |
| 21 callback.Run(false); |
| 22 } |
| 23 |
| 24 void FakeOldBluetoothManagerClient::Properties::GetAll() { |
| 25 VLOG(1) << "GetAll"; |
| 26 } |
| 27 |
| 28 void FakeOldBluetoothManagerClient::Properties::Set( |
| 29 dbus::PropertyBase*property, |
| 30 dbus::PropertySet::SetCallback callback) { |
| 31 VLOG(1) << "Set " << property->name(); |
| 32 callback.Run(false); |
| 33 } |
| 34 |
| 35 FakeOldBluetoothManagerClient::FakeOldBluetoothManagerClient() { |
| 36 properties_.reset(new Properties(base::Bind( |
| 37 &FakeOldBluetoothManagerClient::OnPropertyChanged, |
| 38 base::Unretained(this)))); |
| 39 |
| 40 std::vector<dbus::ObjectPath> adapters; |
| 41 adapters.push_back(dbus::ObjectPath("/fake/hci0")); |
| 42 properties_->adapters.ReplaceValue(adapters); |
| 43 } |
| 44 |
| 45 FakeOldBluetoothManagerClient::~FakeOldBluetoothManagerClient() { |
| 46 } |
| 47 |
| 48 void FakeOldBluetoothManagerClient::AddObserver(Observer* observer) { |
| 49 observers_.AddObserver(observer); |
| 50 } |
| 51 |
| 52 void FakeOldBluetoothManagerClient::RemoveObserver(Observer* observer) { |
| 53 observers_.RemoveObserver(observer); |
| 54 } |
| 55 |
| 56 FakeOldBluetoothManagerClient::Properties* |
| 57 FakeOldBluetoothManagerClient::GetProperties() { |
| 58 VLOG(1) << "GetProperties"; |
| 59 return properties_.get(); |
| 60 } |
| 61 |
| 62 void FakeOldBluetoothManagerClient::DefaultAdapter( |
| 63 const AdapterCallback& callback) { |
| 64 VLOG(1) << "DefaultAdapter."; |
| 65 callback.Run(dbus::ObjectPath("/fake/hci0"), true); |
| 66 } |
| 67 |
| 68 void FakeOldBluetoothManagerClient::FindAdapter( |
| 69 const std::string& address, |
| 70 const AdapterCallback& callback) { |
| 71 VLOG(1) << "FindAdapter: " << address; |
| 72 if (address == "hci0") |
| 73 callback.Run(dbus::ObjectPath("/fake/hci0"), true); |
| 74 else |
| 75 callback.Run(dbus::ObjectPath(), false); |
| 76 } |
| 77 |
| 78 void FakeOldBluetoothManagerClient::OnPropertyChanged( |
| 79 const std::string& property_name) { |
| 80 FOR_EACH_OBSERVER(BluetoothManagerClient::Observer, observers_, |
| 81 ManagerPropertyChanged(property_name)); |
| 82 } |
| 83 |
| 84 } // namespace chromeos |
OLD | NEW |