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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return false; // not an accelerator. | 363 return false; // not an accelerator. |
364 | 364 |
365 return reserved_actions_.find(iter->second) != reserved_actions_.end(); | 365 return reserved_actions_.find(iter->second) != reserved_actions_.end(); |
366 } | 366 } |
367 | 367 |
368 bool AcceleratorController::PerformAction(int action, | 368 bool AcceleratorController::PerformAction(int action, |
369 const ui::Accelerator& accelerator) { | 369 const ui::Accelerator& accelerator) { |
370 ash::Shell* shell = ash::Shell::GetInstance(); | 370 ash::Shell* shell = ash::Shell::GetInstance(); |
371 bool at_login_screen = false; | 371 bool at_login_screen = false; |
372 #if defined(OS_CHROMEOS) | 372 #if defined(OS_CHROMEOS) |
373 at_login_screen = (shell->delegate() && !shell->delegate()->IsUserLoggedIn()); | 373 at_login_screen = shell->delegate() && !shell->delegate()->IsSessionStarted(); |
374 #endif | 374 #endif |
375 bool at_lock_screen = shell->IsScreenLocked(); | 375 bool at_lock_screen = shell->IsScreenLocked(); |
376 | 376 |
377 if (at_login_screen && | 377 if (at_login_screen && |
378 actions_allowed_at_login_screen_.find(action) == | 378 actions_allowed_at_login_screen_.find(action) == |
379 actions_allowed_at_login_screen_.end()) { | 379 actions_allowed_at_login_screen_.end()) { |
380 return false; | 380 return false; |
381 } | 381 } |
382 if (at_lock_screen && | 382 if (at_lock_screen && |
383 actions_allowed_at_lock_screen_.find(action) == | 383 actions_allowed_at_lock_screen_.find(action) == |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 accelerators_.insert( | 751 accelerators_.insert( |
752 std::make_pair(accelerator, accelerators[i].action)); | 752 std::make_pair(accelerator, accelerators[i].action)); |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 bool AcceleratorController::CanHandleAccelerators() const { | 756 bool AcceleratorController::CanHandleAccelerators() const { |
757 return true; | 757 return true; |
758 } | 758 } |
759 | 759 |
760 } // namespace ash | 760 } // namespace ash |
OLD | NEW |