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
70
71
72
73
74
ash / system / accessibility / facegaze_bubble_view.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_SYSTEM_ACCESSIBILITY_FACEGAZE_BUBBLE_VIEW_H_
#define ASH_SYSTEM_ACCESSIBILITY_FACEGAZE_BUBBLE_VIEW_H_
#include <string>
#include "ash/ash_export.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/metadata/view_factory.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
namespace ui {
class MouseEvent;
} // namespace ui
namespace views {
class ImageView;
class Label;
} // namespace views
namespace ash {
// The FaceGaze bubble view. This is a UI that appears at the top of the screen,
// which tells the user the most recently recognized facial gesture and the
// corresponding action that was taken. This view is only visible when the
// FaceGaze feature is enabled.
class ASH_EXPORT FaceGazeBubbleView : public views::BubbleDialogDelegateView {
METADATA_HEADER(FaceGazeBubbleView, views::BubbleDialogDelegateView)
public:
explicit FaceGazeBubbleView(
const base::RepeatingCallback<void()>& on_mouse_entered);
FaceGazeBubbleView(const FaceGazeBubbleView&) = delete;
FaceGazeBubbleView& operator=(const FaceGazeBubbleView&) = delete;
~FaceGazeBubbleView() override;
// Updates text content of this view.
void Update(const std::u16string& text, bool is_warning);
// views::BubbleDialogDelegateView:
void OnThemeChanged() override;
// views::View:
void OnMouseEntered(const ui::MouseEvent& event) override;
const std::u16string& GetTextForTesting() const;
private:
friend class FaceGazeBubbleControllerTest;
// Updates color of this view.
void UpdateColor(bool is_warning);
// Custom callback that is called whenever the mouse enters or exits this
// view.
const base::RepeatingCallback<void()> on_mouse_entered_;
// An image that displays the FaceGaze logo.
raw_ptr<views::ImageView> image_ = nullptr;
// A label that displays the most recently recognized gesture and
// corresponding action.
raw_ptr<views::Label> label_ = nullptr;
};
} // namespace ash
#endif // ASH_SYSTEM_ACCESSIBILITY_FACEGAZE_BUBBLE_VIEW_H_