1. Enable large object pointer offset check in release build.
[chromium-blink-merge.git] / ash / focus_cycler.h
blob36ddc680d01f973b6a8736e986ead82c5de97567
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_
7 #pragma once
9 #include <vector>
11 #include "ash/ash_export.h"
12 #include "base/compiler_specific.h"
13 #include "ui/base/accelerators/accelerator.h"
15 namespace views {
16 class Widget;
17 } // namespace views
19 namespace ash {
21 namespace internal {
23 // This class handles moving focus between a set of widgets and the main browser
24 // window.
25 class ASH_EXPORT FocusCycler : public ui::AcceleratorTarget {
26 public:
27 enum Direction {
28 FORWARD,
29 BACKWARD
32 FocusCycler();
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;
53 private:
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
64 } // namespace ash
66 #endif // FOCUS_CYCLER_H_