[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / chromeos / dbus / fake_bluetooth_media_client.h
blobc9649e65c910a0912e9527ae6dec2f9c0b299ce9
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.
5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
8 #include <map>
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"
16 namespace chromeos {
18 class FakeBluetoothMediaEndpointServiceProvider;
20 class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient {
21 public:
22 // The default codec is SBC(0x00).
23 static const uint8_t kDefaultCodec;
25 FakeBluetoothMediaClient();
26 ~FakeBluetoothMediaClient() override;
28 // DBusClient override.
29 void Init(dbus::Bus* bus) override;
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;
44 // Makes the media object visible/invisible to emulate the addition/removal
45 // events.
46 void SetVisible(bool visible);
48 // Sets the registration state for a given media endpoint.
49 void SetEndpointRegistered(
50 FakeBluetoothMediaEndpointServiceProvider* endpoint,
51 bool registered);
53 // Indicates whether the given endpoint path is registered or not.
54 bool IsRegistered(const dbus::ObjectPath& endpoint_path);
56 private:
57 // Indicates whether the media object is visible or not.
58 bool visible_;
60 // The path of the media object.
61 dbus::ObjectPath object_path_;
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_;
68 // List of observers interested in event notifications from us.
69 ObserverList<BluetoothMediaClient::Observer> observers_;
71 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient);
74 } // namespace chromeos
76 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_