| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #include "base/strings/string_split.h" | 62 #include "base/strings/string_split.h" |
| 63 #include "base/strings/utf_string_conversions.h" | 63 #include "base/strings/utf_string_conversions.h" |
| 64 #include "ui/aura/env.h" | 64 #include "ui/aura/env.h" |
| 65 #include "ui/base/accelerators/accelerator.h" | 65 #include "ui/base/accelerators/accelerator.h" |
| 66 #include "ui/base/accelerators/accelerator_manager.h" | 66 #include "ui/base/accelerators/accelerator_manager.h" |
| 67 #include "ui/base/l10n/l10n_util.h" | 67 #include "ui/base/l10n/l10n_util.h" |
| 68 #include "ui/base/resource/resource_bundle.h" | 68 #include "ui/base/resource/resource_bundle.h" |
| 69 #include "ui/compositor/layer.h" | 69 #include "ui/compositor/layer.h" |
| 70 #include "ui/compositor/layer_animation_sequence.h" | 70 #include "ui/compositor/layer_animation_sequence.h" |
| 71 #include "ui/compositor/layer_animator.h" | 71 #include "ui/compositor/layer_animator.h" |
| 72 #include "ui/display/screen.h" |
| 72 #include "ui/events/event.h" | 73 #include "ui/events/event.h" |
| 73 #include "ui/events/keycodes/keyboard_codes.h" | 74 #include "ui/events/keycodes/keyboard_codes.h" |
| 74 #include "ui/gfx/screen.h" | |
| 75 #include "ui/message_center/message_center.h" | 75 #include "ui/message_center/message_center.h" |
| 76 #include "ui/message_center/notification.h" | 76 #include "ui/message_center/notification.h" |
| 77 #include "ui/message_center/notifier_settings.h" | 77 #include "ui/message_center/notifier_settings.h" |
| 78 | 78 |
| 79 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
| 80 #include "ash/display/display_configuration_controller.h" | 80 #include "ash/display/display_configuration_controller.h" |
| 81 #include "ash/system/chromeos/keyboard_brightness_controller.h" | 81 #include "ash/system/chromeos/keyboard_brightness_controller.h" |
| 82 #include "base/sys_info.h" | 82 #include "base/sys_info.h" |
| 83 #include "ui/base/ime/chromeos/ime_keyboard.h" | 83 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 84 #include "ui/base/ime/chromeos/input_method_manager.h" | 84 #include "ui/base/ime/chromeos/input_method_manager.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 if (accelerator.type() == ui::ET_KEY_PRESSED) | 352 if (accelerator.type() == ui::ET_KEY_PRESSED) |
| 353 ime_control_delegate->HandlePreviousIme(); | 353 ime_control_delegate->HandlePreviousIme(); |
| 354 // Else: consume the Ctrl+Space ET_KEY_RELEASED event but do not do anything. | 354 // Else: consume the Ctrl+Space ET_KEY_RELEASED event but do not do anything. |
| 355 } | 355 } |
| 356 | 356 |
| 357 void HandleRestoreTab() { | 357 void HandleRestoreTab() { |
| 358 base::RecordAction(base::UserMetricsAction("Accel_Restore_Tab")); | 358 base::RecordAction(base::UserMetricsAction("Accel_Restore_Tab")); |
| 359 Shell::GetInstance()->new_window_delegate()->RestoreTab(); | 359 Shell::GetInstance()->new_window_delegate()->RestoreTab(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 gfx::Display::Rotation GetNextRotation(gfx::Display::Rotation current) { | 362 display::Display::Rotation GetNextRotation(display::Display::Rotation current) { |
| 363 switch (current) { | 363 switch (current) { |
| 364 case gfx::Display::ROTATE_0: | 364 case display::Display::ROTATE_0: |
| 365 return gfx::Display::ROTATE_90; | 365 return display::Display::ROTATE_90; |
| 366 case gfx::Display::ROTATE_90: | 366 case display::Display::ROTATE_90: |
| 367 return gfx::Display::ROTATE_180; | 367 return display::Display::ROTATE_180; |
| 368 case gfx::Display::ROTATE_180: | 368 case display::Display::ROTATE_180: |
| 369 return gfx::Display::ROTATE_270; | 369 return display::Display::ROTATE_270; |
| 370 case gfx::Display::ROTATE_270: | 370 case display::Display::ROTATE_270: |
| 371 return gfx::Display::ROTATE_0; | 371 return display::Display::ROTATE_0; |
| 372 } | 372 } |
| 373 NOTREACHED() << "Unknown rotation:" << current; | 373 NOTREACHED() << "Unknown rotation:" << current; |
| 374 return gfx::Display::ROTATE_0; | 374 return display::Display::ROTATE_0; |
| 375 } | 375 } |
| 376 | 376 |
| 377 // Rotates the screen. | 377 // Rotates the screen. |
| 378 void HandleRotateScreen() { | 378 void HandleRotateScreen() { |
| 379 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) | 379 if (Shell::GetInstance()->display_manager()->IsInUnifiedMode()) |
| 380 return; | 380 return; |
| 381 | 381 |
| 382 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); | 382 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); |
| 383 gfx::Point point = gfx::Screen::GetScreen()->GetCursorScreenPoint(); | 383 gfx::Point point = display::Screen::GetScreen()->GetCursorScreenPoint(); |
| 384 gfx::Display display = | 384 display::Display display = |
| 385 gfx::Screen::GetScreen()->GetDisplayNearestPoint(point); | 385 display::Screen::GetScreen()->GetDisplayNearestPoint(point); |
| 386 const DisplayInfo& display_info = | 386 const DisplayInfo& display_info = |
| 387 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); | 387 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); |
| 388 ash::ScreenRotationAnimator(display.id()) | 388 ash::ScreenRotationAnimator(display.id()) |
| 389 .Rotate(GetNextRotation(display_info.GetActiveRotation()), | 389 .Rotate(GetNextRotation(display_info.GetActiveRotation()), |
| 390 gfx::Display::ROTATION_SOURCE_USER); | 390 display::Display::ROTATION_SOURCE_USER); |
| 391 } | 391 } |
| 392 | 392 |
| 393 // Rotate the active window. | 393 // Rotate the active window. |
| 394 void HandleRotateActiveWindow() { | 394 void HandleRotateActiveWindow() { |
| 395 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); | 395 base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); |
| 396 aura::Window* active_window = wm::GetActiveWindow(); | 396 aura::Window* active_window = wm::GetActiveWindow(); |
| 397 if (active_window) { | 397 if (active_window) { |
| 398 // The rotation animation bases its target transform on the current | 398 // The rotation animation bases its target transform on the current |
| 399 // rotation and position. Since there could be an animation in progress | 399 // rotation and position. Since there could be an animation in progress |
| 400 // right now, queue this animation so when it starts it picks up a neutral | 400 // right now, queue this animation so when it starts it picks up a neutral |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 case SWITCH_TO_NEXT_USER: | 1053 case SWITCH_TO_NEXT_USER: |
| 1054 return CanHandleCycleUser(); | 1054 return CanHandleCycleUser(); |
| 1055 case TOGGLE_CAPS_LOCK: | 1055 case TOGGLE_CAPS_LOCK: |
| 1056 return CanHandleToggleCapsLock(accelerator, previous_accelerator); | 1056 return CanHandleToggleCapsLock(accelerator, previous_accelerator); |
| 1057 case TOGGLE_TOUCH_VIEW_TESTING: | 1057 case TOGGLE_TOUCH_VIEW_TESTING: |
| 1058 return CanHandleToggleTouchViewTesting(); | 1058 return CanHandleToggleTouchViewTesting(); |
| 1059 case TOUCH_HUD_CLEAR: | 1059 case TOUCH_HUD_CLEAR: |
| 1060 case TOUCH_HUD_MODE_CHANGE: | 1060 case TOUCH_HUD_MODE_CHANGE: |
| 1061 return CanHandleTouchHud(); | 1061 return CanHandleTouchHud(); |
| 1062 case SWAP_PRIMARY_DISPLAY: | 1062 case SWAP_PRIMARY_DISPLAY: |
| 1063 return gfx::Screen::GetScreen()->GetNumDisplays() > 1; | 1063 return display::Screen::GetScreen()->GetNumDisplays() > 1; |
| 1064 #endif | 1064 #endif |
| 1065 case CYCLE_BACKWARD_MRU: | 1065 case CYCLE_BACKWARD_MRU: |
| 1066 case CYCLE_FORWARD_MRU: | 1066 case CYCLE_FORWARD_MRU: |
| 1067 case EXIT: | 1067 case EXIT: |
| 1068 case FOCUS_NEXT_PANE: | 1068 case FOCUS_NEXT_PANE: |
| 1069 case FOCUS_PREVIOUS_PANE: | 1069 case FOCUS_PREVIOUS_PANE: |
| 1070 case FOCUS_SHELF: | 1070 case FOCUS_SHELF: |
| 1071 case LAUNCH_APP_0: | 1071 case LAUNCH_APP_0: |
| 1072 case LAUNCH_APP_1: | 1072 case LAUNCH_APP_1: |
| 1073 case LAUNCH_APP_2: | 1073 case LAUNCH_APP_2: |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 } | 1443 } |
| 1444 | 1444 |
| 1445 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1445 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 1446 std::unique_ptr<KeyboardBrightnessControlDelegate> | 1446 std::unique_ptr<KeyboardBrightnessControlDelegate> |
| 1447 keyboard_brightness_control_delegate) { | 1447 keyboard_brightness_control_delegate) { |
| 1448 keyboard_brightness_control_delegate_ = | 1448 keyboard_brightness_control_delegate_ = |
| 1449 std::move(keyboard_brightness_control_delegate); | 1449 std::move(keyboard_brightness_control_delegate); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 } // namespace ash | 1452 } // namespace ash |
| OLD | NEW |