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

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

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 7 years, 8 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/accelerators/nested_dispatcher_controller_unittest.cc » ('j') | ash/ash.gyp » ('J')
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>
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"
29 #include "ash/shelf/shelf_widget.h" 30 #include "ash/shelf/shelf_widget.h"
30 #include "ash/shell.h" 31 #include "ash/shell.h"
31 #include "ash/shell_delegate.h" 32 #include "ash/shell_delegate.h"
32 #include "ash/shell_window_ids.h" 33 #include "ash/shell_window_ids.h"
33 #include "ash/system/brightness/brightness_control_delegate.h" 34 #include "ash/system/brightness/brightness_control_delegate.h"
34 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" 35 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h"
35 #include "ash/system/status_area_widget.h" 36 #include "ash/system/status_area_widget.h"
36 #include "ash/system/tray/system_tray.h" 37 #include "ash/system/tray/system_tray.h"
37 #include "ash/system/tray/system_tray_delegate.h" 38 #include "ash/system/tray/system_tray_delegate.h"
38 #include "ash/system/web_notification/web_notification_tray.h" 39 #include "ash/system/web_notification/web_notification_tray.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 return true; 95 return true;
95 } 96 }
96 97
97 void HandleCycleWindowLinear(CycleDirection direction) { 98 void HandleCycleWindowLinear(CycleDirection direction) {
98 Shell::GetInstance()-> 99 Shell::GetInstance()->
99 window_cycle_controller()->HandleLinearCycleWindow(); 100 window_cycle_controller()->HandleLinearCycleWindow();
100 } 101 }
101 102
102 #if defined(OS_CHROMEOS) 103 #if defined(OS_CHROMEOS)
103 bool HandleLock() { 104 bool HandleLock() {
104 Shell::GetInstance()->delegate()->LockScreen(); 105 Shell::GetInstance()->session_state_delegate()->LockScreen();
105 return true; 106 return true;
106 } 107 }
107 108
108 bool HandleFileManager(bool as_dialog) { 109 bool HandleFileManager(bool as_dialog) {
109 Shell::GetInstance()->delegate()->OpenFileManager(as_dialog); 110 Shell::GetInstance()->delegate()->OpenFileManager(as_dialog);
110 return true; 111 return true;
111 } 112 }
112 113
113 bool HandleCrosh() { 114 bool HandleCrosh() {
114 Shell::GetInstance()->delegate()->OpenCrosh(); 115 Shell::GetInstance()->delegate()->OpenCrosh();
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 accelerators_.find(remapped_accelerator); 421 accelerators_.find(remapped_accelerator);
421 if (iter == accelerators_.end()) 422 if (iter == accelerators_.end())
422 return false; // not an accelerator. 423 return false; // not an accelerator.
423 424
424 return reserved_actions_.find(iter->second) != reserved_actions_.end(); 425 return reserved_actions_.find(iter->second) != reserved_actions_.end();
425 } 426 }
426 427
427 bool AcceleratorController::PerformAction(int action, 428 bool AcceleratorController::PerformAction(int action,
428 const ui::Accelerator& accelerator) { 429 const ui::Accelerator& accelerator) {
429 ash::Shell* shell = ash::Shell::GetInstance(); 430 ash::Shell* shell = ash::Shell::GetInstance();
430 bool at_login_screen = false; 431 if (!shell->session_state_delegate()->IsActiveUserSessionStarted() &&
431 #if defined(OS_CHROMEOS)
432 at_login_screen = !shell->delegate()->IsSessionStarted();
433 #endif
434 if (at_login_screen &&
435 actions_allowed_at_login_screen_.find(action) == 432 actions_allowed_at_login_screen_.find(action) ==
436 actions_allowed_at_login_screen_.end()) { 433 actions_allowed_at_login_screen_.end()) {
437 return false; 434 return false;
438 } 435 }
439 if (shell->IsScreenLocked() && 436 if (shell->session_state_delegate()->IsScreenLocked() &&
440 actions_allowed_at_lock_screen_.find(action) == 437 actions_allowed_at_lock_screen_.find(action) ==
441 actions_allowed_at_lock_screen_.end()) { 438 actions_allowed_at_lock_screen_.end()) {
442 return false; 439 return false;
443 } 440 }
444 if (shell->IsSystemModalWindowOpen() && 441 if (shell->IsSystemModalWindowOpen() &&
445 actions_allowed_at_modal_window_.find(action) == 442 actions_allowed_at_modal_window_.find(action) ==
446 actions_allowed_at_modal_window_.end()) { 443 actions_allowed_at_modal_window_.end()) {
447 // Note: we return true. This indicates the shortcut is handled 444 // Note: we return true. This indicates the shortcut is handled
448 // and will not be passed to the modal window. This is important 445 // and will not be passed to the modal window. This is important
449 // for things like Alt+Tab that would cause an undesired effect 446 // for things like Alt+Tab that would cause an undesired effect
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 keyboard_brightness_control_delegate) { 912 keyboard_brightness_control_delegate) {
916 keyboard_brightness_control_delegate_ = 913 keyboard_brightness_control_delegate_ =
917 keyboard_brightness_control_delegate.Pass(); 914 keyboard_brightness_control_delegate.Pass();
918 } 915 }
919 916
920 bool AcceleratorController::CanHandleAccelerators() const { 917 bool AcceleratorController::CanHandleAccelerators() const {
921 return true; 918 return true;
922 } 919 }
923 920
924 } // namespace ash 921 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/nested_dispatcher_controller_unittest.cc » ('j') | ash/ash.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698