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

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

Issue 20415002: Add window overview mode behind --ash-enable-overview-mode flag to F5 key. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove implicit cast to bool. 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
« no previous file with comments | « no previous file | ash/ash.gyp » ('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 27 matching lines...) Expand all
38 #include "ash/system/tray/system_tray.h" 38 #include "ash/system/tray/system_tray.h"
39 #include "ash/system/tray/system_tray_delegate.h" 39 #include "ash/system/tray/system_tray_delegate.h"
40 #include "ash/system/tray/system_tray_notifier.h" 40 #include "ash/system/tray/system_tray_notifier.h"
41 #include "ash/system/web_notification/web_notification_tray.h" 41 #include "ash/system/web_notification/web_notification_tray.h"
42 #include "ash/touch/touch_hud_debug.h" 42 #include "ash/touch/touch_hud_debug.h"
43 #include "ash/volume_control_delegate.h" 43 #include "ash/volume_control_delegate.h"
44 #include "ash/wm/partial_screenshot_view.h" 44 #include "ash/wm/partial_screenshot_view.h"
45 #include "ash/wm/power_button_controller.h" 45 #include "ash/wm/power_button_controller.h"
46 #include "ash/wm/property_util.h" 46 #include "ash/wm/property_util.h"
47 #include "ash/wm/window_cycle_controller.h" 47 #include "ash/wm/window_cycle_controller.h"
48 #include "ash/wm/window_selector_controller.h"
48 #include "ash/wm/window_util.h" 49 #include "ash/wm/window_util.h"
49 #include "ash/wm/workspace/snap_sizer.h" 50 #include "ash/wm/workspace/snap_sizer.h"
50 #include "base/bind.h" 51 #include "base/bind.h"
51 #include "base/command_line.h" 52 #include "base/command_line.h"
52 #include "content/public/browser/gpu_data_manager.h" 53 #include "content/public/browser/gpu_data_manager.h"
53 #include "ui/aura/env.h" 54 #include "ui/aura/env.h"
54 #include "ui/aura/root_window.h" 55 #include "ui/aura/root_window.h"
55 #include "ui/base/accelerators/accelerator.h" 56 #include "ui/base/accelerators/accelerator.h"
56 #include "ui/base/accelerators/accelerator_manager.h" 57 #include "ui/base/accelerators/accelerator_manager.h"
57 #include "ui/base/events/event.h" 58 #include "ui/base/events/event.h"
(...skipping 30 matching lines...) Expand all
88 bool HandleCycleWindowMRU(WindowCycleController::Direction direction, 89 bool HandleCycleWindowMRU(WindowCycleController::Direction direction,
89 bool is_alt_down) { 90 bool is_alt_down) {
90 Shell::GetInstance()-> 91 Shell::GetInstance()->
91 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down); 92 window_cycle_controller()->HandleCycleWindow(direction, is_alt_down);
92 // 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.
93 return true; 94 return true;
94 } 95 }
95 96
96 void HandleCycleWindowLinear(CycleDirection direction) { 97 void HandleCycleWindowLinear(CycleDirection direction) {
97 Shell::GetInstance()-> 98 Shell::GetInstance()->
98 window_cycle_controller()->HandleLinearCycleWindow(); 99 window_cycle_controller()->HandleLinearCycleWindow();
100 }
101
102 void ToggleOverviewMode() {
103 Shell::GetInstance()->window_selector_controller()->ToggleOverview();
99 } 104 }
100 105
101 bool HandleAccessibleFocusCycle(bool reverse) { 106 bool HandleAccessibleFocusCycle(bool reverse) {
102 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) 107 if (!Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled())
103 return false; 108 return false;
104 aura::Window* active_window = ash::wm::GetActiveWindow(); 109 aura::Window* active_window = ash::wm::GetActiveWindow();
105 if (!active_window) 110 if (!active_window)
106 return false; 111 return false;
107 views::Widget* widget = 112 views::Widget* widget =
108 views::Widget::GetWidgetForNativeWindow(active_window); 113 views::Widget::GetWidgetForNativeWindow(active_window);
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 if (key_code == ui::VKEY_TAB) 519 if (key_code == ui::VKEY_TAB)
515 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB); 520 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_TAB);
516 return HandleCycleWindowMRU(WindowCycleController::BACKWARD, 521 return HandleCycleWindowMRU(WindowCycleController::BACKWARD,
517 accelerator.IsAltDown()); 522 accelerator.IsAltDown());
518 case CYCLE_FORWARD_MRU: 523 case CYCLE_FORWARD_MRU:
519 if (key_code == ui::VKEY_TAB) 524 if (key_code == ui::VKEY_TAB)
520 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB); 525 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_TAB);
521 return HandleCycleWindowMRU(WindowCycleController::FORWARD, 526 return HandleCycleWindowMRU(WindowCycleController::FORWARD,
522 accelerator.IsAltDown()); 527 accelerator.IsAltDown());
523 case CYCLE_BACKWARD_LINEAR: 528 case CYCLE_BACKWARD_LINEAR:
529 if (CommandLine::ForCurrentProcess()->HasSwitch(
530 switches::kAshEnableOverviewMode)) {
531 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5);
532 ToggleOverviewMode();
533 return true;
534 }
524 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) 535 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1)
525 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_F5); 536 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_PREVWINDOW_F5);
526 HandleCycleWindowLinear(CYCLE_BACKWARD); 537 HandleCycleWindowLinear(CYCLE_BACKWARD);
527 return true; 538 return true;
528 case CYCLE_FORWARD_LINEAR: 539 case CYCLE_FORWARD_LINEAR:
540 if (CommandLine::ForCurrentProcess()->HasSwitch(
541 switches::kAshEnableOverviewMode)) {
542 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_OVERVIEW_F5);
543 ToggleOverviewMode();
544 return true;
545 }
529 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1) 546 if (key_code == ui::VKEY_MEDIA_LAUNCH_APP1)
530 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_F5); 547 shell->delegate()->RecordUserMetricsAction(UMA_ACCEL_NEXTWINDOW_F5);
531 HandleCycleWindowLinear(CYCLE_FORWARD); 548 HandleCycleWindowLinear(CYCLE_FORWARD);
532 return true; 549 return true;
533 #if defined(OS_CHROMEOS) 550 #if defined(OS_CHROMEOS)
534 case ADD_REMOVE_DISPLAY: 551 case ADD_REMOVE_DISPLAY:
535 Shell::GetInstance()->display_manager()->AddRemoveDisplay(); 552 Shell::GetInstance()->display_manager()->AddRemoveDisplay();
536 return true; 553 return true;
537 case TOGGLE_MIRROR_MODE: 554 case TOGGLE_MIRROR_MODE:
538 Shell::GetInstance()->display_controller()->ToggleMirrorMode(); 555 Shell::GetInstance()->display_controller()->ToggleMirrorMode();
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 keyboard_brightness_control_delegate) { 985 keyboard_brightness_control_delegate) {
969 keyboard_brightness_control_delegate_ = 986 keyboard_brightness_control_delegate_ =
970 keyboard_brightness_control_delegate.Pass(); 987 keyboard_brightness_control_delegate.Pass();
971 } 988 }
972 989
973 bool AcceleratorController::CanHandleAccelerators() const { 990 bool AcceleratorController::CanHandleAccelerators() const {
974 return true; 991 return true;
975 } 992 }
976 993
977 } // namespace ash 994 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698