Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: chromeos/dbus/fake_bluetooth_media_client.h

Issue 939753004: device/bluetooth: Implement Unregister() of BlueotoothAudioSinkChromeOS and disconnection-related c… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chromeos/dbus/fake_bluetooth_media_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "chromeos/chromeos_export.h" 12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/bluetooth_media_client.h" 13 #include "chromeos/dbus/bluetooth_media_client.h"
14 #include "dbus/object_path.h" 14 #include "dbus/object_path.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 class FakeBluetoothMediaEndpointServiceProvider;
19
18 class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient { 20 class CHROMEOS_EXPORT FakeBluetoothMediaClient : public BluetoothMediaClient {
19 public: 21 public:
20 // The default codec is SBC(0x00). 22 // The default codec is SBC(0x00).
21 static const uint8_t kDefaultCodec; 23 static const uint8_t kDefaultCodec;
22 24
23 FakeBluetoothMediaClient(); 25 FakeBluetoothMediaClient();
24 ~FakeBluetoothMediaClient() override; 26 ~FakeBluetoothMediaClient() override;
25 27
26 // DBusClient override. 28 // DBusClient override.
27 void Init(dbus::Bus* bus) override; 29 void Init(dbus::Bus* bus) override;
28 30
29 // BluetoothMediaClient overrides. 31 // BluetoothMediaClient overrides.
30 void AddObserver(BluetoothMediaClient::Observer* observer) override; 32 void AddObserver(BluetoothMediaClient::Observer* observer) override;
31 void RemoveObserver(BluetoothMediaClient::Observer* observer) override; 33 void RemoveObserver(BluetoothMediaClient::Observer* observer) override;
32 void RegisterEndpoint(const dbus::ObjectPath& object_path, 34 void RegisterEndpoint(const dbus::ObjectPath& object_path,
33 const dbus::ObjectPath& endpoint_path, 35 const dbus::ObjectPath& endpoint_path,
34 const EndpointProperties& properties, 36 const EndpointProperties& properties,
35 const base::Closure& callback, 37 const base::Closure& callback,
36 const ErrorCallback& error_callback) override; 38 const ErrorCallback& error_callback) override;
37 void UnregisterEndpoint(const dbus::ObjectPath& object_path, 39 void UnregisterEndpoint(const dbus::ObjectPath& object_path,
38 const dbus::ObjectPath& endpoint_path, 40 const dbus::ObjectPath& endpoint_path,
39 const base::Closure& callback, 41 const base::Closure& callback,
40 const ErrorCallback& error_callback) override; 42 const ErrorCallback& error_callback) override;
41 43
42 // Makes the media object visible/invisible to emulate the addition/removal 44 // Makes the media object visible/invisible to emulate the addition/removal
43 // events. 45 // events.
44 void SetVisible(bool visible); 46 void SetVisible(bool visible);
45 47
46 // Sets the registration state for a given media endpoint path. 48 // Sets the registration state for a given media endpoint.
47 void SetEndpointRegistered(const dbus::ObjectPath& endpoint_path, 49 void SetEndpointRegistered(
48 bool registered); 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);
49 55
50 private: 56 private:
51 // Indicates whether the media object is visible or not. 57 // Indicates whether the media object is visible or not.
52 bool visible_; 58 bool visible_;
53 59
54 // The path of the media object. 60 // The path of the media object.
55 dbus::ObjectPath object_path_; 61 dbus::ObjectPath object_path_;
56 62
57 // Pairs of endpoint paths and bool values indicating whether or not endpoints 63 // Map of registered endpoints. Each pair is composed of an endpoint path as
58 // are registered. 64 // key and a pointer to the endpoint as value.
59 std::map<dbus::ObjectPath, bool> endpoints_; 65 std::map<dbus::ObjectPath, FakeBluetoothMediaEndpointServiceProvider*>
66 endpoints_;
60 67
61 // List of observers interested in event notifications from us. 68 // List of observers interested in event notifications from us.
62 ObserverList<BluetoothMediaClient::Observer> observers_; 69 ObserverList<BluetoothMediaClient::Observer> observers_;
63 70
64 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient); 71 DISALLOW_COPY_AND_ASSIGN(FakeBluetoothMediaClient);
65 }; 72 };
66 73
67 } // namespace chromeos 74 } // namespace chromeos
68 75
69 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_ 76 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_MEDIA_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/dbus/fake_bluetooth_media_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698