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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <iostream> | 9 #include <iostream> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "ash/accelerators/accelerator_table.h" | 12 #include "ash/accelerators/accelerator_table.h" |
13 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
14 #include "ash/caps_lock_delegate.h" | 14 #include "ash/caps_lock_delegate.h" |
15 #include "ash/desktop_background/desktop_background_controller.h" | 15 #include "ash/desktop_background/desktop_background_controller.h" |
16 #include "ash/desktop_background/user_wallpaper_delegate.h" | 16 #include "ash/desktop_background/user_wallpaper_delegate.h" |
17 #include "ash/display/display_controller.h" | 17 #include "ash/display/display_controller.h" |
18 #include "ash/display/display_manager.h" | 18 #include "ash/display/display_manager.h" |
19 #include "ash/focus_cycler.h" | 19 #include "ash/focus_cycler.h" |
20 #include "ash/ime_control_delegate.h" | 20 #include "ash/ime_control_delegate.h" |
21 #include "ash/launcher/launcher.h" | 21 #include "ash/launcher/launcher.h" |
22 #include "ash/launcher/launcher_delegate.h" | 22 #include "ash/launcher/launcher_delegate.h" |
23 #include "ash/launcher/launcher_model.h" | 23 #include "ash/launcher/launcher_model.h" |
24 #include "ash/magnifier/magnification_controller.h" | 24 #include "ash/magnifier/magnification_controller.h" |
25 #include "ash/magnifier/partial_magnification_controller.h" | 25 #include "ash/magnifier/partial_magnification_controller.h" |
26 #include "ash/root_window_controller.h" | 26 #include "ash/root_window_controller.h" |
27 #include "ash/rotator/screen_rotation.h" | 27 #include "ash/rotator/screen_rotation.h" |
28 #include "ash/screenshot_delegate.h" | 28 #include "ash/screenshot_delegate.h" |
29 #include "ash/session_state_delegate.h" | |
30 #include "ash/shelf/shelf_widget.h" | 29 #include "ash/shelf/shelf_widget.h" |
31 #include "ash/shell.h" | 30 #include "ash/shell.h" |
32 #include "ash/shell_delegate.h" | 31 #include "ash/shell_delegate.h" |
33 #include "ash/shell_window_ids.h" | 32 #include "ash/shell_window_ids.h" |
34 #include "ash/system/brightness/brightness_control_delegate.h" | 33 #include "ash/system/brightness/brightness_control_delegate.h" |
35 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 34 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
36 #include "ash/system/status_area_widget.h" | 35 #include "ash/system/status_area_widget.h" |
37 #include "ash/system/tray/system_tray.h" | 36 #include "ash/system/tray/system_tray.h" |
38 #include "ash/system/tray/system_tray_delegate.h" | 37 #include "ash/system/tray/system_tray_delegate.h" |
39 #include "ash/system/web_notification/web_notification_tray.h" | 38 #include "ash/system/web_notification/web_notification_tray.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return true; | 94 return true; |
96 } | 95 } |
97 | 96 |
98 void HandleCycleWindowLinear(CycleDirection direction) { | 97 void HandleCycleWindowLinear(CycleDirection direction) { |
99 Shell::GetInstance()-> | 98 Shell::GetInstance()-> |
100 window_cycle_controller()->HandleLinearCycleWindow(); | 99 window_cycle_controller()->HandleLinearCycleWindow(); |
101 } | 100 } |
102 | 101 |
103 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
104 bool HandleLock() { | 103 bool HandleLock() { |
105 Shell::GetInstance()->session_state_delegate()->LockScreen(); | 104 Shell::GetInstance()->delegate()->LockScreen(); |
106 return true; | 105 return true; |
107 } | 106 } |
108 | 107 |
109 bool HandleFileManager(bool as_dialog) { | 108 bool HandleFileManager(bool as_dialog) { |
110 Shell::GetInstance()->delegate()->OpenFileManager(as_dialog); | 109 Shell::GetInstance()->delegate()->OpenFileManager(as_dialog); |
111 return true; | 110 return true; |
112 } | 111 } |
113 | 112 |
114 bool HandleCrosh() { | 113 bool HandleCrosh() { |
115 Shell::GetInstance()->delegate()->OpenCrosh(); | 114 Shell::GetInstance()->delegate()->OpenCrosh(); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 accelerators_.find(remapped_accelerator); | 420 accelerators_.find(remapped_accelerator); |
422 if (iter == accelerators_.end()) | 421 if (iter == accelerators_.end()) |
423 return false; // not an accelerator. | 422 return false; // not an accelerator. |
424 | 423 |
425 return reserved_actions_.find(iter->second) != reserved_actions_.end(); | 424 return reserved_actions_.find(iter->second) != reserved_actions_.end(); |
426 } | 425 } |
427 | 426 |
428 bool AcceleratorController::PerformAction(int action, | 427 bool AcceleratorController::PerformAction(int action, |
429 const ui::Accelerator& accelerator) { | 428 const ui::Accelerator& accelerator) { |
430 ash::Shell* shell = ash::Shell::GetInstance(); | 429 ash::Shell* shell = ash::Shell::GetInstance(); |
431 if (!shell->session_state_delegate()->IsActiveUserSessionStarted() && | 430 bool at_login_screen = false; |
| 431 #if defined(OS_CHROMEOS) |
| 432 at_login_screen = !shell->delegate()->IsSessionStarted(); |
| 433 #endif |
| 434 if (at_login_screen && |
432 actions_allowed_at_login_screen_.find(action) == | 435 actions_allowed_at_login_screen_.find(action) == |
433 actions_allowed_at_login_screen_.end()) { | 436 actions_allowed_at_login_screen_.end()) { |
434 return false; | 437 return false; |
435 } | 438 } |
436 if (shell->session_state_delegate()->IsScreenLocked() && | 439 if (shell->IsScreenLocked() && |
437 actions_allowed_at_lock_screen_.find(action) == | 440 actions_allowed_at_lock_screen_.find(action) == |
438 actions_allowed_at_lock_screen_.end()) { | 441 actions_allowed_at_lock_screen_.end()) { |
439 return false; | 442 return false; |
440 } | 443 } |
441 if (shell->IsSystemModalWindowOpen() && | 444 if (shell->IsSystemModalWindowOpen() && |
442 actions_allowed_at_modal_window_.find(action) == | 445 actions_allowed_at_modal_window_.find(action) == |
443 actions_allowed_at_modal_window_.end()) { | 446 actions_allowed_at_modal_window_.end()) { |
444 // Note: we return true. This indicates the shortcut is handled | 447 // Note: we return true. This indicates the shortcut is handled |
445 // and will not be passed to the modal window. This is important | 448 // and will not be passed to the modal window. This is important |
446 // for things like Alt+Tab that would cause an undesired effect | 449 // for things like Alt+Tab that would cause an undesired effect |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 keyboard_brightness_control_delegate) { | 915 keyboard_brightness_control_delegate) { |
913 keyboard_brightness_control_delegate_ = | 916 keyboard_brightness_control_delegate_ = |
914 keyboard_brightness_control_delegate.Pass(); | 917 keyboard_brightness_control_delegate.Pass(); |
915 } | 918 } |
916 | 919 |
917 bool AcceleratorController::CanHandleAccelerators() const { | 920 bool AcceleratorController::CanHandleAccelerators() const { |
918 return true; | 921 return true; |
919 } | 922 } |
920 | 923 |
921 } // namespace ash | 924 } // namespace ash |
OLD | NEW |