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
ash / game_dashboard / game_dashboard_welcome_dialog.h [blame]
// Copyright 2024 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_GAME_DASHBOARD_GAME_DASHBOARD_WELCOME_DIALOG_H_
#define ASH_GAME_DASHBOARD_GAME_DASHBOARD_WELCOME_DIALOG_H_
#include "ash/ash_export.h"
#include "base/timer/timer.h"
#include "ui/views/layout/flex_layout_view.h"
namespace ash {
class SystemShadow;
// `GameDashboardWelcomeDialog` is a View displayed for a set duration of time
// when first opening any game. It can be disabled via the Game Dashboard
// Settings.
class ASH_EXPORT GameDashboardWelcomeDialog : public views::FlexLayoutView {
METADATA_HEADER(GameDashboardWelcomeDialog, views::FlexLayoutView)
public:
GameDashboardWelcomeDialog();
GameDashboardWelcomeDialog(const GameDashboardWelcomeDialog&) = delete;
GameDashboardWelcomeDialog& operator=(const GameDashboardWelcomeDialog) =
delete;
~GameDashboardWelcomeDialog() override;
// Starts the `timer_`, which will run the given `on_complete` once the time
// specified by `kDialogDuration` has elapsed.
void StartTimer(base::OnceClosure on_complete);
// Sends an accessibility specific announcement for the screen reader. If the
// screen reader isn't enabled, the announcement is automatically ignored.
void AnnounceForAccessibility();
private:
// Adds a stacked title/sub-label and an icon as a row to the welcome dialog.
void AddTitleAndIconRow();
// Adds a row displaying how to open the dashboard.
void AddShortcutInfoRow();
// Timer for how long to show the welcome dialog.
base::OneShotTimer timer_;
std::unique_ptr<SystemShadow> shadow_;
};
} // namespace ash
#endif // ASH_GAME_DASHBOARD_GAME_DASHBOARD_WELCOME_DIALOG_H_