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 57 58 59 60 61
|
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_ASH_COMPONENTS_PHONEHUB_ONBOARDING_UI_TRACKER_H_
#define CHROMEOS_ASH_COMPONENTS_PHONEHUB_ONBOARDING_UI_TRACKER_H_
#include "base/observer_list.h"
#include "base/observer_list_types.h"
namespace ash::phonehub {
// Tracks whether Phone Hub should show a UI to ask users to opt into the multi-
// device feature suite. Note that this UI is not the setup flow itself; rather,
// it serves as an additional entry point to that flow for users who may be
// interested in Phone Hub.
//
// This UI should be shown when a user is eligible for the Phone Hub feature but
// has not yet completed setup for it. If the current user has already set up
// Phone Hub on this device, the setup UI should not be shown. The UI also
// provides an option to dismiss the UI, in which case it should not be shown
// again.
class OnboardingUiTracker {
public:
class Observer : public base::CheckedObserver {
public:
~Observer() override = default;
virtual void OnShouldShowOnboardingUiChanged() = 0;
};
OnboardingUiTracker(const OnboardingUiTracker&) = delete;
OnboardingUiTracker& operator=(const OnboardingUiTracker&) = delete;
virtual ~OnboardingUiTracker();
// Whether the setup UI should be shown.
virtual bool ShouldShowOnboardingUi() const = 0;
// Disables the ability to show the setup UI; once this is called,
// ShouldShowOnboardingUi() will no longer return true for this user on this
// device.
virtual void DismissSetupUi() = 0;
// Handle for when the user clicks the get started button.
virtual void HandleGetStarted(bool is_icon_clicked_when_nudge_visible) = 0;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
protected:
OnboardingUiTracker();
void NotifyShouldShowOnboardingUiChanged();
private:
base::ObserverList<Observer> observer_list_;
};
} // namespace ash::phonehub
#endif // CHROMEOS_ASH_COMPONENTS_PHONEHUB_ONBOARDING_UI_TRACKER_H_
|