Index: ash/focus_cycler.h |
diff --git a/ash/focus_cycler.h b/ash/focus_cycler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..544896357ea12a252f054bc4fdb12222a8077a15 |
--- /dev/null |
+++ b/ash/focus_cycler.h |
@@ -0,0 +1,48 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef FOCUS_CYCLER_H_ |
+#define FOCUS_CYCLER_H_ |
+#pragma once |
+ |
+#include "ash/accelerators/accelerator_controller.h" |
sky
2012/01/31 16:38:15
Include ui/base/accelerators/accelerator instead.
Zachary Kuznia
2012/01/31 17:57:42
Done.
|
+ |
+#include <vector> |
sky
2012/01/31 16:38:15
vector should be the first include.
Zachary Kuznia
2012/01/31 17:57:42
Done.
|
+ |
+namespace views { |
+class Widget; |
+} // namespace views |
+ |
+namespace ash { |
+ |
sky
2012/01/31 16:38:15
If this class isn't needed outside of ash, put it
Zachary Kuznia
2012/01/31 17:57:42
Done.
|
+// This class handles moving focus between a set of widgets and the main browser |
+// window. |
+class FocusCycler : public ui::AcceleratorTarget { |
+ public: |
+ FocusCycler(); |
+ ~FocusCycler(); |
sky
2012/01/31 16:38:15
virtual
Zachary Kuznia
2012/01/31 17:57:42
Done.
|
+ |
+ // Add a widget to the focus cycle and set up accelerators. The widget needs |
+ // to have an AccessiblePaneView as the content view. |
+ void AddWidget(views::Widget* widget); |
+ |
+ // Move focus to the next widget. |
+ void RotateFocus(bool forwards); |
sky
2012/01/31 16:38:15
Use an enum to make it clear what true/value mean.
Zachary Kuznia
2012/01/31 17:57:42
Done.
|
+ |
+ // ui::AcceleratorTarget overrides |
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
+ virtual bool CanHandleAccelerators() const OVERRIDE; |
+ |
+ private: |
+ ui::Accelerator ctrl_forward_key_; |
sky
2012/01/31 16:38:15
Do these really need to exist as members? Can AddW
Zachary Kuznia
2012/01/31 17:57:42
Done.
|
+ ui::Accelerator ctrl_back_key_; |
+ |
+ std::vector<views::Widget*> widgets_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FocusCycler); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // FOCUS_CYCLER_H_ |