forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multidevice_setup_state_updater.h
56 lines (44 loc) · 2.18 KB
/
multidevice_setup_state_updater.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright 2020 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_COMPONENTS_PHONEHUB_MULTIDEVICE_SETUP_STATE_UPDATER_H_
#define CHROMEOS_COMPONENTS_PHONEHUB_MULTIDEVICE_SETUP_STATE_UPDATER_H_
#include "chromeos/components/phonehub/notification_access_manager.h"
#include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h"
class PrefRegistrySimple;
class PrefService;
namespace chromeos {
namespace phonehub {
// This class enables the PhoneHub Multidevice feature state when the HostStatus
// (provided by the MultideviceSetupClient) of the phone is initially
// |kHostSetLocallyButWaitingForBackendConfirmation|, and becomes either 1)
// |kHostVerified|, or 2) becomes |kHostSetButNotYetVerified| first, and then
// later |kHostVerified|. This class also disables the PhoneHubNotification
// Multidevice feature state when Notification access has been revoked by the
// phone, provided via NotificationAccessManager.
class MultideviceSetupStateUpdater
: public multidevice_setup::MultiDeviceSetupClient::Observer,
public NotificationAccessManager::Observer {
public:
static void RegisterPrefs(PrefRegistrySimple* registry);
MultideviceSetupStateUpdater(
PrefService* pref_service,
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client,
NotificationAccessManager* notification_access_manager);
~MultideviceSetupStateUpdater() override;
private:
// multidevice_setup::MultiDeviceSetupClient::Observer:
void OnHostStatusChanged(
const multidevice_setup::MultiDeviceSetupClient::HostStatusWithDevice&
host_device_with_status) override;
// NotificationAccessManager::Observer:
void OnNotificationAccessChanged() override;
void UpdateIsAwaitingVerifiedHost(
multidevice_setup::mojom::HostStatus host_status);
PrefService* pref_service_;
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
NotificationAccessManager* notification_access_manager_;
};
} // namespace phonehub
} // namespace chromeos
#endif // CHROMEOS_COMPONENTS_PHONEHUB_MULTIDEVICE_SETUP_STATE_UPDATER_H_