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

Unified Diff: chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.cc

Issue 10899037: Refactoring bluetooth API code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added #include <string> into bluetooth_adapter_dbus.cc. Created 8 years, 3 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: chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.cc
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_socket.cc b/chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.cc
similarity index 73%
rename from chrome/browser/chromeos/bluetooth/bluetooth_socket.cc
rename to chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.cc
index 62806e07afdc53aaaa99a058e43fdcacbd91cb7f..8f034b79acc9023374555189f98ecc34fa2df56b 100644
--- a/chrome/browser/chromeos/bluetooth/bluetooth_socket.cc
+++ b/chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_socket_posix.h"
#include <vector>
@@ -14,24 +14,24 @@
#include <string.h>
#include <unistd.h>
-#include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h"
+#include "chrome/browser/chromeos/bluetooth/bluetooth_service_record_dbus.h"
#include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h"
namespace chromeos {
-BluetoothSocket::BluetoothSocket(const std::string& address, int fd)
+BluetoothSocketPosix::BluetoothSocketPosix(const std::string& address, int fd)
: address_(address),
fd_(fd) {
}
-BluetoothSocket::~BluetoothSocket() {
+BluetoothSocketPosix::~BluetoothSocketPosix() {
close(fd_);
}
// static
-scoped_refptr<BluetoothSocket> BluetoothSocket::CreateBluetoothSocket(
- const BluetoothServiceRecord& service_record) {
- BluetoothSocket* bluetooth_socket = NULL;
+scoped_refptr<BluetoothSocketPosix> BluetoothSocketPosix::CreateBluetoothSocket(
+ const BluetoothServiceRecordDBus& service_record) {
+ BluetoothSocketPosix* bluetooth_socket = NULL;
if (service_record.SupportsRfcomm()) {
int socket_fd = socket(
AF_BLUETOOTH, SOCK_STREAM | SOCK_NONBLOCK, BTPROTO_RFCOMM);
@@ -45,7 +45,7 @@ scoped_refptr<BluetoothSocket> BluetoothSocket::CreateBluetoothSocket(
sizeof(socket_address));
int errsv = errno;
if (status == 0 || errno == EINPROGRESS) {
- bluetooth_socket = new BluetoothSocket(service_record.address(),
+ bluetooth_socket = new BluetoothSocketPosix(service_record.address(),
socket_fd);
} else {
LOG(ERROR) << "Failed to connect bluetooth socket "
@@ -56,7 +56,7 @@ scoped_refptr<BluetoothSocket> BluetoothSocket::CreateBluetoothSocket(
}
// TODO(bryeung): add support for L2CAP sockets as well.
- return scoped_refptr<BluetoothSocket>(bluetooth_socket);
+ return scoped_refptr<BluetoothSocketPosix>(bluetooth_socket);
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698