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

Side by Side Diff: components/arc/bluetooth/arc_bluetooth_bridge.cc

Issue 2482323002: arc: bluetooth: Replace nullptr with "" for mojo::String (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/arc/bluetooth/arc_bluetooth_bridge.h" 5 #include "components/arc/bluetooth/arc_bluetooth_bridge.h"
6 6
7 #include <bluetooth/bluetooth.h> 7 #include <bluetooth/bluetooth.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 const BluetoothDevice* device) const { 1849 const BluetoothDevice* device) const {
1850 mojo::Array<mojom::BluetoothPropertyPtr> properties; 1850 mojo::Array<mojom::BluetoothPropertyPtr> properties;
1851 1851
1852 if (!device) { 1852 if (!device) {
1853 return properties; 1853 return properties;
1854 } 1854 }
1855 1855
1856 if (type == mojom::BluetoothPropertyType::ALL || 1856 if (type == mojom::BluetoothPropertyType::ALL ||
1857 type == mojom::BluetoothPropertyType::BDNAME) { 1857 type == mojom::BluetoothPropertyType::BDNAME) {
1858 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); 1858 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
1859 btp->set_bdname(device->GetName() ? device->GetName().value() : nullptr); 1859 btp->set_bdname(device->GetName() ? device->GetName().value() : "");
1860 properties.push_back(std::move(btp)); 1860 properties.push_back(std::move(btp));
1861 } 1861 }
1862 if (type == mojom::BluetoothPropertyType::ALL || 1862 if (type == mojom::BluetoothPropertyType::ALL ||
1863 type == mojom::BluetoothPropertyType::BDADDR) { 1863 type == mojom::BluetoothPropertyType::BDADDR) {
1864 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); 1864 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New();
1865 btp->set_bdaddr(mojom::BluetoothAddress::From(device->GetAddress())); 1865 btp->set_bdaddr(mojom::BluetoothAddress::From(device->GetAddress()));
1866 properties.push_back(std::move(btp)); 1866 properties.push_back(std::move(btp));
1867 } 1867 }
1868 if (type == mojom::BluetoothPropertyType::ALL || 1868 if (type == mojom::BluetoothPropertyType::ALL ||
1869 type == mojom::BluetoothPropertyType::UUIDS) { 1869 type == mojom::BluetoothPropertyType::UUIDS) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 mojom::BluetoothAdvertisingDataPtr flags = 2020 mojom::BluetoothAdvertisingDataPtr flags =
2021 mojom::BluetoothAdvertisingData::New(); 2021 mojom::BluetoothAdvertisingData::New();
2022 flags->set_flags(device->GetAdvertisingDataFlags().value()); 2022 flags->set_flags(device->GetAdvertisingDataFlags().value());
2023 advertising_data.push_back(std::move(flags)); 2023 advertising_data.push_back(std::move(flags));
2024 } 2024 }
2025 2025
2026 // Local Name 2026 // Local Name
2027 mojom::BluetoothAdvertisingDataPtr local_name = 2027 mojom::BluetoothAdvertisingDataPtr local_name =
2028 mojom::BluetoothAdvertisingData::New(); 2028 mojom::BluetoothAdvertisingData::New();
2029 local_name->set_local_name(device->GetName() ? device->GetName().value() 2029 local_name->set_local_name(device->GetName() ? device->GetName().value()
2030 : nullptr); 2030 : "");
2031 advertising_data.push_back(std::move(local_name)); 2031 advertising_data.push_back(std::move(local_name));
2032 2032
2033 // Service UUIDs 2033 // Service UUIDs
2034 const BluetoothDevice::UUIDSet& uuid_set = device->GetUUIDs(); 2034 const BluetoothDevice::UUIDSet& uuid_set = device->GetUUIDs();
2035 if (uuid_set.size() > 0) { 2035 if (uuid_set.size() > 0) {
2036 mojom::BluetoothAdvertisingDataPtr service_uuids = 2036 mojom::BluetoothAdvertisingDataPtr service_uuids =
2037 mojom::BluetoothAdvertisingData::New(); 2037 mojom::BluetoothAdvertisingData::New();
2038 service_uuids->set_service_uuids(mojo::Array<BluetoothUUID>::From( 2038 service_uuids->set_service_uuids(mojo::Array<BluetoothUUID>::From(
2039 std::vector<BluetoothUUID>(uuid_set.begin(), uuid_set.end()))); 2039 std::vector<BluetoothUUID>(uuid_set.begin(), uuid_set.end())));
2040 advertising_data.push_back(std::move(service_uuids)); 2040 advertising_data.push_back(std::move(service_uuids));
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 sdp_bluetooth_instance->OnGetSdpRecords( 2166 sdp_bluetooth_instance->OnGetSdpRecords(
2167 status, std::move(remote_addr), target_uuid, 2167 status, std::move(remote_addr), target_uuid,
2168 mojo::Array<mojom::BluetoothSdpRecordPtr>::New(0)); 2168 mojo::Array<mojom::BluetoothSdpRecordPtr>::New(0));
2169 } 2169 }
2170 2170
2171 bool ArcBluetoothBridge::CalledOnValidThread() { 2171 bool ArcBluetoothBridge::CalledOnValidThread() {
2172 return thread_checker_.CalledOnValidThread(); 2172 return thread_checker_.CalledOnValidThread();
2173 } 2173 }
2174 2174
2175 } // namespace arc 2175 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698