OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_profile_service_provider.h" | 5 #include "chromeos/dbus/bluetooth_profile_service_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 dbus::ExportedObject::ResponseSender response_sender, | 188 dbus::ExportedObject::ResponseSender response_sender, |
189 Delegate::Status status) { | 189 Delegate::Status status) { |
190 DCHECK(OnOriginThread()); | 190 DCHECK(OnOriginThread()); |
191 | 191 |
192 switch (status) { | 192 switch (status) { |
193 case Delegate::SUCCESS: { | 193 case Delegate::SUCCESS: { |
194 response_sender.Run(dbus::Response::FromMethodCall(method_call)); | 194 response_sender.Run(dbus::Response::FromMethodCall(method_call)); |
195 break; | 195 break; |
196 } | 196 } |
197 case Delegate::REJECTED: { | 197 case Delegate::REJECTED: { |
198 response_sender.Run( | 198 response_sender.Run(dbus::ErrorResponse::FromMethodCall( |
199 dbus::ErrorResponse::FromMethodCall( | 199 method_call, bluetooth_profile::kErrorRejected, "rejected")); |
200 method_call, bluetooth_profile::kErrorRejected, "rejected") | |
201 .PassAs<dbus::Response>()); | |
202 break; | 200 break; |
203 } | 201 } |
204 case Delegate::CANCELLED: { | 202 case Delegate::CANCELLED: { |
205 response_sender.Run( | 203 response_sender.Run(dbus::ErrorResponse::FromMethodCall( |
206 dbus::ErrorResponse::FromMethodCall( | 204 method_call, bluetooth_profile::kErrorCanceled, "canceled")); |
207 method_call, bluetooth_profile::kErrorCanceled, "canceled") | |
208 .PassAs<dbus::Response>()); | |
209 break; | 205 break; |
210 } | 206 } |
211 default: | 207 default: |
212 NOTREACHED() << "Unexpected status code from delegate: " << status; | 208 NOTREACHED() << "Unexpected status code from delegate: " << status; |
213 } | 209 } |
214 } | 210 } |
215 | 211 |
216 // Origin thread (i.e. the UI thread in production). | 212 // Origin thread (i.e. the UI thread in production). |
217 base::PlatformThreadId origin_thread_id_; | 213 base::PlatformThreadId origin_thread_id_; |
218 | 214 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const dbus::ObjectPath& object_path, | 249 const dbus::ObjectPath& object_path, |
254 Delegate* delegate) { | 250 Delegate* delegate) { |
255 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { | 251 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { |
256 return new BluetoothProfileServiceProviderImpl(bus, object_path, delegate); | 252 return new BluetoothProfileServiceProviderImpl(bus, object_path, delegate); |
257 } else { | 253 } else { |
258 return new FakeBluetoothProfileServiceProvider(object_path, delegate); | 254 return new FakeBluetoothProfileServiceProvider(object_path, delegate); |
259 } | 255 } |
260 } | 256 } |
261 | 257 |
262 } // namespace chromeos | 258 } // namespace chromeos |
OLD | NEW |