Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 22715005: Use overview mode for alt-tab cycling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/window_selector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <iostream> 9 #include <iostream>
10 #include <string> 10 #include <string>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 bool HandleCycleWindowMRU(WindowCycleController::Direction direction, 89 bool HandleCycleWindowMRU(WindowCycleController::Direction direction,
90 bool is_alt_down) { 90 bool is_alt_down) {
91 Shell::GetInstance()-> 91 Shell::GetInstance()->
92 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down); 92 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down);
93 // Always report we handled the key, even if the window didn't change. 93 // Always report we handled the key, even if the window didn't change.
94 return true; 94 return true;
95 } 95 }
96 96
97 bool HandleCycleWindowOverviewMRU(WindowSelector::Direction direction) {
98 Shell::GetInstance()->
99 window_selector_controller()->HandleCycleWindow(direction);
100 return true;
101 }
102
97 void HandleCycleWindowLinear(CycleDirection direction) { 103 void HandleCycleWindowLinear(CycleDirection direction) {
98 Shell::GetInstance()-> 104 Shell::GetInstance()->
99 window_cycle_controller()->HandleLinearCycleWindow(); 105 window_cycle_controller()->HandleLinearCycleWindow();
100 } 106 }
101 107
102 void ToggleOverviewMode() { 108 void ToggleOverviewMode() {
103 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); 109 Shell::GetInstance()->window_selector_controller()->ToggleOverview();
104 } 110 }
105 111
106 bool HandleAccessibleFocusCycle(bool reverse) { 112 bool HandleAccessibleFocusCycle(bool reverse) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // function might be called *twice*, via BrowserView::PreHandleKeyboardEvent 517 // function might be called *twice*, via BrowserView::PreHandleKeyboardEvent
512 // and BrowserView::HandleKeyboardEvent, for a single accelerator press. 518 // and BrowserView::HandleKeyboardEvent, for a single accelerator press.
513 switch (action) { 519 switch (action) {
514 case ACCESSIBLE_FOCUS_NEXT: 520 case ACCESSIBLE_FOCUS_NEXT:
515 return HandleAccessibleFocusCycle(false); 521 return HandleAccessibleFocusCycle(false);
516 case ACCESSIBLE_FOCUS_PREVIOUS: 522 case ACCESSIBLE_FOCUS_PREVIOUS:
517 return HandleAccessibleFocusCycle(true); 523 return HandleAccessibleFocusCycle(true);
518 case CYCLE_BACKWARD_MRU: 524 case CYCLE_BACKWARD_MRU:
519 if (key_code == ui::VKEY_TAB) 525 if (key_code == ui::VKEY_TAB)
520 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); 526 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB);
527 if (CommandLine::ForCurrentProcess()->HasSwitch(
528 switches::kAshEnableOverviewMode)) {
529 return HandleCycleWindowOverviewMRU(WindowSelector::BACKWARD);
530 }
521 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, 531 return HandleCycleWindowMRU(WindowCycleController::BACKWARD,
522 accelerator.IsAltDown()); 532 accelerator.IsAltDown());
523 case CYCLE_FORWARD_MRU: 533 case CYCLE_FORWARD_MRU:
524 if (key_code == ui::VKEY_TAB) 534 if (key_code == ui::VKEY_TAB)
525 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); 535 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB);
536 if (CommandLine::ForCurrentProcess()->HasSwitch(
537 switches::kAshEnableOverviewMode)) {
538 return HandleCycleWindowOverviewMRU(WindowSelector::FORWARD);
539 }
526 return HandleCycleWindowMRU(WindowCycleController::FORWARD, 540 return HandleCycleWindowMRU(WindowCycleController::FORWARD,
527 accelerator.IsAltDown()); 541 accelerator.IsAltDown());
528 case CYCLE_BACKWARD_LINEAR: 542 case CYCLE_BACKWARD_LINEAR:
529 if (CommandLine::ForCurrentProcess()->HasSwitch( 543 if (CommandLine::ForCurrentProcess()->HasSwitch(
530 switches::kAshEnableOverviewMode)) { 544 switches::kAshEnableOverviewMode)) {
531 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5); 545 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5);
532 ToggleOverviewMode(); 546 ToggleOverviewMode();
533 return true; 547 return true;
534 } 548 }
535 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) 549 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1)
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 keyboard_brightness_control_delegate) { 997 keyboard_brightness_control_delegate) {
984 keyboard_brightness_control_delegate_ = 998 keyboard_brightness_control_delegate_ =
985 keyboard_brightness_control_delegate.Pass(); 999 keyboard_brightness_control_delegate.Pass();
986 } 1000 }
987 1001
988 bool AcceleratorController::CanHandleAccelerators() const { 1002 bool AcceleratorController::CanHandleAccelerators() const {
989 return true; 1003 return true;
990 } 1004 }
991 1005
992 } // namespace ash 1006 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698