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
ash / shelf / shelf_focus_cycler.h [blame]
// Copyright 2019 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_SHELF_SHELF_FOCUS_CYCLER_H_
#define ASH_SHELF_SHELF_FOCUS_CYCLER_H_
#include "ash/ash_export.h"
#include "base/memory/raw_ptr.h"
namespace ash {
class Shelf;
// The containers that rely on ShelfFocusCycler to move focus outside of their
// view trees.
enum class SourceView {
kShelfNavigationView = 0,
kShelfView,
kStatusAreaView,
kDeskButton,
};
// ShelfFocusCycler handles the special focus transitions from the Login UI,
// Shelf, and Status Tray.
class ASH_EXPORT ShelfFocusCycler {
public:
explicit ShelfFocusCycler(Shelf* shelf);
ShelfFocusCycler(const ShelfFocusCycler&) = delete;
ShelfFocusCycler& operator=(const ShelfFocusCycler&) = delete;
~ShelfFocusCycler() = default;
// Moves focus from one container to the next. |reverse| will move the focus
// to the container to the left in LTR. RTL does not need to be accounted
// for when calling this function.
void FocusOut(bool reverse, SourceView source_view);
// Focuses the navigation widget (back and home buttons).
void FocusNavigation(bool last_element);
// Focuses the desk button widget.
void FocusDeskButton(bool last_element);
// Focuses the shelf widget (app shortcuts).
void FocusShelf(bool last_element);
// Focuses the status area widget.
void FocusStatusArea(bool last_element);
private:
// Owned by RootWindowController.
raw_ptr<Shelf> shelf_;
};
} // namespace ash
#endif // ASH_SHELF_SHELF_FOCUS_CYCLER_H_