forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device_sync_base.cc
38 lines (26 loc) · 1.03 KB
/
device_sync_base.cc
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
// Copyright 2018 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.
#include <utility>
#include "chromeos/services/device_sync/device_sync_base.h"
namespace chromeos {
namespace device_sync {
DeviceSyncBase::DeviceSyncBase() = default;
DeviceSyncBase::~DeviceSyncBase() = default;
void DeviceSyncBase::AddObserver(mojom::DeviceSyncObserverPtr observer,
AddObserverCallback callback) {
observers_.AddPtr(std::move(observer));
std::move(callback).Run();
}
void DeviceSyncBase::BindRequest(mojom::DeviceSyncRequest request) {
bindings_.AddBinding(this, std::move(request));
}
void DeviceSyncBase::NotifyOnEnrollmentFinished() {
observers_.ForAllPtrs(
[](auto* observer) { observer->OnEnrollmentFinished(); });
}
void DeviceSyncBase::NotifyOnNewDevicesSynced() {
observers_.ForAllPtrs([](auto* observer) { observer->OnNewDevicesSynced(); });
}
} // namespace device_sync
} // namespace chromeos