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

ash / user_education / welcome_tour / welcome_tour_dialog.h [blame]

// Copyright 2023 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_USER_EDUCATION_WELCOME_TOUR_WELCOME_TOUR_DIALOG_H_
#define ASH_USER_EDUCATION_WELCOME_TOUR_WELCOME_TOUR_DIALOG_H_

#include "ash/ash_export.h"
#include "ash/style/system_dialog_delegate_view.h"
#include "base/functional/callback_forward.h"

namespace ash {

// A singleton dialog view which serves as a part of the Welcome Tour. From this
// dialog, a user can choose to accept or cancel the Welcome Tour tutorial. Used
// if and only if the Welcome Tour feature is enabled.
class ASH_EXPORT WelcomeTourDialog : public SystemDialogDelegateView {
  METADATA_HEADER(WelcomeTourDialog, SystemDialogDelegateView)

 public:
  // Creates and shows the Welcome Tour dialog at the center of the primary
  // display. `accept_callback` is the callback that runs when the accept button
  // is clicked. `cancel_callback` is the callback that runs when the cancel
  // button is clicked. `close_callback` is the callback that runs when a user
  // closes the dialog without clicking the accept button or the cancel button.
  static void CreateAndShow(base::OnceClosure accept_callback,
                            base::OnceClosure cancel_callback,
                            base::OnceClosure close_callback);

  // Returns a pointer to the `WelcomeTourDialog` instance. Returns `nullptr` if
  // the instance does not exist.
  static WelcomeTourDialog* Get();

  WelcomeTourDialog(const WelcomeTourDialog&) = delete;
  WelcomeTourDialog& operator=(const WelcomeTourDialog&) = delete;
  ~WelcomeTourDialog() override;

 private:
  WelcomeTourDialog(base::OnceClosure accept_callback,
                    base::OnceClosure cancel_callback,
                    base::OnceClosure close_callback);
};

}  // namespace ash

#endif  // ASH_USER_EDUCATION_WELCOME_TOUR_WELCOME_TOUR_DIALOG_H_