OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/dbus/bluetooth_media_client.h" | 5 #include "chromeos/dbus/bluetooth_media_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void RemoveObserver(BluetoothMediaClient::Observer* observer) override { | 96 void RemoveObserver(BluetoothMediaClient::Observer* observer) override { |
97 DCHECK(observer); | 97 DCHECK(observer); |
98 observers_.RemoveObserver(observer); | 98 observers_.RemoveObserver(observer); |
99 } | 99 } |
100 | 100 |
101 void RegisterEndpoint(const dbus::ObjectPath& object_path, | 101 void RegisterEndpoint(const dbus::ObjectPath& object_path, |
102 const dbus::ObjectPath& endpoint_path, | 102 const dbus::ObjectPath& endpoint_path, |
103 const EndpointProperties& properties, | 103 const EndpointProperties& properties, |
104 const base::Closure& callback, | 104 const base::Closure& callback, |
105 const ErrorCallback& error_callback) override { | 105 const ErrorCallback& error_callback) override { |
| 106 VLOG(1) << "RegisterEndpoint - endpoint: " << endpoint_path.value(); |
| 107 |
106 dbus::MethodCall method_call(kBluetoothMediaInterface, kRegisterEndpoint); | 108 dbus::MethodCall method_call(kBluetoothMediaInterface, kRegisterEndpoint); |
107 | 109 |
108 dbus::MessageWriter writer(&method_call); | 110 dbus::MessageWriter writer(&method_call); |
109 dbus::MessageWriter array_writer(nullptr); | 111 dbus::MessageWriter array_writer(nullptr); |
110 dbus::MessageWriter dict_entry_writer(nullptr); | 112 dbus::MessageWriter dict_entry_writer(nullptr); |
111 | 113 |
112 // Send the path to the endpoint. | 114 // Send the path to the endpoint. |
113 writer.AppendObjectPath(endpoint_path); | 115 writer.AppendObjectPath(endpoint_path); |
114 | 116 |
115 writer.OpenArray("{sv}", &array_writer); | 117 writer.OpenArray("{sv}", &array_writer); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 base::Bind(&BluetoothMediaClientImpl::OnSuccess, | 150 base::Bind(&BluetoothMediaClientImpl::OnSuccess, |
149 weak_ptr_factory_.GetWeakPtr(), callback), | 151 weak_ptr_factory_.GetWeakPtr(), callback), |
150 base::Bind(&BluetoothMediaClientImpl::OnError, | 152 base::Bind(&BluetoothMediaClientImpl::OnError, |
151 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 153 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
152 } | 154 } |
153 | 155 |
154 void UnregisterEndpoint(const dbus::ObjectPath& object_path, | 156 void UnregisterEndpoint(const dbus::ObjectPath& object_path, |
155 const dbus::ObjectPath& endpoint_path, | 157 const dbus::ObjectPath& endpoint_path, |
156 const base::Closure& callback, | 158 const base::Closure& callback, |
157 const ErrorCallback& error_callback) override { | 159 const ErrorCallback& error_callback) override { |
| 160 VLOG(1) << "UnregisterEndpoint - endpoint: " << endpoint_path.value(); |
| 161 |
158 dbus::MethodCall method_call(kBluetoothMediaInterface, kUnregisterEndpoint); | 162 dbus::MethodCall method_call(kBluetoothMediaInterface, kUnregisterEndpoint); |
159 | 163 |
160 // Send the path to the endpoint. | 164 // Send the path to the endpoint. |
161 dbus::MessageWriter writer(&method_call); | 165 dbus::MessageWriter writer(&method_call); |
162 writer.AppendObjectPath(endpoint_path); | 166 writer.AppendObjectPath(endpoint_path); |
163 | 167 |
164 // Get Object Proxy based on the service name and the service path and call | 168 // Get Object Proxy based on the service name and the service path and call |
165 // RegisterEndpoint medthod. | 169 // RegisterEndpoint medthod. |
166 scoped_refptr<dbus::ObjectProxy> object_proxy( | 170 scoped_refptr<dbus::ObjectProxy> object_proxy( |
167 object_manager_->GetObjectProxy(object_path)); | 171 object_manager_->GetObjectProxy(object_path)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 226 } |
223 | 227 |
224 BluetoothMediaClient::~BluetoothMediaClient() { | 228 BluetoothMediaClient::~BluetoothMediaClient() { |
225 } | 229 } |
226 | 230 |
227 BluetoothMediaClient* BluetoothMediaClient::Create() { | 231 BluetoothMediaClient* BluetoothMediaClient::Create() { |
228 return new BluetoothMediaClientImpl(); | 232 return new BluetoothMediaClientImpl(); |
229 } | 233 } |
230 | 234 |
231 } // namespace chromeos | 235 } // namespace chromeos |
OLD | NEW |