| 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 #include <utility> | 10 #include <utility> |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) | 908 for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) |
| 909 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); | 909 actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]); |
| 910 for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) | 910 for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) |
| 911 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); | 911 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); |
| 912 for (size_t i = 0; i < kPreferredActionsLength; ++i) | 912 for (size_t i = 0; i < kPreferredActionsLength; ++i) |
| 913 preferred_actions_.insert(kPreferredActions[i]); | 913 preferred_actions_.insert(kPreferredActions[i]); |
| 914 for (size_t i = 0; i < kReservedActionsLength; ++i) | 914 for (size_t i = 0; i < kReservedActionsLength; ++i) |
| 915 reserved_actions_.insert(kReservedActions[i]); | 915 reserved_actions_.insert(kReservedActions[i]); |
| 916 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) | 916 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) |
| 917 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); | 917 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); |
| 918 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) | 918 for (size_t i = 0; i < kActionsAllowedInAppModeOrPinnedModeLength; ++i) { |
| 919 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); | 919 actions_allowed_in_app_mode_.insert( |
| 920 kActionsAllowedInAppModeOrPinnedMode[i]); |
| 921 actions_allowed_in_pinned_mode_.insert( |
| 922 kActionsAllowedInAppModeOrPinnedMode[i]); |
| 923 } |
| 924 for (size_t i = 0; i < kActionsAllowedInPinnedModeLength; ++i) |
| 925 actions_allowed_in_pinned_mode_.insert(kActionsAllowedInPinnedMode[i]); |
| 920 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) | 926 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) |
| 921 actions_needing_window_.insert(kActionsNeedingWindow[i]); | 927 actions_needing_window_.insert(kActionsNeedingWindow[i]); |
| 922 for (size_t i = 0; i < kActionsKeepingMenuOpenLength; ++i) | 928 for (size_t i = 0; i < kActionsKeepingMenuOpenLength; ++i) |
| 923 actions_keeping_menu_open_.insert(kActionsKeepingMenuOpen[i]); | 929 actions_keeping_menu_open_.insert(kActionsKeepingMenuOpen[i]); |
| 924 | 930 |
| 925 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); | 931 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); |
| 926 | 932 |
| 927 RegisterDeprecatedAccelerators(); | 933 RegisterDeprecatedAccelerators(); |
| 928 | 934 |
| 929 if (debug::DebugAcceleratorsEnabled()) { | 935 if (debug::DebugAcceleratorsEnabled()) { |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 } | 1398 } |
| 1393 | 1399 |
| 1394 bool AcceleratorController::ShouldActionConsumeKeyEvent( | 1400 bool AcceleratorController::ShouldActionConsumeKeyEvent( |
| 1395 AcceleratorAction action) { | 1401 AcceleratorAction action) { |
| 1396 // Adding new exceptions is *STRONGLY* discouraged. | 1402 // Adding new exceptions is *STRONGLY* discouraged. |
| 1397 return true; | 1403 return true; |
| 1398 } | 1404 } |
| 1399 | 1405 |
| 1400 AcceleratorController::AcceleratorProcessingRestriction | 1406 AcceleratorController::AcceleratorProcessingRestriction |
| 1401 AcceleratorController::GetAcceleratorProcessingRestriction(int action) { | 1407 AcceleratorController::GetAcceleratorProcessingRestriction(int action) { |
| 1408 if (WmShell::Get()->IsPinned() && |
| 1409 actions_allowed_in_pinned_mode_.find(action) == |
| 1410 actions_allowed_in_pinned_mode_.end()) { |
| 1411 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1412 } |
| 1402 ash::Shell* shell = ash::Shell::GetInstance(); | 1413 ash::Shell* shell = ash::Shell::GetInstance(); |
| 1403 if (!shell->session_state_delegate()->IsActiveUserSessionStarted() && | 1414 if (!shell->session_state_delegate()->IsActiveUserSessionStarted() && |
| 1404 actions_allowed_at_login_screen_.find(action) == | 1415 actions_allowed_at_login_screen_.find(action) == |
| 1405 actions_allowed_at_login_screen_.end()) { | 1416 actions_allowed_at_login_screen_.end()) { |
| 1406 return RESTRICTION_PREVENT_PROCESSING; | 1417 return RESTRICTION_PREVENT_PROCESSING; |
| 1407 } | 1418 } |
| 1408 if (shell->session_state_delegate()->IsScreenLocked() && | 1419 if (shell->session_state_delegate()->IsScreenLocked() && |
| 1409 actions_allowed_at_lock_screen_.find(action) == | 1420 actions_allowed_at_lock_screen_.find(action) == |
| 1410 actions_allowed_at_lock_screen_.end()) { | 1421 actions_allowed_at_lock_screen_.end()) { |
| 1411 return RESTRICTION_PREVENT_PROCESSING; | 1422 return RESTRICTION_PREVENT_PROCESSING; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1434 } | 1445 } |
| 1435 | 1446 |
| 1436 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1447 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 1437 std::unique_ptr<KeyboardBrightnessControlDelegate> | 1448 std::unique_ptr<KeyboardBrightnessControlDelegate> |
| 1438 keyboard_brightness_control_delegate) { | 1449 keyboard_brightness_control_delegate) { |
| 1439 keyboard_brightness_control_delegate_ = | 1450 keyboard_brightness_control_delegate_ = |
| 1440 std::move(keyboard_brightness_control_delegate); | 1451 std::move(keyboard_brightness_control_delegate); |
| 1441 } | 1452 } |
| 1442 | 1453 |
| 1443 } // namespace ash | 1454 } // namespace ash |
| OLD | NEW |