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

Unified Diff: chromeos/dbus/fake_bluetooth_media_client.cc

Issue 939753004: device/bluetooth: Implement Unregister() of BlueotoothAudioSinkChromeOS and disconnection-related c… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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: chromeos/dbus/fake_bluetooth_media_client.cc
diff --git a/chromeos/dbus/fake_bluetooth_media_client.cc b/chromeos/dbus/fake_bluetooth_media_client.cc
index 58c4fdffca7216a319e3292fc49e4f457677123e..ac9df3d469fb042686b0c83b479160ee168625f7 100644
--- a/chromeos/dbus/fake_bluetooth_media_client.cc
+++ b/chromeos/dbus/fake_bluetooth_media_client.cc
@@ -80,7 +80,15 @@ void FakeBluetoothMediaClient::UnregisterEndpoint(
const base::Closure& callback,
const ErrorCallback& error_callback) {
// TODO(mcchou): Come up with some corresponding actions.
- error_callback.Run(kFailedError, "");
+ VLOG(1) << "UnregisterEndpoint: " << endpoint_path.value();
+
+ if (endpoints_.find(endpoint_path) == endpoints_.end()) {
Ben Chan 2015/02/19 00:21:45 see ContainsKey in src/base/stl_util.h
Miao 2015/02/23 21:04:24 Done.
+ error_callback.Run(kFailedError, "Unknown media endpoint");
+ return;
+ }
+
+ SetEndpointRegistered(endpoint_path, false);
+ callback.Run();
}
void FakeBluetoothMediaClient::SetVisible(bool visible) {
@@ -96,6 +104,7 @@ void FakeBluetoothMediaClient::SetVisible(bool visible) {
it != endpoints_.end(); ++it) {
SetEndpointRegistered(it->first, false);
}
+
endpoints_.clear();
// Notifies observers about the change on |visible_|.
@@ -114,7 +123,7 @@ void FakeBluetoothMediaClient::SetEndpointRegistered(
FakeBluetoothMediaTransportClient* transport =
static_cast<FakeBluetoothMediaTransportClient*>(
DBusThreadManager::Get()->GetBluetoothMediaTransportClient());
- transport->SetValid(endpoint_path, true);
+ transport->SetValid(endpoint_path, false);
}
}

Powered by Google App Engine
This is Rietveld 408576698