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

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

Issue 22778002: Revert 216874 - Use overview mode for alt-tab cycling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
103 void HandleCycleWindowLinear(CycleDirection direction) { 97 void HandleCycleWindowLinear(CycleDirection direction) {
104 Shell::GetInstance()-> 98 Shell::GetInstance()->
105 window_cycle_controller()->HandleLinearCycleWindow(); 99 window_cycle_controller()->HandleLinearCycleWindow();
106 } 100 }
107 101
108 void ToggleOverviewMode() { 102 void ToggleOverviewMode() {
109 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); 103 Shell::GetInstance()->window_selector_controller()->ToggleOverview();
110 } 104 }
111 105
112 bool HandleAccessibleFocusCycle(bool reverse) { 106 bool HandleAccessibleFocusCycle(bool reverse) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 // function might be called *twice*, via BrowserView::PreHandleKeyboardEvent 511 // function might be called *twice*, via BrowserView::PreHandleKeyboardEvent
518 // and BrowserView::HandleKeyboardEvent, for a single accelerator press. 512 // and BrowserView::HandleKeyboardEvent, for a single accelerator press.
519 switch (action) { 513 switch (action) {
520 case ACCESSIBLE_FOCUS_NEXT: 514 case ACCESSIBLE_FOCUS_NEXT:
521 return HandleAccessibleFocusCycle(false); 515 return HandleAccessibleFocusCycle(false);
522 case ACCESSIBLE_FOCUS_PREVIOUS: 516 case ACCESSIBLE_FOCUS_PREVIOUS:
523 return HandleAccessibleFocusCycle(true); 517 return HandleAccessibleFocusCycle(true);
524 case CYCLE_BACKWARD_MRU: 518 case CYCLE_BACKWARD_MRU:
525 if (key_code == ui::VKEY_TAB) 519 if (key_code == ui::VKEY_TAB)
526 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); 520 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB);
527 if (CommandLine::ForCurrentProcess()->HasSwitch(
528 switches::kAshEnableOverviewMode)) {
529 return HandleCycleWindowOverviewMRU(WindowSelector::BACKWARD);
530 }
531 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, 521 return HandleCycleWindowMRU(WindowCycleController::BACKWARD,
532 accelerator.IsAltDown()); 522 accelerator.IsAltDown());
533 case CYCLE_FORWARD_MRU: 523 case CYCLE_FORWARD_MRU:
534 if (key_code == ui::VKEY_TAB) 524 if (key_code == ui::VKEY_TAB)
535 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); 525 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB);
536 if (CommandLine::ForCurrentProcess()->HasSwitch(
537 switches::kAshEnableOverviewMode)) {
538 return HandleCycleWindowOverviewMRU(WindowSelector::FORWARD);
539 }
540 return HandleCycleWindowMRU(WindowCycleController::FORWARD, 526 return HandleCycleWindowMRU(WindowCycleController::FORWARD,
541 accelerator.IsAltDown()); 527 accelerator.IsAltDown());
542 case CYCLE_BACKWARD_LINEAR: 528 case CYCLE_BACKWARD_LINEAR:
543 if (CommandLine::ForCurrentProcess()->HasSwitch( 529 if (CommandLine::ForCurrentProcess()->HasSwitch(
544 switches::kAshEnableOverviewMode)) { 530 switches::kAshEnableOverviewMode)) {
545 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5); 531 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5);
546 ToggleOverviewMode(); 532 ToggleOverviewMode();
547 return true; 533 return true;
548 } 534 }
549 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) 535 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1)
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 keyboard_brightness_control_delegate) { 983 keyboard_brightness_control_delegate) {
998 keyboard_brightness_control_delegate_ = 984 keyboard_brightness_control_delegate_ =
999 keyboard_brightness_control_delegate.Pass(); 985 keyboard_brightness_control_delegate.Pass();
1000 } 986 }
1001 987
1002 bool AcceleratorController::CanHandleAccelerators() const { 988 bool AcceleratorController::CanHandleAccelerators() const {
1003 return true; 989 return true;
1004 } 990 }
1005 991
1006 } // namespace ash 992 } // 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