| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/observer_list.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/dbus/bluetooth_media_client.h" | |
| 14 #include "dbus/object_path.h" | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 class FakeBluetoothMediaEndpointServiceProvider; | |
| 19 | |
| 20 class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient { | |
| 21 public: | |
| 22 // The default codec is SBC(0x00). | |
| 23 static const uint8_t kDefaultCodec; | |
| 24 | |
| 25 FakeBluetoothMediaClient(); | |
| 26 ~FakeBluetoothMediaClient() override; | |
| 27 | |
| 28 // DBusClient override. | |
| 29 void Init(dbus::Bus* bus) override; | |
| 30 | |
| 31 // BluetoothMediaClient overrides. | |
| 32 void AddObserver(BluetoothMediaClient::Observer* observer) override; | |
| 33 void RemoveObserver(BluetoothMediaClient::Observer* observer) override; | |
| 34 void RegisterEndpoint(const dbus::ObjectPath& object_path, | |
| 35 const dbus::ObjectPath& endpoint_path, | |
| 36 const EndpointProperties& properties, | |
| 37 const base::Closure& callback, | |
| 38 const ErrorCallback& error_callback) override; | |
| 39 void UnregisterEndpoint(const dbus::ObjectPath& object_path, | |
| 40 const dbus::ObjectPath& endpoint_path, | |
| 41 const base::Closure& callback, | |
| 42 const ErrorCallback& error_callback) override; | |
| 43 | |
| 44 // Makes the media object visible/invisible to emulate the addition/removal | |
| 45 // events. | |
| 46 void SetVisible(bool visible); | |
| 47 | |
| 48 // Sets the registration state for a given media endpoint. | |
| 49 void SetEndpointRegistered( | |
| 50 FakeBluetoothMediaEndpointServiceProvider* endpoint, | |
| 51 bool registered); | |
| 52 | |
| 53 // Indicates whether the given endpoint path is registered or not. | |
| 54 bool IsRegistered(const dbus::ObjectPath& endpoint_path); | |
| 55 | |
| 56 private: | |
| 57 // Indicates whether the media object is visible or not. | |
| 58 bool visible_; | |
| 59 | |
| 60 // The path of the media object. | |
| 61 dbus::ObjectPath object_path_; | |
| 62 | |
| 63 // Map of registered endpoints. Each pair is composed of an endpoint path as | |
| 64 // key and a pointer to the endpoint as value. | |
| 65 std::map<dbus::ObjectPath, FakeBluetoothMediaEndpointServiceProvider*> | |
| 66 endpoints_; | |
| 67 | |
| 68 // List of observers interested in event notifications from us. | |
| 69 base::ObserverList<BluetoothMediaClient::Observer> observers_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient); | |
| 72 }; | |
| 73 | |
| 74 } // namespace chromeos | |
| 75 | |
| 76 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ | |
| OLD | NEW |