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

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

Issue 181563004: Remove --ash-disable-overview-mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore chromeactions.txt Created 6 years, 9 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
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "ash/system/tray/system_tray.h" 42 #include "ash/system/tray/system_tray.h"
43 #include "ash/system/tray/system_tray_delegate.h" 43 #include "ash/system/tray/system_tray_delegate.h"
44 #include "ash/system/tray/system_tray_notifier.h" 44 #include "ash/system/tray/system_tray_notifier.h"
45 #include "ash/system/web_notification/web_notification_tray.h" 45 #include "ash/system/web_notification/web_notification_tray.h"
46 #include "ash/touch/touch_hud_debug.h" 46 #include "ash/touch/touch_hud_debug.h"
47 #include "ash/volume_control_delegate.h" 47 #include "ash/volume_control_delegate.h"
48 #include "ash/wm/mru_window_tracker.h" 48 #include "ash/wm/mru_window_tracker.h"
49 #include "ash/wm/overview/window_selector_controller.h" 49 #include "ash/wm/overview/window_selector_controller.h"
50 #include "ash/wm/partial_screenshot_view.h" 50 #include "ash/wm/partial_screenshot_view.h"
51 #include "ash/wm/power_button_controller.h" 51 #include "ash/wm/power_button_controller.h"
52 #include "ash/wm/window_cycle_controller.h"
53 #include "ash/wm/window_state.h" 52 #include "ash/wm/window_state.h"
54 #include "ash/wm/window_util.h" 53 #include "ash/wm/window_util.h"
55 #include "base/bind.h" 54 #include "base/bind.h"
56 #include "base/command_line.h" 55 #include "base/command_line.h"
57 #include "base/metrics/user_metrics.h" 56 #include "base/metrics/user_metrics.h"
58 #include "ui/aura/env.h" 57 #include "ui/aura/env.h"
59 #include "ui/aura/window_event_dispatcher.h" 58 #include "ui/aura/window_event_dispatcher.h"
60 #include "ui/base/accelerators/accelerator.h" 59 #include "ui/base/accelerators/accelerator.h"
61 #include "ui/base/accelerators/accelerator_manager.h" 60 #include "ui/base/accelerators/accelerator_manager.h"
62 #include "ui/compositor/debug_utils.h" 61 #include "ui/compositor/debug_utils.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 focus_manager->AdvanceFocus(reverse); 120 focus_manager->AdvanceFocus(reverse);
122 return true; 121 return true;
123 } 122 }
124 123
125 bool HandleCycleBackwardMRU(const ui::Accelerator& accelerator) { 124 bool HandleCycleBackwardMRU(const ui::Accelerator& accelerator) {
126 Shell* shell = Shell::GetInstance(); 125 Shell* shell = Shell::GetInstance();
127 126
128 if (accelerator.key_code() == ui::VKEY_TAB) 127 if (accelerator.key_code() == ui::VKEY_TAB)
129 base::RecordAction(base::UserMetricsAction("Accel_PrevWindow_Tab")); 128 base::RecordAction(base::UserMetricsAction("Accel_PrevWindow_Tab"));
130 129
131 if (switches::UseOverviewMode()) { 130 shell->window_selector_controller()->HandleCycleWindow(
oshima 2014/02/27 23:36:10 nit: can you just do Shell::GetInstance()->...
flackr 2014/02/28 15:37:34 Done.
132 shell->window_selector_controller()->HandleCycleWindow( 131 WindowSelector::BACKWARD);
133 WindowSelector::BACKWARD);
134 return true;
135 }
136 shell->window_cycle_controller()->HandleCycleWindow(
137 WindowCycleController::BACKWARD, accelerator.IsAltDown());
138 return true; 132 return true;
139 } 133 }
140 134
141 bool HandleCycleForwardMRU(const ui::Accelerator& accelerator) { 135 bool HandleCycleForwardMRU(const ui::Accelerator& accelerator) {
142 Shell* shell = Shell::GetInstance(); 136 Shell* shell = Shell::GetInstance();
143 137
144 if (accelerator.key_code() == ui::VKEY_TAB) 138 if (accelerator.key_code() == ui::VKEY_TAB)
145 base::RecordAction(base::UserMetricsAction("Accel_NextWindow_Tab")); 139 base::RecordAction(base::UserMetricsAction("Accel_NextWindow_Tab"));
146 140
147 if (switches::UseOverviewMode()) { 141 shell->window_selector_controller()->HandleCycleWindow(
148 shell->window_selector_controller()->HandleCycleWindow( 142 WindowSelector::FORWARD);
149 WindowSelector::FORWARD);
150 return true;
151 }
152 shell->window_cycle_controller()->HandleCycleWindow(
153 WindowCycleController::FORWARD, accelerator.IsAltDown());
154 return true; 143 return true;
155 } 144 }
156 145
157 bool HandleCycleLinear(const ui::Accelerator& accelerator) { 146 bool ToggleOverview(const ui::Accelerator& accelerator) {
158 Shell* shell = Shell::GetInstance(); 147 Shell* shell = Shell::GetInstance();
159 148
160 // TODO(jamescook): When overview becomes the default the AcceleratorAction 149 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5"));
161 // should be renamed from CYCLE_LINEAR to TOGGLE_OVERVIEW. 150 shell->window_selector_controller()->ToggleOverview();
162 if (switches::UseOverviewMode()) {
163 base::RecordAction(base::UserMetricsAction("Accel_Overview_F5"));
164 shell->window_selector_controller()->ToggleOverview();
165 return true;
166 }
167 if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP1)
168 base::RecordAction(base::UserMetricsAction("Accel_NextWindow_F5"));
169 shell->window_cycle_controller()->HandleLinearCycleWindow();
170 return true; 151 return true;
171 } 152 }
172 153
173 bool HandleDisableCapsLock(ui::KeyboardCode key_code, 154 bool HandleDisableCapsLock(ui::KeyboardCode key_code,
174 ui::EventType previous_event_type, 155 ui::EventType previous_event_type,
175 ui::KeyboardCode previous_key_code) { 156 ui::KeyboardCode previous_key_code) {
176 Shell* shell = Shell::GetInstance(); 157 Shell* shell = Shell::GetInstance();
177 158
178 if (previous_event_type == ui::ET_KEY_RELEASED || 159 if (previous_event_type == ui::ET_KEY_RELEASED ||
179 (previous_key_code != ui::VKEY_LSHIFT && 160 (previous_key_code != ui::VKEY_LSHIFT &&
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 // below) or pull it into a HandleFoo() function above. 910 // below) or pull it into a HandleFoo() function above.
930 switch (action) { 911 switch (action) {
931 case ACCESSIBLE_FOCUS_NEXT: 912 case ACCESSIBLE_FOCUS_NEXT:
932 return HandleAccessibleFocusCycle(false); 913 return HandleAccessibleFocusCycle(false);
933 case ACCESSIBLE_FOCUS_PREVIOUS: 914 case ACCESSIBLE_FOCUS_PREVIOUS:
934 return HandleAccessibleFocusCycle(true); 915 return HandleAccessibleFocusCycle(true);
935 case CYCLE_BACKWARD_MRU: 916 case CYCLE_BACKWARD_MRU:
936 return HandleCycleBackwardMRU(accelerator); 917 return HandleCycleBackwardMRU(accelerator);
937 case CYCLE_FORWARD_MRU: 918 case CYCLE_FORWARD_MRU:
938 return HandleCycleForwardMRU(accelerator); 919 return HandleCycleForwardMRU(accelerator);
939 case CYCLE_LINEAR: 920 case TOGGLE_OVERVIEW:
940 return HandleCycleLinear(accelerator); 921 return ToggleOverview(accelerator);
941 #if defined(OS_CHROMEOS) 922 #if defined(OS_CHROMEOS)
942 case ADD_REMOVE_DISPLAY: 923 case ADD_REMOVE_DISPLAY:
943 return HandleAddRemoveDisplay(); 924 return HandleAddRemoveDisplay();
944 case TOGGLE_MIRROR_MODE: 925 case TOGGLE_MIRROR_MODE:
945 return HandleToggleMirrorMode(); 926 return HandleToggleMirrorMode();
946 case LOCK_SCREEN: 927 case LOCK_SCREEN:
947 return HandleLock(key_code); 928 return HandleLock(key_code);
948 case OPEN_FILE_MANAGER: 929 case OPEN_FILE_MANAGER:
949 return HandleFileManager(); 930 return HandleFileManager();
950 case OPEN_CROSH: 931 case OPEN_CROSH:
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 keyboard_brightness_control_delegate) { 1189 keyboard_brightness_control_delegate) {
1209 keyboard_brightness_control_delegate_ = 1190 keyboard_brightness_control_delegate_ =
1210 keyboard_brightness_control_delegate.Pass(); 1191 keyboard_brightness_control_delegate.Pass();
1211 } 1192 }
1212 1193
1213 bool AcceleratorController::CanHandleAccelerators() const { 1194 bool AcceleratorController::CanHandleAccelerators() const {
1214 return true; 1195 return true;
1215 } 1196 }
1216 1197
1217 } // namespace ash 1198 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698