| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/maximize_mode/maximize_mode_controller.h" | 5 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/accelerometer/accelerometer_controller.h" | 9 #include "ash/accelerometer/accelerometer_controller.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/wm/maximize_mode/maximize_mode_event_blocker.h" | |
| 14 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" | 13 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 15 #include "base/auto_reset.h" | 14 #include "base/auto_reset.h" |
| 16 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 17 #include "ui/base/accelerators/accelerator.h" | 16 #include "ui/base/accelerators/accelerator.h" |
| 18 #include "ui/events/event.h" | 17 #include "ui/events/event.h" |
| 19 #include "ui/events/event_handler.h" | 18 #include "ui/events/event_handler.h" |
| 20 #include "ui/events/keycodes/keyboard_codes.h" | 19 #include "ui/events/keycodes/keyboard_codes.h" |
| 21 #include "ui/gfx/vector3d_f.h" | 20 #include "ui/gfx/vector3d_f.h" |
| 22 | 21 |
| 22 #if defined(USE_X11) |
| 23 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
| 24 #endif |
| 25 |
| 23 namespace ash { | 26 namespace ash { |
| 24 | 27 |
| 25 namespace { | 28 namespace { |
| 26 | 29 |
| 27 // The hinge angle at which to enter maximize mode. | 30 // The hinge angle at which to enter maximize mode. |
| 28 const float kEnterMaximizeModeAngle = 200.0f; | 31 const float kEnterMaximizeModeAngle = 200.0f; |
| 29 | 32 |
| 30 // The angle at which to exit maximize mode, this is specifically less than the | 33 // The angle at which to exit maximize mode, this is specifically less than the |
| 31 // angle to enter maximize mode to prevent rapid toggling when near the angle. | 34 // angle to enter maximize mode to prevent rapid toggling when near the angle. |
| 32 const float kExitMaximizeModeAngle = 160.0f; | 35 const float kExitMaximizeModeAngle = 160.0f; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 } | 309 } |
| 307 | 310 |
| 308 void MaximizeModeController::EnterMaximizeMode() { | 311 void MaximizeModeController::EnterMaximizeMode() { |
| 309 // TODO(jonross): Listen for display configuration changes. If the user | 312 // TODO(jonross): Listen for display configuration changes. If the user |
| 310 // causes a rotation change a rotation lock should be applied. | 313 // causes a rotation change a rotation lock should be applied. |
| 311 // https://crbug.com/369505 | 314 // https://crbug.com/369505 |
| 312 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 315 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 313 user_rotation_ = display_manager-> | 316 user_rotation_ = display_manager-> |
| 314 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation(); | 317 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation(); |
| 315 EnableMaximizeModeWindowManager(true); | 318 EnableMaximizeModeWindowManager(true); |
| 316 event_blocker_.reset(new MaximizeModeEventBlocker); | 319 #if defined(USE_X11) |
| 320 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); |
| 321 #endif |
| 317 #if defined(OS_CHROMEOS) | 322 #if defined(OS_CHROMEOS) |
| 318 event_handler_.reset(new ScreenshotActionHandler); | 323 event_handler_.reset(new ScreenshotActionHandler); |
| 319 #endif | 324 #endif |
| 320 } | 325 } |
| 321 | 326 |
| 322 void MaximizeModeController::LeaveMaximizeMode() { | 327 void MaximizeModeController::LeaveMaximizeMode() { |
| 323 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 328 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 324 DisplayInfo info = display_manager-> | 329 DisplayInfo info = display_manager-> |
| 325 GetDisplayInfo(gfx::Display::InternalDisplayId()); | 330 GetDisplayInfo(gfx::Display::InternalDisplayId()); |
| 326 gfx::Display::Rotation current_rotation = info.rotation(); | 331 gfx::Display::Rotation current_rotation = info.rotation(); |
| 327 if (current_rotation != user_rotation_) | 332 if (current_rotation != user_rotation_) |
| 328 SetDisplayRotation(display_manager, user_rotation_); | 333 SetDisplayRotation(display_manager, user_rotation_); |
| 329 rotation_locked_ = false; | 334 rotation_locked_ = false; |
| 330 EnableMaximizeModeWindowManager(false); | 335 EnableMaximizeModeWindowManager(false); |
| 331 event_blocker_.reset(); | 336 event_blocker_.reset(); |
| 332 event_handler_.reset(); | 337 event_handler_.reset(); |
| 333 } | 338 } |
| 334 | 339 |
| 335 } // namespace ash | 340 } // namespace ash |
| OLD | NEW |