Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: components/arc/bluetooth/arc_bluetooth_bridge.cc

Issue 1885683005: Add module suffix in .mojom files for components/arc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 0b2a593f0c594e053f97a66848bc90bc4d37edb3..bfb22cc5bee576b21a84a66469389c1ff2ad1bf6 100644
--- a/components/arc/bluetooth/arc_bluetooth_bridge.cc
+++ b/components/arc/bluetooth/arc_bluetooth_bridge.cc
@@ -62,7 +62,7 @@ void ArcBluetoothBridge::OnAdapterInitialized(
}
void ArcBluetoothBridge::OnBluetoothInstanceReady() {
- BluetoothInstance* bluetooth_instance =
+ mojom::BluetoothInstance* bluetooth_instance =
arc_bridge_service()->bluetooth_instance();
if (!bluetooth_instance) {
LOG(ERROR) << "OnBluetoothInstanceReady called, "
@@ -100,8 +100,8 @@ void ArcBluetoothBridge::DeviceAdded(BluetoothAdapter* adapter,
if (device->IsConnected())
return;
- mojo::Array<BluetoothPropertyPtr> properties =
- GetDeviceProperties(BluetoothPropertyType::ALL, device);
+ mojo::Array<mojom::BluetoothPropertyPtr> properties =
+ GetDeviceProperties(mojom::BluetoothPropertyType::ALL, device);
arc_bridge_service()->bluetooth_instance()->OnDeviceFound(
std::move(properties));
@@ -208,30 +208,33 @@ void ArcBluetoothBridge::DisableAdapter(
weak_factory_.GetWeakPtr(), callback));
}
-void ArcBluetoothBridge::GetAdapterProperty(BluetoothPropertyType type) {
+void ArcBluetoothBridge::GetAdapterProperty(mojom::BluetoothPropertyType type) {
DCHECK(bluetooth_adapter_);
if (!HasBluetoothInstance())
return;
- mojo::Array<BluetoothPropertyPtr> properties = GetAdapterProperties(type);
+ mojo::Array<mojom::BluetoothPropertyPtr> properties =
+ GetAdapterProperties(type);
arc_bridge_service()->bluetooth_instance()->OnAdapterProperties(
- BluetoothStatus::SUCCESS, std::move(properties));
+ mojom::BluetoothStatus::SUCCESS, std::move(properties));
}
-void ArcBluetoothBridge::SetAdapterProperty(BluetoothPropertyPtr property) {
+void ArcBluetoothBridge::SetAdapterProperty(
+ mojom::BluetoothPropertyPtr property) {
DCHECK(bluetooth_adapter_);
if (!HasBluetoothInstance())
return;
// TODO(smbarber): Implement SetAdapterProperty
arc_bridge_service()->bluetooth_instance()->OnAdapterProperties(
- BluetoothStatus::FAIL, mojo::Array<BluetoothPropertyPtr>::New(0));
+ mojom::BluetoothStatus::FAIL,
+ mojo::Array<mojom::BluetoothPropertyPtr>::New(0));
}
void ArcBluetoothBridge::GetRemoteDeviceProperty(
- BluetoothAddressPtr remote_addr,
- BluetoothPropertyType type) {
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothPropertyType type) {
DCHECK(bluetooth_adapter_);
if (!HasBluetoothInstance())
return;
@@ -239,32 +242,35 @@ void ArcBluetoothBridge::GetRemoteDeviceProperty(
std::string addr_str = remote_addr->To<std::string>();
BluetoothDevice* device = bluetooth_adapter_->GetDevice(addr_str);
- mojo::Array<BluetoothPropertyPtr> properties =
+ mojo::Array<mojom::BluetoothPropertyPtr> properties =
GetDeviceProperties(type, device);
arc_bridge_service()->bluetooth_instance()->OnRemoteDeviceProperties(
- BluetoothStatus::SUCCESS, std::move(remote_addr), std::move(properties));
+ mojom::BluetoothStatus::SUCCESS, std::move(remote_addr),
+ std::move(properties));
}
void ArcBluetoothBridge::SetRemoteDeviceProperty(
- BluetoothAddressPtr remote_addr,
- BluetoothPropertyPtr property) {
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothPropertyPtr property) {
DCHECK(bluetooth_adapter_);
if (!HasBluetoothInstance())
return;
// TODO(smbarber): Implement SetRemoteDeviceProperty
arc_bridge_service()->bluetooth_instance()->OnRemoteDeviceProperties(
- BluetoothStatus::FAIL, std::move(remote_addr),
- mojo::Array<BluetoothPropertyPtr>::New(0));
+ mojom::BluetoothStatus::FAIL, std::move(remote_addr),
+ mojo::Array<mojom::BluetoothPropertyPtr>::New(0));
}
-void ArcBluetoothBridge::GetRemoteServiceRecord(BluetoothAddressPtr remote_addr,
- BluetoothUUIDPtr uuid) {
+void ArcBluetoothBridge::GetRemoteServiceRecord(
+ mojom::BluetoothAddressPtr remote_addr,
+ mojom::BluetoothUUIDPtr uuid) {
// TODO(smbarber): Implement GetRemoteServiceRecord
}
-void ArcBluetoothBridge::GetRemoteServices(BluetoothAddressPtr remote_addr) {
+void ArcBluetoothBridge::GetRemoteServices(
+ mojom::BluetoothAddressPtr remote_addr) {
// TODO(smbarber): Implement GetRemoteServices
}
@@ -296,21 +302,22 @@ void ArcBluetoothBridge::CancelDiscovery() {
}
void ArcBluetoothBridge::OnPoweredOn(
- const mojo::Callback<void(BluetoothAdapterState)>& callback) const {
- callback.Run(BluetoothAdapterState::ON);
+ const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const {
+ callback.Run(mojom::BluetoothAdapterState::ON);
}
void ArcBluetoothBridge::OnPoweredOff(
- const mojo::Callback<void(BluetoothAdapterState)>& callback) const {
- callback.Run(BluetoothAdapterState::OFF);
+ const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const {
+ callback.Run(mojom::BluetoothAdapterState::OFF);
}
void ArcBluetoothBridge::OnPoweredError(
- const mojo::Callback<void(BluetoothAdapterState)>& callback) const {
+ const mojo::Callback<void(mojom::BluetoothAdapterState)>& callback) const {
LOG(WARNING) << "failed to change power state";
- callback.Run(bluetooth_adapter_->IsPowered() ? BluetoothAdapterState::ON
- : BluetoothAdapterState::OFF);
+ callback.Run(bluetooth_adapter_->IsPowered()
+ ? mojom::BluetoothAdapterState::ON
+ : mojom::BluetoothAdapterState::OFF);
}
void ArcBluetoothBridge::OnDiscoveryStarted(
@@ -321,7 +328,7 @@ void ArcBluetoothBridge::OnDiscoveryStarted(
discovery_session_ = std::move(session);
arc_bridge_service()->bluetooth_instance()->OnDiscoveryStateChanged(
- BluetoothDiscoveryState::STARTED);
+ mojom::BluetoothDiscoveryState::STARTED);
SendCachedDevicesFound();
}
@@ -333,24 +340,24 @@ void ArcBluetoothBridge::OnDiscoveryStopped() {
discovery_session_.reset();
arc_bridge_service()->bluetooth_instance()->OnDiscoveryStateChanged(
- BluetoothDiscoveryState::STOPPED);
+ mojom::BluetoothDiscoveryState::STOPPED);
}
-void ArcBluetoothBridge::CreateBond(BluetoothAddressPtr addr,
+void ArcBluetoothBridge::CreateBond(mojom::BluetoothAddressPtr addr,
int32_t transport) {
// TODO(smbarber): Implement CreateBond
}
-void ArcBluetoothBridge::RemoveBond(BluetoothAddressPtr addr) {
+void ArcBluetoothBridge::RemoveBond(mojom::BluetoothAddressPtr addr) {
// TODO(smbarber): Implement RemoveBond
}
-void ArcBluetoothBridge::CancelBond(BluetoothAddressPtr addr) {
+void ArcBluetoothBridge::CancelBond(mojom::BluetoothAddressPtr addr) {
// TODO(smbarber): Implement CancelBond
}
void ArcBluetoothBridge::GetConnectionState(
- BluetoothAddressPtr addr,
+ mojom::BluetoothAddressPtr addr,
const GetConnectionStateCallback& callback) {
if (!bluetooth_adapter_) {
callback.Run(false);
@@ -371,63 +378,63 @@ void ArcBluetoothBridge::OnDiscoveryError() {
LOG(WARNING) << "failed to change discovery state";
}
-mojo::Array<BluetoothPropertyPtr> ArcBluetoothBridge::GetDeviceProperties(
- BluetoothPropertyType type,
- BluetoothDevice* device) {
- mojo::Array<BluetoothPropertyPtr> properties;
+mojo::Array<mojom::BluetoothPropertyPtr>
+ArcBluetoothBridge::GetDeviceProperties(mojom::BluetoothPropertyType type,
+ BluetoothDevice* device) {
+ mojo::Array<mojom::BluetoothPropertyPtr> properties;
if (!device) {
return properties;
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::BDNAME) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::BDNAME) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_bdname(mojo::String::From(base::UTF16ToUTF8(device->GetName())));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::BDADDR) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
- btp->set_bdaddr(BluetoothAddress::From(device->GetAddress()));
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::BDADDR) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
+ btp->set_bdaddr(mojom::BluetoothAddress::From(device->GetAddress()));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::UUIDS) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::UUIDS) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
std::vector<device::BluetoothUUID> uuids = device->GetUUIDs();
- mojo::Array<BluetoothUUIDPtr> uuid_results =
- mojo::Array<BluetoothUUIDPtr>::New(0);
+ mojo::Array<mojom::BluetoothUUIDPtr> uuid_results =
+ mojo::Array<mojom::BluetoothUUIDPtr>::New(0);
for (size_t i = 0; i < uuids.size(); i++) {
- uuid_results.push_back(BluetoothUUID::From(uuids[i]));
+ uuid_results.push_back(mojom::BluetoothUUID::From(uuids[i]));
}
btp->set_uuids(std::move(uuid_results));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::CLASS_OF_DEVICE) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::CLASS_OF_DEVICE) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_device_class(device->GetBluetoothClass());
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::TYPE_OF_DEVICE) {
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::TYPE_OF_DEVICE) {
// TODO(smbarber): This needs to be populated with the actual device type
- BluetoothPropertyPtr btp = BluetoothProperty::New();
- btp->set_device_type(BluetoothDeviceType::DUAL);
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
+ btp->set_device_type(mojom::BluetoothDeviceType::DUAL);
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::REMOTE_FRIENDLY_NAME) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::REMOTE_FRIENDLY_NAME) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_bdname(mojo::String::From(base::UTF16ToUTF8(device->GetName())));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::REMOTE_RSSI) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::REMOTE_RSSI) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_remote_rssi(device->GetInquiryRSSI());
properties.push_back(std::move(btp));
}
@@ -436,75 +443,76 @@ mojo::Array<BluetoothPropertyPtr> ArcBluetoothBridge::GetDeviceProperties(
return properties;
}
-mojo::Array<BluetoothPropertyPtr> ArcBluetoothBridge::GetAdapterProperties(
- BluetoothPropertyType type) {
- mojo::Array<BluetoothPropertyPtr> properties;
+mojo::Array<mojom::BluetoothPropertyPtr>
+ArcBluetoothBridge::GetAdapterProperties(mojom::BluetoothPropertyType type) {
+ mojo::Array<mojom::BluetoothPropertyPtr> properties;
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::BDNAME) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::BDNAME) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
std::string name = bluetooth_adapter_->GetName();
btp->set_bdname(mojo::String(name));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::BDADDR) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
- btp->set_bdaddr(BluetoothAddress::From(bluetooth_adapter_->GetAddress()));
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::BDADDR) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
+ btp->set_bdaddr(
+ mojom::BluetoothAddress::From(bluetooth_adapter_->GetAddress()));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::UUIDS) {
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::UUIDS) {
// TODO(smbarber): Fill in once GetUUIDs is available for the adapter.
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::CLASS_OF_DEVICE) {
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::CLASS_OF_DEVICE) {
// TODO(smbarber): Populate with the actual adapter class
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_device_class(0);
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::TYPE_OF_DEVICE) {
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::TYPE_OF_DEVICE) {
// TODO(smbarber): Populate with the actual device type
- BluetoothPropertyPtr btp = BluetoothProperty::New();
- btp->set_device_type(BluetoothDeviceType::DUAL);
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
+ btp->set_device_type(mojom::BluetoothDeviceType::DUAL);
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::ADAPTER_SCAN_MODE) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
- BluetoothScanMode scan_mode = BluetoothScanMode::CONNECTABLE;
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::ADAPTER_SCAN_MODE) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
+ mojom::BluetoothScanMode scan_mode = mojom::BluetoothScanMode::CONNECTABLE;
if (bluetooth_adapter_->IsDiscoverable())
- scan_mode = BluetoothScanMode::CONNECTABLE_DISCOVERABLE;
+ scan_mode = mojom::BluetoothScanMode::CONNECTABLE_DISCOVERABLE;
btp->set_adapter_scan_mode(scan_mode);
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::ADAPTER_BONDED_DEVICES) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::ADAPTER_BONDED_DEVICES) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
BluetoothAdapter::DeviceList devices = bluetooth_adapter_->GetDevices();
- mojo::Array<BluetoothAddressPtr> bonded_devices =
- mojo::Array<BluetoothAddressPtr>::New(0);
+ mojo::Array<mojom::BluetoothAddressPtr> bonded_devices =
+ mojo::Array<mojom::BluetoothAddressPtr>::New(0);
for (size_t i = 0; i < devices.size(); i++) {
if (!devices[i]->IsPaired())
continue;
- BluetoothAddressPtr addr =
- BluetoothAddress::From(devices[i]->GetAddress());
+ mojom::BluetoothAddressPtr addr =
+ mojom::BluetoothAddress::From(devices[i]->GetAddress());
bonded_devices.push_back(std::move(addr));
}
btp->set_bonded_devices(std::move(bonded_devices));
properties.push_back(std::move(btp));
}
- if (type == BluetoothPropertyType::ALL ||
- type == BluetoothPropertyType::ADAPTER_DISCOVERY_TIMEOUT) {
- BluetoothPropertyPtr btp = BluetoothProperty::New();
+ if (type == mojom::BluetoothPropertyType::ALL ||
+ type == mojom::BluetoothPropertyType::ADAPTER_DISCOVERY_TIMEOUT) {
+ mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
btp->set_discovery_timeout(120);
properties.push_back(std::move(btp));
}
@@ -522,8 +530,8 @@ void ArcBluetoothBridge::SendCachedDevicesFound() {
if (devices[i]->IsPaired())
continue;
- mojo::Array<BluetoothPropertyPtr> properties =
- GetDeviceProperties(BluetoothPropertyType::ALL, devices[i]);
+ mojo::Array<mojom::BluetoothPropertyPtr> properties =
+ GetDeviceProperties(mojom::BluetoothPropertyType::ALL, devices[i]);
arc_bridge_service()->bluetooth_instance()->OnDeviceFound(
std::move(properties));

Powered by Google App Engine
This is Rietveld 408576698