diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-07 07:41:51 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-07 07:41:51 +0000 |
commit | 3d29912aabadc1413d481e4d9b8b5f1d24516817 (patch) | |
tree | 3515d553ae909a50483d145d963d3bad08435342 /ash/focus_cycler.h | |
parent | 97b1b733eb4314c287c8c04c3514d530677bf945 (diff) | |
download | chromium_src-3d29912aabadc1413d481e4d9b8b5f1d24516817.zip chromium_src-3d29912aabadc1413d481e4d9b8b5f1d24516817.tar.gz chromium_src-3d29912aabadc1413d481e4d9b8b5f1d24516817.tar.bz2 |
Allow focus to be sent between browser window and launcher/status window
R=sky@chromium.org
BUG=104192
TEST=Use ctrl+forward/back to move between browser window and status area/launcher
Review URL: http://codereview.chromium.org/9295049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/focus_cycler.h')
-rw-r--r-- | ash/focus_cycler.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/ash/focus_cycler.h b/ash/focus_cycler.h new file mode 100644 index 0000000..dfdf7e5 --- /dev/null +++ b/ash/focus_cycler.h @@ -0,0 +1,55 @@ +// 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 <vector> + +#include "base/compiler_specific.h" +#include "ui/base/accelerators/accelerator.h" + +namespace views { +class Widget; +} // namespace views + +namespace ash { + +namespace internal { + +// This class handles moving focus between a set of widgets and the main browser +// window. +class FocusCycler : public ui::AcceleratorTarget { + public: + enum Direction { + FORWARD, + BACKWARD + }; + + FocusCycler(); + virtual ~FocusCycler(); + + // 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(Direction direction); + + // ui::AcceleratorTarget overrides + virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; + virtual bool CanHandleAccelerators() const OVERRIDE; + + private: + std::vector<views::Widget*> widgets_; + + DISALLOW_COPY_AND_ASSIGN(FocusCycler); +}; + +} // namespace internal + +} // namespace ash + +#endif // FOCUS_CYCLER_H_ |