forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiscovery_session_status_notifier.h
42 lines (32 loc) · 1.54 KB
/
discovery_session_status_notifier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_BLUETOOTH_CONFIG_DISCOVERY_SESSION_STATUS_NOTIFIER_H_
#define CHROMEOS_SERVICES_BLUETOOTH_CONFIG_DISCOVERY_SESSION_STATUS_NOTIFIER_H_
#include "chromeos/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/remote_set.h"
namespace chromeos {
namespace bluetooth_config {
// Notifiers all listeners of changes in discovery session status.
class DiscoverySessionStatusNotifier {
public:
virtual ~DiscoverySessionStatusNotifier();
// Adds an observer of discovery session status. |observer| will be notified
// each time discovery session status changes. To stop observing, clients
// should disconnect the Mojo pipe to |observer| by deleting the associated
// Receiver.
void ObserveDiscoverySessionStatusChanges(
mojo::PendingRemote<mojom::DiscoverySessionStatusObserver> observer);
protected:
DiscoverySessionStatusNotifier();
// Notifies all observers when "having at least one discovery session" changes
// between true and false.
void NotifyHasAtLeastOneDiscoverySessionChanged(
bool has_at_least_one_discovery_session);
private:
mojo::RemoteSet<mojom::DiscoverySessionStatusObserver> observers_;
};
} // namespace bluetooth_config
} // namespace chromeos
#endif // CHROMEOS_SERVICES_BLUETOOTH_CONFIG_DISCOVERY_SESSION_STATUS_NOTIFIER_H_