| 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/common/accelerators/accelerator_controller.h" | 5 #include "ash/common/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_commands.h" | 9 #include "ash/common/accelerators/accelerator_commands.h" |
| 10 #include "ash/common/accelerators/accelerator_controller_delegate.h" | 10 #include "ash/common/accelerators/accelerator_controller_delegate.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "ash/common/wm/mru_window_tracker.h" | 34 #include "ash/common/wm/mru_window_tracker.h" |
| 35 #include "ash/common/wm/overview/window_selector_controller.h" | 35 #include "ash/common/wm/overview/window_selector_controller.h" |
| 36 #include "ash/common/wm/window_cycle_controller.h" | 36 #include "ash/common/wm/window_cycle_controller.h" |
| 37 #include "ash/common/wm/window_positioning_utils.h" | 37 #include "ash/common/wm/window_positioning_utils.h" |
| 38 #include "ash/common/wm/window_state.h" | 38 #include "ash/common/wm/window_state.h" |
| 39 #include "ash/common/wm/wm_event.h" | 39 #include "ash/common/wm/wm_event.h" |
| 40 #include "ash/common/wm_shell.h" | 40 #include "ash/common/wm_shell.h" |
| 41 #include "ash/common/wm_window.h" | 41 #include "ash/common/wm_window.h" |
| 42 #include "ash/resources/vector_icons/vector_icons.h" | 42 #include "ash/resources/vector_icons/vector_icons.h" |
| 43 #include "ash/root_window_controller.h" | 43 #include "ash/root_window_controller.h" |
| 44 #include "ash/shell.h" |
| 44 #include "ash/strings/grit/ash_strings.h" | 45 #include "ash/strings/grit/ash_strings.h" |
| 45 #include "base/metrics/histogram_macros.h" | 46 #include "base/metrics/histogram_macros.h" |
| 46 #include "base/metrics/user_metrics.h" | 47 #include "base/metrics/user_metrics.h" |
| 47 #include "chromeos/dbus/dbus_thread_manager.h" | 48 #include "chromeos/dbus/dbus_thread_manager.h" |
| 48 #include "chromeos/dbus/power_manager_client.h" | 49 #include "chromeos/dbus/power_manager_client.h" |
| 49 #include "ui/base/accelerators/accelerator.h" | 50 #include "ui/base/accelerators/accelerator.h" |
| 50 #include "ui/base/accelerators/accelerator_manager.h" | 51 #include "ui/base/accelerators/accelerator_manager.h" |
| 51 #include "ui/base/ime/chromeos/ime_keyboard.h" | 52 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 52 #include "ui/base/ime/chromeos/input_method_manager.h" | 53 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 53 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 case FocusCycler::BACKWARD: { | 109 case FocusCycler::BACKWARD: { |
| 109 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); | 110 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); |
| 110 break; | 111 break; |
| 111 } | 112 } |
| 112 } | 113 } |
| 113 WmShell::Get()->focus_cycler()->RotateFocus(direction); | 114 WmShell::Get()->focus_cycler()->RotateFocus(direction); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void HandleFocusShelf() { | 117 void HandleFocusShelf() { |
| 117 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); | 118 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); |
| 118 // TODO(jamescook): Should this be GetRootWindowForNewWindows()? | 119 // TODO(jamescook): Should this be GetWmRootWindowForNewWindows()? |
| 119 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); | 120 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); |
| 120 WmShell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); | 121 WmShell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); |
| 121 } | 122 } |
| 122 | 123 |
| 123 void HandleLaunchAppN(int n) { | 124 void HandleLaunchAppN(int n) { |
| 124 base::RecordAction(UserMetricsAction("Accel_Launch_App")); | 125 base::RecordAction(UserMetricsAction("Accel_Launch_App")); |
| 125 WmShelf::LaunchShelfItem(n); | 126 WmShelf::LaunchShelfItem(n); |
| 126 } | 127 } |
| 127 | 128 |
| 128 void HandleLaunchLastApp() { | 129 void HandleLaunchLastApp() { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); | 205 base::RecordAction(UserMetricsAction("Accel_Restore_Tab")); |
| 205 WmShell::Get()->new_window_controller()->RestoreTab(); | 206 WmShell::Get()->new_window_controller()->RestoreTab(); |
| 206 } | 207 } |
| 207 | 208 |
| 208 void HandleShowKeyboardOverlay() { | 209 void HandleShowKeyboardOverlay() { |
| 209 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); | 210 base::RecordAction(UserMetricsAction("Accel_Show_Keyboard_Overlay")); |
| 210 WmShell::Get()->new_window_controller()->ShowKeyboardOverlay(); | 211 WmShell::Get()->new_window_controller()->ShowKeyboardOverlay(); |
| 211 } | 212 } |
| 212 | 213 |
| 213 bool CanHandleShowMessageCenterBubble() { | 214 bool CanHandleShowMessageCenterBubble() { |
| 214 WmWindow* target_root = WmShell::Get()->GetRootWindowForNewWindows(); | 215 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); |
| 215 StatusAreaWidget* status_area_widget = | 216 StatusAreaWidget* status_area_widget = |
| 216 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); | 217 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 217 return status_area_widget && | 218 return status_area_widget && |
| 218 status_area_widget->web_notification_tray()->visible(); | 219 status_area_widget->web_notification_tray()->visible(); |
| 219 } | 220 } |
| 220 | 221 |
| 221 void HandleShowMessageCenterBubble() { | 222 void HandleShowMessageCenterBubble() { |
| 222 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); | 223 base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); |
| 223 WmWindow* target_root = WmShell::Get()->GetRootWindowForNewWindows(); | 224 WmWindow* target_root = Shell::GetWmRootWindowForNewWindows(); |
| 224 StatusAreaWidget* status_area_widget = | 225 StatusAreaWidget* status_area_widget = |
| 225 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); | 226 WmShelf::ForWindow(target_root)->shelf_widget()->status_area_widget(); |
| 226 if (status_area_widget) { | 227 if (status_area_widget) { |
| 227 WebNotificationTray* notification_tray = | 228 WebNotificationTray* notification_tray = |
| 228 status_area_widget->web_notification_tray(); | 229 status_area_widget->web_notification_tray(); |
| 229 if (notification_tray->visible()) | 230 if (notification_tray->visible()) |
| 230 notification_tray->ShowMessageCenterBubble(); | 231 notification_tray->ShowMessageCenterBubble(); |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 | 388 |
| 388 void HandleLock() { | 389 void HandleLock() { |
| 389 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); | 390 base::RecordAction(UserMetricsAction("Accel_LockScreen_L")); |
| 390 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); | 391 WmShell::Get()->GetSessionStateDelegate()->LockScreen(); |
| 391 } | 392 } |
| 392 | 393 |
| 393 void HandleShowStylusTools() { | 394 void HandleShowStylusTools() { |
| 394 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); | 395 base::RecordAction(UserMetricsAction("Accel_Show_Stylus_Tools")); |
| 395 | 396 |
| 396 RootWindowController* root_window_controller = | 397 RootWindowController* root_window_controller = |
| 397 WmShell::Get()->GetRootWindowForNewWindows()->GetRootWindowController(); | 398 Shell::GetWmRootWindowForNewWindows()->GetRootWindowController(); |
| 398 PaletteTray* palette_tray = | 399 PaletteTray* palette_tray = |
| 399 root_window_controller->GetShelf()->GetStatusAreaWidget()->palette_tray(); | 400 root_window_controller->GetShelf()->GetStatusAreaWidget()->palette_tray(); |
| 400 palette_tray->ShowPalette(); | 401 palette_tray->ShowPalette(); |
| 401 } | 402 } |
| 402 | 403 |
| 403 bool CanHandleShowStylusTools() { | 404 bool CanHandleShowStylusTools() { |
| 404 return WmShell::Get()->palette_delegate() && | 405 return WmShell::Get()->palette_delegate() && |
| 405 WmShell::Get()->palette_delegate()->ShouldShowPalette(); | 406 WmShell::Get()->palette_delegate()->ShouldShowPalette(); |
| 406 } | 407 } |
| 407 | 408 |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 data->old_shortcut_id, data->new_shortcut_id); | 1165 data->old_shortcut_id, data->new_shortcut_id); |
| 1165 } | 1166 } |
| 1166 | 1167 |
| 1167 if (!data->deprecated_enabled) | 1168 if (!data->deprecated_enabled) |
| 1168 return AcceleratorProcessingStatus::STOP; | 1169 return AcceleratorProcessingStatus::STOP; |
| 1169 | 1170 |
| 1170 return AcceleratorProcessingStatus::PROCEED; | 1171 return AcceleratorProcessingStatus::PROCEED; |
| 1171 } | 1172 } |
| 1172 | 1173 |
| 1173 } // namespace ash | 1174 } // namespace ash |
| OLD | NEW |