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
   62
   63
   64
   65
   66
   67
   68
   69

ash / system / phonehub / onboarding_view.h [blame]

// 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 ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_
#define ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_

#include "ash/ash_export.h"
#include "ash/system/phonehub/phone_hub_content_view.h"
#include "ash/system/tray/tray_bubble_view.h"
#include "base/memory/raw_ptr.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/view.h"

namespace ash {

class PhoneHubInterstitialView;

namespace phonehub {
class OnboardingUiTracker;
}

// An additional entry point UI to ask the existing multidevice users to opt in
// and set up the Phone feature on this device. Note that this class handles
// both the main onboarding screen and the dismiss prompt together.
class ASH_EXPORT OnboardingView : public PhoneHubContentView {
  METADATA_HEADER(OnboardingView, PhoneHubContentView)

 public:
  class Delegate {
   public:
    virtual void HideStatusHeaderView() = 0;
    virtual bool IsPhoneHubIconClickedWhenNudgeVisible() = 0;
  };

  // The different onboarding flows that are supported.
  enum OnboardingFlow { kExistingMultideviceUser = 0, kNewMultideviceUser };

  OnboardingView(phonehub::OnboardingUiTracker* onboarding_ui_tracker,
                 Delegate* delegate,
                 OnboardingFlow onboarding_flow);
  OnboardingView(const OnboardingView&) = delete;
  OnboardingView& operator=(const OnboardingView&) = delete;
  ~OnboardingView() override;

  // Update |content_view_| to display the dismiss prompt contents.
  // Invoked when user clicks the "Dismiss" button on the main onboarding view.
  void ShowDismissPrompt();

  // Determine if OnboardingView is created when nudge is visible.
  bool IsOnboardingViewStartedFromNudge();

  // PhoneHubContentView:
  void OnBubbleClose() override;
  phone_hub_metrics::Screen GetScreenForMetrics() const override;

 private:
  // The view responsible for displaying the onboarding UI contents.
  // Owned by view hierarchy.
  raw_ptr<PhoneHubInterstitialView, DanglingUntriaged> main_view_ = nullptr;

  raw_ptr<phonehub::OnboardingUiTracker> onboarding_ui_tracker_ = nullptr;
  raw_ptr<Delegate, DanglingUntriaged> delegate_ = nullptr;
};

}  // namespace ash

#endif  // ASH_SYSTEM_PHONEHUB_ONBOARDING_VIEW_H_