Index: extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc |
diff --git a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc |
index 94c403858ba7c89a367232f93c7327ad004f3afe..0357ed9b951da3a4174f1570f5944e6d0bb15880 100644 |
--- a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc |
+++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc |
@@ -36,26 +36,25 @@ const char kInvalidUuidError[] = "Invalid UUID"; |
const char kPermissionDeniedError[] = "Permission denied"; |
const char kSocketNotFoundError[] = "Socket not found"; |
-linked_ptr<SocketInfo> CreateSocketInfo(int socket_id, |
- BluetoothApiSocket* socket) { |
+SocketInfo CreateSocketInfo(int socket_id, BluetoothApiSocket* socket) { |
DCHECK_CURRENTLY_ON(BluetoothApiSocket::kThreadId); |
- linked_ptr<SocketInfo> socket_info(new SocketInfo()); |
+ SocketInfo socket_info; |
// This represents what we know about the socket, and does not call through |
// to the system. |
- socket_info->socket_id = socket_id; |
+ socket_info.socket_id = socket_id; |
if (socket->name()) { |
- socket_info->name.reset(new std::string(*socket->name())); |
+ socket_info.name.reset(new std::string(*socket->name())); |
} |
- socket_info->persistent = socket->persistent(); |
+ socket_info.persistent = socket->persistent(); |
if (socket->buffer_size() > 0) { |
- socket_info->buffer_size.reset(new int(socket->buffer_size())); |
+ socket_info.buffer_size.reset(new int(socket->buffer_size())); |
} |
- socket_info->paused = socket->paused(); |
- socket_info->connected = socket->IsConnected(); |
+ socket_info.paused = socket->paused(); |
+ socket_info.connected = socket->IsConnected(); |
if (socket->IsConnected()) |
- socket_info->address.reset(new std::string(socket->device_address())); |
- socket_info->uuid.reset(new std::string(socket->uuid().canonical_value())); |
+ socket_info.address.reset(new std::string(socket->device_address())); |
+ socket_info.uuid.reset(new std::string(socket->uuid().canonical_value())); |
return socket_info; |
} |
@@ -645,9 +644,8 @@ void BluetoothSocketGetInfoFunction::Work() { |
return; |
} |
- linked_ptr<bluetooth_socket::SocketInfo> socket_info = |
- CreateSocketInfo(params_->socket_id, socket); |
- results_ = bluetooth_socket::GetInfo::Results::Create(*socket_info); |
+ results_ = bluetooth_socket::GetInfo::Results::Create( |
+ CreateSocketInfo(params_->socket_id, socket)); |
} |
BluetoothSocketGetSocketsFunction::BluetoothSocketGetSocketsFunction() {} |
@@ -657,13 +655,10 @@ BluetoothSocketGetSocketsFunction::~BluetoothSocketGetSocketsFunction() {} |
bool BluetoothSocketGetSocketsFunction::Prepare() { return true; } |
void BluetoothSocketGetSocketsFunction::Work() { |
- std::vector<linked_ptr<bluetooth_socket::SocketInfo> > socket_infos; |
+ std::vector<bluetooth_socket::SocketInfo> socket_infos; |
base::hash_set<int>* resource_ids = GetSocketIds(); |
- if (resource_ids != NULL) { |
- for (base::hash_set<int>::iterator it = resource_ids->begin(); |
- it != resource_ids->end(); |
- ++it) { |
- int socket_id = *it; |
+ if (resource_ids) { |
+ for (int socket_id : *resource_ids) { |
BluetoothApiSocket* socket = GetSocket(socket_id); |
if (socket) { |
socket_infos.push_back(CreateSocketInfo(socket_id, socket)); |