OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <string> | 5 #include <string> |
6 #include <utility> | 6 #include <utility> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "device/bluetooth/adapter.h" | 10 #include "device/bluetooth/adapter.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 void Adapter::StartDiscoverySession( | 73 void Adapter::StartDiscoverySession( |
74 const StartDiscoverySessionCallback& callback) { | 74 const StartDiscoverySessionCallback& callback) { |
75 adapter_->StartDiscoverySession( | 75 adapter_->StartDiscoverySession( |
76 base::Bind(&Adapter::OnStartDiscoverySession, | 76 base::Bind(&Adapter::OnStartDiscoverySession, |
77 weak_ptr_factory_.GetWeakPtr(), callback), | 77 weak_ptr_factory_.GetWeakPtr(), callback), |
78 base::Bind(&Adapter::OnDiscoverySessionError, | 78 base::Bind(&Adapter::OnDiscoverySessionError, |
79 weak_ptr_factory_.GetWeakPtr(), callback)); | 79 weak_ptr_factory_.GetWeakPtr(), callback)); |
80 } | 80 } |
81 | 81 |
| 82 void Adapter::AdapterPresentChanged(device::BluetoothAdapter* adapter, |
| 83 bool present) { |
| 84 if (client_) |
| 85 client_->PresentChanged(present); |
| 86 } |
| 87 |
| 88 void Adapter::AdapterPoweredChanged(device::BluetoothAdapter* adapter, |
| 89 bool powered) { |
| 90 if (client_) |
| 91 client_->PoweredChanged(powered); |
| 92 } |
| 93 |
| 94 void Adapter::AdapterDiscoverableChanged(device::BluetoothAdapter* adapter, |
| 95 bool discoverable) { |
| 96 if (client_) |
| 97 client_->DiscoverableChanged(discoverable); |
| 98 } |
| 99 |
82 void Adapter::AdapterDiscoveringChanged(device::BluetoothAdapter* adapter, | 100 void Adapter::AdapterDiscoveringChanged(device::BluetoothAdapter* adapter, |
83 bool discovering) { | 101 bool discovering) { |
84 if (client_) | 102 if (client_) |
85 client_->DiscoveringChanged(discovering); | 103 client_->DiscoveringChanged(discovering); |
86 } | 104 } |
87 | 105 |
88 void Adapter::DeviceAdded(device::BluetoothAdapter* adapter, | 106 void Adapter::DeviceAdded(device::BluetoothAdapter* adapter, |
89 device::BluetoothDevice* device) { | 107 device::BluetoothDevice* device) { |
90 if (client_) { | 108 if (client_) { |
91 auto device_info = Device::ConstructDeviceInfoStruct(device); | 109 auto device_info = Device::ConstructDeviceInfoStruct(device); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 mojo::MakeRequest(&session_ptr)); | 152 mojo::MakeRequest(&session_ptr)); |
135 callback.Run(std::move(session_ptr)); | 153 callback.Run(std::move(session_ptr)); |
136 } | 154 } |
137 | 155 |
138 void Adapter::OnDiscoverySessionError( | 156 void Adapter::OnDiscoverySessionError( |
139 const StartDiscoverySessionCallback& callback) { | 157 const StartDiscoverySessionCallback& callback) { |
140 callback.Run(nullptr /* session */); | 158 callback.Run(nullptr /* session */); |
141 } | 159 } |
142 | 160 |
143 } // namespace bluetooth | 161 } // namespace bluetooth |
OLD | NEW |