OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_COMMON_FOCUS_CYCLER_H_ | |
6 #define ASH_COMMON_FOCUS_CYCLER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "base/macros.h" | |
12 | |
13 namespace views { | |
14 class Widget; | |
15 } // namespace views | |
16 | |
17 namespace ash { | |
18 | |
19 // This class handles moving focus between a set of widgets and the main browser | |
20 // window. | |
21 class ASH_EXPORT FocusCycler { | |
22 public: | |
23 enum Direction { FORWARD, BACKWARD }; | |
24 | |
25 FocusCycler(); | |
26 ~FocusCycler(); | |
27 | |
28 // Returns the widget the FocusCycler is attempting to activate or NULL if | |
29 // FocusCycler is not activating any widgets. | |
30 const views::Widget* widget_activating() const { return widget_activating_; } | |
31 | |
32 // Add a widget to the focus cycle. The widget needs to have an | |
33 // AccessiblePaneView as the content view. | |
34 void AddWidget(views::Widget* widget); | |
35 | |
36 // Remove a widget from the focus cycle. | |
37 void RemoveWidget(views::Widget* widget); | |
38 | |
39 // Move focus to the next widget. | |
40 void RotateFocus(Direction direction); | |
41 | |
42 // Moves focus the specified widget. Returns true if the widget was activated. | |
43 bool FocusWidget(views::Widget* widget); | |
44 | |
45 private: | |
46 std::vector<views::Widget*> widgets_; | |
47 | |
48 // See description above getter. | |
49 views::Widget* widget_activating_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(FocusCycler); | |
52 }; | |
53 | |
54 } // namespace ash | |
55 | |
56 #endif // ASH_COMMON_FOCUS_CYCLER_H_ | |
OLD | NEW |