| OLD | NEW |
| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_commands.h" | 9 #include "ash/accelerators/accelerator_commands.h" |
| 10 #include "ash/accelerators/accelerator_controller_delegate.h" | 10 #include "ash/accelerators/accelerator_controller_delegate.h" |
| 11 #include "ash/accelerators/debug_commands.h" | 11 #include "ash/accelerators/debug_commands.h" |
| 12 #include "ash/accessibility_delegate.h" | 12 #include "ash/accessibility_delegate.h" |
| 13 #include "ash/accessibility_types.h" | 13 #include "ash/accessibility_types.h" |
| 14 #include "ash/focus_cycler.h" | 14 #include "ash/focus_cycler.h" |
| 15 #include "ash/ime/ime_switch_type.h" | 15 #include "ash/ime/ime_switch_type.h" |
| 16 #include "ash/media_controller.h" | 16 #include "ash/media_controller.h" |
| 17 #include "ash/multi_profile_uma.h" | 17 #include "ash/multi_profile_uma.h" |
| 18 #include "ash/new_window_controller.h" | 18 #include "ash/new_window_controller.h" |
| 19 #include "ash/resources/vector_icons/vector_icons.h" | 19 #include "ash/resources/vector_icons/vector_icons.h" |
| 20 #include "ash/root_window_controller.h" | 20 #include "ash/root_window_controller.h" |
| 21 #include "ash/rotator/window_rotation.h" | 21 #include "ash/rotator/window_rotation.h" |
| 22 #include "ash/session/session_controller.h" | 22 #include "ash/session/session_controller.h" |
| 23 #include "ash/shelf/shelf.h" |
| 23 #include "ash/shelf/shelf_widget.h" | 24 #include "ash/shelf/shelf_widget.h" |
| 24 #include "ash/shelf/wm_shelf.h" | |
| 25 #include "ash/shell.h" | 25 #include "ash/shell.h" |
| 26 #include "ash/shell_delegate.h" | 26 #include "ash/shell_delegate.h" |
| 27 #include "ash/shell_port.h" | 27 #include "ash/shell_port.h" |
| 28 #include "ash/strings/grit/ash_strings.h" | 28 #include "ash/strings/grit/ash_strings.h" |
| 29 #include "ash/system/brightness_control_delegate.h" | 29 #include "ash/system/brightness_control_delegate.h" |
| 30 #include "ash/system/ime_menu/ime_menu_tray.h" | 30 #include "ash/system/ime_menu/ime_menu_tray.h" |
| 31 #include "ash/system/keyboard_brightness_control_delegate.h" | 31 #include "ash/system/keyboard_brightness_control_delegate.h" |
| 32 #include "ash/system/palette/palette_tray.h" | 32 #include "ash/system/palette/palette_tray.h" |
| 33 #include "ash/system/palette/palette_utils.h" | 33 #include "ash/system/palette/palette_utils.h" |
| 34 #include "ash/system/status_area_widget.h" | 34 #include "ash/system/status_area_widget.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); | 204 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); |
| 205 break; | 205 break; |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 Shell::Get()->focus_cycler()->RotateFocus(direction); | 208 Shell::Get()->focus_cycler()->RotateFocus(direction); |
| 209 } | 209 } |
| 210 | 210 |
| 211 void HandleFocusShelf() { | 211 void HandleFocusShelf() { |
| 212 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); | 212 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); |
| 213 // TODO(jamescook): Should this be GetRootWindowForNewWindows()? | 213 // TODO(jamescook): Should this be GetRootWindowForNewWindows()? |
| 214 WmShelf* shelf = WmShelf::ForWindow(Shell::GetPrimaryRootWindow()); | 214 Shelf* shelf = Shelf::ForWindow(Shell::GetPrimaryRootWindow()); |
| 215 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); | 215 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void HandleLaunchAppN(int n) { | 218 void HandleLaunchAppN(int n) { |
| 219 base::RecordAction(UserMetricsAction("Accel_Launch_App")); | 219 base::RecordAction(UserMetricsAction("Accel_Launch_App")); |
| 220 WmShelf::LaunchShelfItem(n); | 220 Shelf::LaunchShelfItem(n); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void HandleLaunchLastApp() { | 223 void HandleLaunchLastApp() { |
| 224 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); | 224 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); |
| 225 WmShelf::LaunchShelfItem(-1); | 225 Shelf::LaunchShelfItem(-1); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void HandleMediaNextTrack() { | 228 void HandleMediaNextTrack() { |
| 229 Shell::Get()->media_controller()->HandleMediaNextTrack(); | 229 Shell::Get()->media_controller()->HandleMediaNextTrack(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void HandleMediaPlayPause() { | 232 void HandleMediaPlayPause() { |
| 233 Shell::Get()->media_controller()->HandleMediaPlayPause(); | 233 Shell::Get()->media_controller()->HandleMediaPlayPause(); |
| 234 } | 234 } |
| 235 | 235 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 } | 325 } |
| 326 | 326 |
| 327 void HandleShowKeyboardOverlay() { | 327 void HandleShowKeyboardOverlay() { |
| 328 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); | 328 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); |
| 329 Shell::Get()->new_window_controller()->ShowKeyboardOverlay(); | 329 Shell::Get()->new_window_controller()->ShowKeyboardOverlay(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 bool CanHandleShowMessageCenterBubble() { | 332 bool CanHandleShowMessageCenterBubble() { |
| 333 aura::Window* target_root = Shell::GetRootWindowForNewWindows(); | 333 aura::Window* target_root = Shell::GetRootWindowForNewWindows(); |
| 334 StatusAreaWidget* status_area_widget = | 334 StatusAreaWidget* status_area_widget = |
| 335 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); | 335 Shelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 336 return status_area_widget && | 336 return status_area_widget && |
| 337 status_area_widget->web_notification_tray()->visible(); | 337 status_area_widget->web_notification_tray()->visible(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void HandleShowMessageCenterBubble() { | 340 void HandleShowMessageCenterBubble() { |
| 341 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); | 341 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); |
| 342 aura::Window* target_root = Shell::GetRootWindowForNewWindows(); | 342 aura::Window* target_root = Shell::GetRootWindowForNewWindows(); |
| 343 StatusAreaWidget* status_area_widget = | 343 StatusAreaWidget* status_area_widget = |
| 344 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); | 344 Shelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 345 if (status_area_widget) { | 345 if (status_area_widget) { |
| 346 WebNotificationTray* notification_tray = | 346 WebNotificationTray* notification_tray = |
| 347 status_area_widget->web_notification_tray(); | 347 status_area_widget->web_notification_tray(); |
| 348 if (notification_tray->visible()) | 348 if (notification_tray->visible()) |
| 349 notification_tray->ShowMessageCenterBubble(); | 349 notification_tray->ShowMessageCenterBubble(); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 void HandleShowSystemTrayBubble() { | 353 void HandleShowSystemTrayBubble() { |
| 354 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); | 354 base::RecordAction(UserMetricsAction("Accel_Show_System_Tray_Bubble")); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 void HandlePositionCenter() { | 458 void HandlePositionCenter() { |
| 459 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); | 459 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); |
| 460 wm::CenterWindow(WmWindow::Get(wm::GetActiveWindow())); | 460 wm::CenterWindow(WmWindow::Get(wm::GetActiveWindow())); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void HandleShowImeMenuBubble() { | 463 void HandleShowImeMenuBubble() { |
| 464 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); | 464 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); |
| 465 | 465 |
| 466 StatusAreaWidget* status_area_widget = | 466 StatusAreaWidget* status_area_widget = |
| 467 WmShelf::ForWindow(Shell::GetPrimaryRootWindow())->GetStatusAreaWidget(); | 467 Shelf::ForWindow(Shell::GetPrimaryRootWindow())->GetStatusAreaWidget(); |
| 468 if (status_area_widget) { | 468 if (status_area_widget) { |
| 469 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray(); | 469 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray(); |
| 470 if (ime_menu_tray && ime_menu_tray->visible() && | 470 if (ime_menu_tray && ime_menu_tray->visible() && |
| 471 !ime_menu_tray->IsImeMenuBubbleShown()) { | 471 !ime_menu_tray->IsImeMenuBubbleShown()) { |
| 472 ime_menu_tray->ShowImeMenuBubble(); | 472 ime_menu_tray->ShowImeMenuBubble(); |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 | 476 |
| 477 void HandleCrosh() { | 477 void HandleCrosh() { |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 data->uma_histogram_name, data->notification_message_id, | 1311 data->uma_histogram_name, data->notification_message_id, |
| 1312 data->old_shortcut_id, data->new_shortcut_id); | 1312 data->old_shortcut_id, data->new_shortcut_id); |
| 1313 | 1313 |
| 1314 if (!data->deprecated_enabled) | 1314 if (!data->deprecated_enabled) |
| 1315 return AcceleratorProcessingStatus::STOP; | 1315 return AcceleratorProcessingStatus::STOP; |
| 1316 | 1316 |
| 1317 return AcceleratorProcessingStatus::PROCEED; | 1317 return AcceleratorProcessingStatus::PROCEED; |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 } // namespace ash | 1320 } // namespace ash |
| OLD | NEW |