forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtutorial_description.cc
62 lines (52 loc) · 2.24 KB
/
tutorial_description.cc
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
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/user_education/common/tutorial_description.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/interaction_sequence.h"
namespace user_education {
TutorialDescription::TutorialDescription() = default;
TutorialDescription::~TutorialDescription() = default;
TutorialDescription::TutorialDescription(TutorialDescription&&) = default;
TutorialDescription& TutorialDescription::operator=(TutorialDescription&&) =
default;
TutorialDescription::Step::Step()
: step_type(ui::InteractionSequence::StepType::kShown),
arrow(HelpBubbleArrow::kNone) {}
TutorialDescription::Step::~Step() = default;
TutorialDescription::Step::Step(
int title_text_id_,
int body_text_id_,
ui::InteractionSequence::StepType step_type_,
ui::ElementIdentifier element_id_,
std::string element_name_,
HelpBubbleArrow arrow_,
ui::CustomElementEventType event_type_,
absl::optional<bool> must_remain_visible_,
bool transition_only_on_event_,
TutorialDescription::NameElementsCallback name_elements_callback_,
ContextMode context_mode_)
: title_text_id(title_text_id_),
body_text_id(body_text_id_),
step_type(step_type_),
event_type(event_type_),
element_id(element_id_),
element_name(element_name_),
arrow(arrow_),
must_remain_visible(must_remain_visible_),
transition_only_on_event(transition_only_on_event_),
name_elements_callback(name_elements_callback_),
context_mode(context_mode_) {
DCHECK(!title_text_id || body_text_id)
<< "Tutorial bubble should not have a title without body text.";
}
TutorialDescription::Step::Step(const TutorialDescription::Step&) = default;
TutorialDescription::Step& TutorialDescription::Step::operator=(
const TutorialDescription::Step&) = default;
bool TutorialDescription::Step::Step::ShouldShowBubble() const {
// Hide steps and steps with no body text are "hidden" steps.
return body_text_id &&
step_type != ui::InteractionSequence::StepType::kHidden;
}
} // namespace user_education