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.
5 #ifndef FOCUS_CYCLER_H_
6 #define FOCUS_CYCLER_H_
11 #include "ash/ash_export.h"
12 #include "base/compiler_specific.h"
13 #include "ui/base/accelerators/accelerator.h"
23 // This class handles moving focus between a set of widgets and the main browser
25 class ASH_EXPORT FocusCycler
: public ui::AcceleratorTarget
{
33 virtual ~FocusCycler();
35 // Returns the widget the FocusCycler is attempting to activate or NULL if
36 // FocusCycler is not activating any widgets.
37 const views::Widget
* widget_activating() const { return widget_activating_
; }
39 // Add a widget to the focus cycle and set up accelerators. The widget needs
40 // to have an AccessiblePaneView as the content view.
41 void AddWidget(views::Widget
* widget
);
43 // Move focus to the next widget.
44 void RotateFocus(Direction direction
);
46 // Moves focus the specified widget. Returns true if the widget was activated.
47 bool FocusWidget(views::Widget
* widget
);
49 // ui::AcceleratorTarget overrides
50 virtual bool AcceleratorPressed(const ui::Accelerator
& accelerator
) OVERRIDE
;
51 virtual bool CanHandleAccelerators() const OVERRIDE
;
54 std::vector
<views::Widget
*> widgets_
;
56 // See description above getter.
57 views::Widget
* widget_activating_
;
59 DISALLOW_COPY_AND_ASSIGN(FocusCycler
);
62 } // namespace internal
66 #endif // FOCUS_CYCLER_H_