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

Unified Diff: device/bluetooth/bluetooth_device_chromeos.cc

Issue 276573004: Bluetooth: Implement new socket API for Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK nits Created 6 years, 7 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
« no previous file with comments | « device/bluetooth/bluetooth_device_chromeos.h ('k') | device/bluetooth/bluetooth_profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_chromeos.cc
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc
index f668e9a5855bda582e3bb8297240961d898a94b0..a3c53ac492e2babe280effb61d7323433951e85c 100644
--- a/device/bluetooth/bluetooth_device_chromeos.cc
+++ b/device/bluetooth/bluetooth_device_chromeos.cc
@@ -19,7 +19,6 @@
#include "dbus/bus.h"
#include "device/bluetooth/bluetooth_adapter_chromeos.h"
#include "device/bluetooth/bluetooth_pairing_chromeos.h"
-#include "device/bluetooth/bluetooth_profile_chromeos.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_chromeos.h"
#include "device/bluetooth/bluetooth_socket.h"
#include "device/bluetooth/bluetooth_socket_chromeos.h"
@@ -426,7 +425,7 @@ void BluetoothDeviceChromeOS::Forget(const ErrorCallback& error_callback) {
VLOG(1) << object_path_.value() << ": Removing device";
DBusThreadManager::Get()->GetBluetoothAdapterClient()->
RemoveDevice(
- adapter_->object_path_,
+ adapter_->object_path(),
object_path_,
base::Bind(&base::DoNothing),
base::Bind(&BluetoothDeviceChromeOS::OnForgetError,
@@ -438,32 +437,25 @@ void BluetoothDeviceChromeOS::ConnectToProfile(
device::BluetoothProfile* profile,
const base::Closure& callback,
const ConnectToProfileErrorCallback& error_callback) {
- BluetoothProfileChromeOS* profile_chromeos =
- static_cast<BluetoothProfileChromeOS*>(profile);
- VLOG(1) << object_path_.value() << ": Connecting profile: "
- << profile_chromeos->uuid().canonical_value();
- DBusThreadManager::Get()->GetBluetoothDeviceClient()->
- ConnectProfile(
- object_path_,
- profile_chromeos->uuid().canonical_value(),
- base::Bind(
- &BluetoothDeviceChromeOS::OnConnectProfile,
- weak_ptr_factory_.GetWeakPtr(),
- profile,
- callback),
- base::Bind(
- &BluetoothDeviceChromeOS::OnConnectProfileError,
- weak_ptr_factory_.GetWeakPtr(),
- profile,
- error_callback));
+ // TODO(keybuK): Remove.
+ error_callback.Run("Removed. Use chrome.bluetoothSocket.connect() instead.");
}
void BluetoothDeviceChromeOS::ConnectToService(
const BluetoothUUID& uuid,
const ConnectToServiceCallback& callback,
const ConnectToServiceErrorCallback& error_callback) {
- // TODO(keybuk): implement
- NOTIMPLEMENTED();
+ VLOG(1) << object_path_.value() << ": Connecting to service: "
+ << uuid.canonical_value();
+ scoped_refptr<BluetoothSocketChromeOS> socket =
+ BluetoothSocketChromeOS::CreateBluetoothSocket(
+ ui_task_runner_,
+ socket_thread_,
+ NULL,
+ net::NetLog::Source());
+ socket->Connect(this, uuid,
+ base::Bind(callback, socket),
+ error_callback);
}
void BluetoothDeviceChromeOS::SetOutOfBandPairingData(
@@ -729,27 +721,4 @@ void BluetoothDeviceChromeOS::OnForgetError(
error_callback.Run();
}
-void BluetoothDeviceChromeOS::OnConnectProfile(
- device::BluetoothProfile* profile,
- const base::Closure& callback) {
- BluetoothProfileChromeOS* profile_chromeos =
- static_cast<BluetoothProfileChromeOS*>(profile);
- VLOG(1) << object_path_.value() << ": Profile connected: "
- << profile_chromeos->uuid().canonical_value();
- callback.Run();
-}
-
-void BluetoothDeviceChromeOS::OnConnectProfileError(
- device::BluetoothProfile* profile,
- const ConnectToProfileErrorCallback& error_callback,
- const std::string& error_name,
- const std::string& error_message) {
- BluetoothProfileChromeOS* profile_chromeos =
- static_cast<BluetoothProfileChromeOS*>(profile);
- VLOG(1) << object_path_.value() << ": Profile connection failed: "
- << profile_chromeos->uuid().canonical_value() << ": "
- << error_name << ": " << error_message;
- error_callback.Run(error_message);
-}
-
} // namespace chromeos
« no previous file with comments | « device/bluetooth/bluetooth_device_chromeos.h ('k') | device/bluetooth/bluetooth_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698