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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_api_utils.cc

Issue 2017393002: bluetooth: Rename device's GetName to GetNameForDisplay (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extensions/browser/api/bluetooth/bluetooth_api_utils.h" 5 #include "extensions/browser/api/bluetooth/bluetooth_api_utils.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "device/bluetooth/bluetooth_adapter.h" 9 #include "device/bluetooth/bluetooth_adapter.h"
10 #include "device/bluetooth/bluetooth_device.h" 10 #include "device/bluetooth/bluetooth_device.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 } // namespace 88 } // namespace
89 89
90 namespace extensions { 90 namespace extensions {
91 namespace api { 91 namespace api {
92 namespace bluetooth { 92 namespace bluetooth {
93 93
94 void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device, 94 void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device,
95 Device* out) { 95 Device* out) {
96 out->address = device.GetAddress(); 96 out->address = device.GetAddress();
97 out->name.reset(new std::string(base::UTF16ToUTF8(device.GetName()))); 97 out->name.reset(
98 new std::string(base::UTF16ToUTF8(device.GetNameForDisplay())));
98 out->device_class.reset(new int(device.GetBluetoothClass())); 99 out->device_class.reset(new int(device.GetBluetoothClass()));
99 100
100 // Only include the Device ID members when one exists for the device, and 101 // Only include the Device ID members when one exists for the device, and
101 // always include all or none. 102 // always include all or none.
102 if (ConvertVendorIDSourceToApi(device.GetVendorIDSource(), 103 if (ConvertVendorIDSourceToApi(device.GetVendorIDSource(),
103 &(out->vendor_id_source)) && 104 &(out->vendor_id_source)) &&
104 out->vendor_id_source != VENDOR_ID_SOURCE_NONE) { 105 out->vendor_id_source != VENDOR_ID_SOURCE_NONE) {
105 out->vendor_id.reset(new int(device.GetVendorID())); 106 out->vendor_id.reset(new int(device.GetVendorID()));
106 out->product_id.reset(new int(device.GetProductID())); 107 out->product_id.reset(new int(device.GetProductID()));
107 out->device_id.reset(new int(device.GetDeviceID())); 108 out->device_id.reset(new int(device.GetDeviceID()));
(...skipping 29 matching lines...) Expand all
137 out->discovering = adapter.IsDiscovering(); 138 out->discovering = adapter.IsDiscovering();
138 out->available = adapter.IsPresent(); 139 out->available = adapter.IsPresent();
139 out->powered = adapter.IsPowered(); 140 out->powered = adapter.IsPowered();
140 out->name = adapter.GetName(); 141 out->name = adapter.GetName();
141 out->address = adapter.GetAddress(); 142 out->address = adapter.GetAddress();
142 } 143 }
143 144
144 } // namespace bluetooth 145 } // namespace bluetooth
145 } // namespace api 146 } // namespace api
146 } // namespace extensions 147 } // namespace extensions
OLDNEW
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_device.cc ('k') | extensions/browser/api/bluetooth/bluetooth_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698