summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorharrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 07:43:18 +0000
committerharrym@chromium.org <harrym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 07:43:18 +0000
commit3f540b4b5643a8269d8e30974011bb808fc521fb (patch)
treee8cfb120f0c6ee3f88d23687c38d9bf1df261af9 /ash
parent97bb45bb2e4828aef13c47b6e16147c312f31cf2 (diff)
downloadchromium_src-3f540b4b5643a8269d8e30974011bb808fc521fb.zip
chromium_src-3f540b4b5643a8269d8e30974011bb808fc521fb.tar.gz
chromium_src-3f540b4b5643a8269d8e30974011bb808fc521fb.tar.bz2
Switch Next Window Key functionality
Switches the next window button on chromeos (f5) to act the same as alt-tab/shift-alt-tab BUG=174035 TBR=sky@chromium.org Review URL: https://chromiumcodereview.appspot.com/12618014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190579 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/accelerators/accelerator_controller.cc3
-rw-r--r--ash/focus_cycler.cc2
-rw-r--r--ash/shelf/shelf_layout_manager.cc2
-rw-r--r--ash/wm/gestures/bezel_gesture_handler.cc6
-rw-r--r--ash/wm/window_cycle_controller.cc18
-rw-r--r--ash/wm/window_cycle_controller.h9
6 files changed, 29 insertions, 11 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 9a1f309..02be206 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -95,7 +95,8 @@ bool HandleCycleWindowMRU(WindowCycleController::Direction direction,
}
void HandleCycleWindowLinear(CycleDirection direction) {
- Launcher::ForPrimaryDisplay()->CycleWindowLinear(direction);
+ Shell::GetInstance()->
+ window_cycle_controller()->HandleLinearCycleWindow();
}
#if defined(OS_CHROMEOS)
diff --git a/ash/focus_cycler.cc b/ash/focus_cycler.cc
index 80ef432..ee9d22f 100644
--- a/ash/focus_cycler.cc
+++ b/ash/focus_cycler.cc
@@ -17,7 +17,7 @@ namespace ash {
namespace {
bool HasFocusableWindow() {
- return !WindowCycleController::BuildWindowList(NULL).empty();
+ return !WindowCycleController::BuildWindowList(NULL, false).empty();
}
} // namespace
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 1a11cb6..2658ffd 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -846,7 +846,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
return SHELF_AUTO_HIDE_SHOWN;
const std::vector<aura::Window*> windows =
- ash::WindowCycleController::BuildWindowList(NULL);
+ ash::WindowCycleController::BuildWindowList(NULL, false);
// Process the window list and check if there are any visible windows.
for (size_t i = 0; i < windows.size(); ++i) {
diff --git a/ash/wm/gestures/bezel_gesture_handler.cc b/ash/wm/gestures/bezel_gesture_handler.cc
index a306f6f..4d5dadf 100644
--- a/ash/wm/gestures/bezel_gesture_handler.cc
+++ b/ash/wm/gestures/bezel_gesture_handler.cc
@@ -139,13 +139,11 @@ bool BezelGestureHandler::HandleLauncherControl(const ui::GestureEvent& event) {
bool BezelGestureHandler::HandleApplicationControl(
const ui::GestureEvent& event) {
- ash::AcceleratorController* accelerator =
- ash::Shell::GetInstance()->accelerator_controller();
if (start_location_ == BEZEL_START_LEFT && event.details().scroll_x() > 0) {
- accelerator->PerformAction(CYCLE_BACKWARD_LINEAR, ui::Accelerator());
+ Launcher::ForPrimaryDisplay()->CycleWindowLinear(CYCLE_BACKWARD);
} else if (start_location_ == BEZEL_START_RIGHT &&
event.details().scroll_x() < 0) {
- accelerator->PerformAction(CYCLE_FORWARD_LINEAR, ui::Accelerator());
+ Launcher::ForPrimaryDisplay()->CycleWindowLinear(CYCLE_FORWARD);
} else {
return false;
}
diff --git a/ash/wm/window_cycle_controller.cc b/ash/wm/window_cycle_controller.cc
index 2aae2a6..86f3cf8 100644
--- a/ash/wm/window_cycle_controller.cc
+++ b/ash/wm/window_cycle_controller.cc
@@ -149,13 +149,24 @@ void WindowCycleController::HandleCycleWindow(Direction direction,
}
}
+void WindowCycleController::HandleLinearCycleWindow() {
+ if (!CanCycle() || IsCycling())
+ return;
+
+ // Use the reversed list of windows to prevent a 2-cycle of the most recent
+ // windows occurring.
+ WindowCycleList cycle_list(BuildWindowList(NULL,true));
+ cycle_list.Step(WindowCycleList::FORWARD);
+}
+
void WindowCycleController::AltKeyReleased() {
StopCycling();
}
// static
std::vector<aura::Window*> WindowCycleController::BuildWindowList(
- const std::list<aura::Window*>* mru_windows) {
+ const std::list<aura::Window*>* mru_windows,
+ bool top_most_at_end) {
WindowCycleList::WindowList windows;
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
@@ -198,7 +209,8 @@ std::vector<aura::Window*> WindowCycleController::BuildWindowList(
}
// Window cycling expects the topmost window at the front of the list.
- std::reverse(windows.begin(), windows.end());
+ if (!top_most_at_end)
+ std::reverse(windows.begin(), windows.end());
return windows;
}
@@ -225,7 +237,7 @@ void WindowCycleController::OnRootWindowAdded(aura::RootWindow* root_window) {
// WindowCycleController, private:
void WindowCycleController::StartCycling() {
- windows_.reset(new WindowCycleList(BuildWindowList(&mru_windows_)));
+ windows_.reset(new WindowCycleList(BuildWindowList(&mru_windows_, false)));
}
void WindowCycleController::Step(Direction direction) {
diff --git a/ash/wm/window_cycle_controller.h b/ash/wm/window_cycle_controller.h
index e673892..9f5b8be 100644
--- a/ash/wm/window_cycle_controller.h
+++ b/ash/wm/window_cycle_controller.h
@@ -58,6 +58,10 @@ class ASH_EXPORT WindowCycleController
// installs a key filter to watch for alt being released.
void HandleCycleWindow(Direction direction, bool is_alt_down);
+ // Cycles between windows without maintaining a multi-step cycle sequence
+ // (see above).
+ void HandleLinearCycleWindow();
+
// Informs the controller that the Alt key has been released and it can
// terminate the existing multi-step cycle.
void AltKeyReleased();
@@ -78,8 +82,11 @@ class ASH_EXPORT WindowCycleController
// windows being iterated over.
// If |mru_windows| is not NULL, windows in this list are put at the head of
// the window list.
+ // If |top_most_at_end| the window list will return in ascending order instead
+ // of the default descending.
static std::vector<aura::Window*> BuildWindowList(
- const std::list<aura::Window*>* mru_windows);
+ const std::list<aura::Window*>* mru_windows,
+ bool top_most_at_end);
private:
// Call to start cycling windows. You must call StopCycling() when done.