OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/experimental_bluetooth_profile_manager_client.h" | 5 #include "chromeos/dbus/experimental_bluetooth_profile_manager_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 "chromeos/dbus/fake_bluetooth_profile_manager_client.h" |
9 #include "dbus/bus.h" | 10 #include "dbus/bus.h" |
10 #include "dbus/message.h" | 11 #include "dbus/message.h" |
11 #include "dbus/object_path.h" | 12 #include "dbus/object_path.h" |
12 #include "dbus/object_proxy.h" | 13 #include "dbus/object_proxy.h" |
13 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
14 | 15 |
15 namespace chromeos { | 16 namespace chromeos { |
16 | 17 |
17 const char ExperimentalBluetoothProfileManagerClient::kNoResponseError[] = | 18 const char ExperimentalBluetoothProfileManagerClient::kNoResponseError[] = |
18 "org.chromium.Error.NoResponse"; | 19 "org.chromium.Error.NoResponse"; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Weak pointer factory for generating 'this' pointers that might live longer | 223 // Weak pointer factory for generating 'this' pointers that might live longer |
223 // than we do. | 224 // than we do. |
224 // Note: This should remain the last member so it'll be destroyed and | 225 // Note: This should remain the last member so it'll be destroyed and |
225 // invalidate its weak pointers before any other members are destroyed. | 226 // invalidate its weak pointers before any other members are destroyed. |
226 base::WeakPtrFactory<ExperimentalBluetoothProfileManagerClientImpl> | 227 base::WeakPtrFactory<ExperimentalBluetoothProfileManagerClientImpl> |
227 weak_ptr_factory_; | 228 weak_ptr_factory_; |
228 | 229 |
229 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileManagerClientImpl); | 230 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileManagerClientImpl); |
230 }; | 231 }; |
231 | 232 |
232 // The ExperimentalBluetoothProfileManagerClient implementation used on Linux | |
233 // desktop, which does nothing. | |
234 class ExperimentalBluetoothProfileManagerClientStubImpl | |
235 : public ExperimentalBluetoothProfileManagerClient { | |
236 public: | |
237 ExperimentalBluetoothProfileManagerClientStubImpl() { | |
238 } | |
239 | |
240 // ExperimentalBluetoothProfileManagerClient override. | |
241 virtual void RegisterProfile(const dbus::ObjectPath& profile_path, | |
242 const std::string& uuid, | |
243 const Options& options, | |
244 const base::Closure& callback, | |
245 const ErrorCallback& error_callback) OVERRIDE { | |
246 VLOG(1) << "RegisterProfile: " << profile_path.value() << ": " << uuid; | |
247 error_callback.Run(kNoResponseError, ""); | |
248 } | |
249 | |
250 // ExperimentalBluetoothProfileManagerClient override. | |
251 virtual void UnregisterProfile(const dbus::ObjectPath& profile_path, | |
252 const base::Closure& callback, | |
253 const ErrorCallback& error_callback) OVERRIDE { | |
254 VLOG(1) << "UnregisterAgent: " << profile_path.value(); | |
255 error_callback.Run(kNoResponseError, ""); | |
256 } | |
257 }; | |
258 | |
259 ExperimentalBluetoothProfileManagerClient:: | 233 ExperimentalBluetoothProfileManagerClient:: |
260 ExperimentalBluetoothProfileManagerClient() { | 234 ExperimentalBluetoothProfileManagerClient() { |
261 } | 235 } |
262 | 236 |
263 ExperimentalBluetoothProfileManagerClient:: | 237 ExperimentalBluetoothProfileManagerClient:: |
264 ~ExperimentalBluetoothProfileManagerClient() { | 238 ~ExperimentalBluetoothProfileManagerClient() { |
265 } | 239 } |
266 | 240 |
267 ExperimentalBluetoothProfileManagerClient* | 241 ExperimentalBluetoothProfileManagerClient* |
268 ExperimentalBluetoothProfileManagerClient::Create( | 242 ExperimentalBluetoothProfileManagerClient::Create( |
269 DBusClientImplementationType type, | 243 DBusClientImplementationType type, |
270 dbus::Bus* bus) { | 244 dbus::Bus* bus) { |
271 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) | 245 if (type == REAL_DBUS_CLIENT_IMPLEMENTATION) |
272 return new ExperimentalBluetoothProfileManagerClientImpl(bus); | 246 return new ExperimentalBluetoothProfileManagerClientImpl(bus); |
273 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); | 247 DCHECK_EQ(STUB_DBUS_CLIENT_IMPLEMENTATION, type); |
274 return new ExperimentalBluetoothProfileManagerClientStubImpl(); | 248 return new FakeBluetoothProfileManagerClient(); |
275 } | 249 } |
276 | 250 |
277 } // namespace chromeos | 251 } // namespace chromeos |
OLD | NEW |