Chromium Code Reviews| Index: components/arc/bluetooth/arc_bluetooth_bridge.cc |
| diff --git a/components/arc/bluetooth/arc_bluetooth_bridge.cc b/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| index 964f1986f31971bd6144b5708049f9f2f68fef93..ca16e8d9b1ca72f2cfb79886246c393c8f6b9db4 100644 |
| --- a/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| +++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc |
| @@ -618,16 +618,43 @@ void ArcBluetoothBridge::GetAdapterProperty(mojom::BluetoothPropertyType type) { |
| mojom::BluetoothStatus::SUCCESS, std::move(properties)); |
| } |
| +void ArcBluetoothBridge::OnAdapterPropertySuccess( |
| + mojo::Array<mojom::BluetoothPropertyPtr> properties) const { |
| + arc_bridge_service()->bluetooth()->instance()->OnAdapterProperties( |
| + mojom::BluetoothStatus::SUCCESS, std::move(properties)); |
| +} |
| + |
| +void ArcBluetoothBridge::OnAdapterPropertyError( |
| + mojom::BluetoothStatus status) const { |
| + arc_bridge_service()->bluetooth()->instance()->OnAdapterProperties( |
| + status, mojo::Array<mojom::BluetoothPropertyPtr>::New(0)); |
| +} |
| + |
| void ArcBluetoothBridge::SetAdapterProperty( |
| mojom::BluetoothPropertyPtr property) { |
| DCHECK(bluetooth_adapter_); |
| if (!HasBluetoothInstance()) |
| return; |
| - // TODO(smbarber): Implement SetAdapterProperty |
| - arc_bridge_service()->bluetooth()->instance()->OnAdapterProperties( |
| - mojom::BluetoothStatus::FAIL, |
| - mojo::Array<mojom::BluetoothPropertyPtr>::New(0)); |
| + // TODO(puthik) Implement other case. |
|
Miao
2016/08/30 22:05:38
nit: Move this comment to the unsupported case.
|
| + if (property->is_discovery_timeout()) { |
| + uint32_t discovery_timeout = property->get_discovery_timeout(); |
| + mojo::Array<mojom::BluetoothPropertyPtr> success_result; |
| + success_result.push_back(std::move(property)); |
| + if (discovery_timeout > 0) { |
|
Miao
2016/08/30 22:05:38
nit: put a new line above.
|
| + // TODO(puthik) Add timer and turn this to off when timer end |
| + bluetooth_adapter_->SetDiscoverable( |
| + true, |
| + base::Bind(&ArcBluetoothBridge::OnAdapterPropertySuccess, |
| + weak_factory_.GetWeakPtr(), base::Passed(&success_result)), |
| + base::Bind(&ArcBluetoothBridge::OnAdapterPropertyError, |
| + weak_factory_.GetWeakPtr(), mojom::BluetoothStatus::FAIL)); |
| + } else { |
| + OnAdapterPropertyError(mojom::BluetoothStatus::PARM_INVALID); |
| + } |
| + } else { |
| + OnAdapterPropertyError(mojom::BluetoothStatus::UNSUPPORTED); |
| + } |
| } |
| void ArcBluetoothBridge::GetRemoteDeviceProperty( |