| 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 27 matching lines...) Expand all Loading... |
| 38 #include "ash/common/wm/window_positioning_utils.h" | 38 #include "ash/common/wm/window_positioning_utils.h" |
| 39 #include "ash/common/wm/window_state.h" | 39 #include "ash/common/wm/window_state.h" |
| 40 #include "ash/common/wm/wm_event.h" | 40 #include "ash/common/wm/wm_event.h" |
| 41 #include "ash/common/wm_shell.h" | 41 #include "ash/common/wm_shell.h" |
| 42 #include "ash/common/wm_window.h" | 42 #include "ash/common/wm_window.h" |
| 43 #include "ash/resources/vector_icons/vector_icons.h" | 43 #include "ash/resources/vector_icons/vector_icons.h" |
| 44 #include "ash/root_window_controller.h" | 44 #include "ash/root_window_controller.h" |
| 45 #include "ash/rotator/window_rotation.h" | 45 #include "ash/rotator/window_rotation.h" |
| 46 #include "ash/shell.h" | 46 #include "ash/shell.h" |
| 47 #include "ash/strings/grit/ash_strings.h" | 47 #include "ash/strings/grit/ash_strings.h" |
| 48 #include "ash/wm/screen_pinning_controller.h" |
| 48 #include "ash/wm/window_util.h" | 49 #include "ash/wm/window_util.h" |
| 49 #include "base/metrics/histogram_macros.h" | 50 #include "base/metrics/histogram_macros.h" |
| 50 #include "base/metrics/user_metrics.h" | 51 #include "base/metrics/user_metrics.h" |
| 51 #include "base/strings/string_split.h" | 52 #include "base/strings/string_split.h" |
| 52 #include "base/strings/utf_string_conversions.h" | 53 #include "base/strings/utf_string_conversions.h" |
| 53 #include "chromeos/dbus/dbus_thread_manager.h" | 54 #include "chromeos/dbus/dbus_thread_manager.h" |
| 54 #include "chromeos/dbus/power_manager_client.h" | 55 #include "chromeos/dbus/power_manager_client.h" |
| 55 #include "ui/base/accelerators/accelerator.h" | 56 #include "ui/base/accelerators/accelerator.h" |
| 56 #include "ui/base/accelerators/accelerator_manager.h" | 57 #include "ui/base/accelerators/accelerator_manager.h" |
| 57 #include "ui/base/ime/chromeos/ime_keyboard.h" | 58 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 } | 1220 } |
| 1220 | 1221 |
| 1221 bool AcceleratorController::ShouldActionConsumeKeyEvent( | 1222 bool AcceleratorController::ShouldActionConsumeKeyEvent( |
| 1222 AcceleratorAction action) { | 1223 AcceleratorAction action) { |
| 1223 // Adding new exceptions is *STRONGLY* discouraged. | 1224 // Adding new exceptions is *STRONGLY* discouraged. |
| 1224 return true; | 1225 return true; |
| 1225 } | 1226 } |
| 1226 | 1227 |
| 1227 AcceleratorController::AcceleratorProcessingRestriction | 1228 AcceleratorController::AcceleratorProcessingRestriction |
| 1228 AcceleratorController::GetAcceleratorProcessingRestriction(int action) const { | 1229 AcceleratorController::GetAcceleratorProcessingRestriction(int action) const { |
| 1229 WmShell* wm_shell = WmShell::Get(); | 1230 if (Shell::Get()->screen_pinning_controller()->IsPinned() && |
| 1230 if (wm_shell->IsPinned() && | |
| 1231 actions_allowed_in_pinned_mode_.find(action) == | 1231 actions_allowed_in_pinned_mode_.find(action) == |
| 1232 actions_allowed_in_pinned_mode_.end()) { | 1232 actions_allowed_in_pinned_mode_.end()) { |
| 1233 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1233 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1234 } | 1234 } |
| 1235 if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted() && | 1235 if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted() && |
| 1236 actions_allowed_at_login_screen_.find(action) == | 1236 actions_allowed_at_login_screen_.find(action) == |
| 1237 actions_allowed_at_login_screen_.end()) { | 1237 actions_allowed_at_login_screen_.end()) { |
| 1238 return RESTRICTION_PREVENT_PROCESSING; | 1238 return RESTRICTION_PREVENT_PROCESSING; |
| 1239 } | 1239 } |
| 1240 if (Shell::Get()->session_controller()->IsScreenLocked() && | 1240 if (Shell::Get()->session_controller()->IsScreenLocked() && |
| 1241 actions_allowed_at_lock_screen_.find(action) == | 1241 actions_allowed_at_lock_screen_.find(action) == |
| 1242 actions_allowed_at_lock_screen_.end()) { | 1242 actions_allowed_at_lock_screen_.end()) { |
| 1243 return RESTRICTION_PREVENT_PROCESSING; | 1243 return RESTRICTION_PREVENT_PROCESSING; |
| 1244 } | 1244 } |
| 1245 if (Shell::Get()->shell_delegate()->IsRunningInForcedAppMode() && | 1245 if (Shell::Get()->shell_delegate()->IsRunningInForcedAppMode() && |
| 1246 actions_allowed_in_app_mode_.find(action) == | 1246 actions_allowed_in_app_mode_.find(action) == |
| 1247 actions_allowed_in_app_mode_.end()) { | 1247 actions_allowed_in_app_mode_.end()) { |
| 1248 return RESTRICTION_PREVENT_PROCESSING; | 1248 return RESTRICTION_PREVENT_PROCESSING; |
| 1249 } | 1249 } |
| 1250 if (wm_shell->IsSystemModalWindowOpen() && | 1250 if (WmShell::Get()->IsSystemModalWindowOpen() && |
| 1251 actions_allowed_at_modal_window_.find(action) == | 1251 actions_allowed_at_modal_window_.find(action) == |
| 1252 actions_allowed_at_modal_window_.end()) { | 1252 actions_allowed_at_modal_window_.end()) { |
| 1253 // Note we prevent the shortcut from propagating so it will not | 1253 // Note we prevent the shortcut from propagating so it will not |
| 1254 // be passed to the modal window. This is important for things like | 1254 // be passed to the modal window. This is important for things like |
| 1255 // Alt+Tab that would cause an undesired effect in the modal window by | 1255 // Alt+Tab that would cause an undesired effect in the modal window by |
| 1256 // cycling through its window elements. | 1256 // cycling through its window elements. |
| 1257 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; | 1257 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; |
| 1258 } | 1258 } |
| 1259 if (Shell::Get()->mru_window_tracker()->BuildMruWindowList().empty() && | 1259 if (Shell::Get()->mru_window_tracker()->BuildMruWindowList().empty() && |
| 1260 actions_needing_window_.find(action) != actions_needing_window_.end()) { | 1260 actions_needing_window_.find(action) != actions_needing_window_.end()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 data->uma_histogram_name, data->notification_message_id, | 1297 data->uma_histogram_name, data->notification_message_id, |
| 1298 data->old_shortcut_id, data->new_shortcut_id); | 1298 data->old_shortcut_id, data->new_shortcut_id); |
| 1299 | 1299 |
| 1300 if (!data->deprecated_enabled) | 1300 if (!data->deprecated_enabled) |
| 1301 return AcceleratorProcessingStatus::STOP; | 1301 return AcceleratorProcessingStatus::STOP; |
| 1302 | 1302 |
| 1303 return AcceleratorProcessingStatus::PROCEED; | 1303 return AcceleratorProcessingStatus::PROCEED; |
| 1304 } | 1304 } |
| 1305 | 1305 |
| 1306 } // namespace ash | 1306 } // namespace ash |
| OLD | NEW |