| 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" |
| 14 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h" |
| 15 #include "base/auto_reset.h" | 15 #include "base/auto_reset.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| 18 #include "ui/base/accelerators/accelerator.h" | 18 #include "ui/base/accelerators/accelerator.h" |
| 19 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
| 20 #include "ui/events/event_handler.h" | 20 #include "ui/events/event_handler.h" |
| 21 #include "ui/events/keycodes/keyboard_codes.h" | 21 #include "ui/events/keycodes/keyboard_codes.h" |
| 22 #include "ui/gfx/vector3d_f.h" | 22 #include "ui/gfx/vector3d_f.h" |
| 23 | 23 |
| 24 #if defined(USE_X11) |
| 25 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
| 26 #endif |
| 27 |
| 24 namespace ash { | 28 namespace ash { |
| 25 | 29 |
| 26 namespace { | 30 namespace { |
| 27 | 31 |
| 28 // The hinge angle at which to enter maximize mode. | 32 // The hinge angle at which to enter maximize mode. |
| 29 const float kEnterMaximizeModeAngle = 200.0f; | 33 const float kEnterMaximizeModeAngle = 200.0f; |
| 30 | 34 |
| 31 // The angle at which to exit maximize mode, this is specifically less than the | 35 // The angle at which to exit maximize mode, this is specifically less than the |
| 32 // angle to enter maximize mode to prevent rapid toggling when near the angle. | 36 // angle to enter maximize mode to prevent rapid toggling when near the angle. |
| 33 const float kExitMaximizeModeAngle = 160.0f; | 37 const float kExitMaximizeModeAngle = 160.0f; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 current_rotation_ = rotation; | 347 current_rotation_ = rotation; |
| 344 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), | 348 display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(), |
| 345 rotation); | 349 rotation); |
| 346 } | 350 } |
| 347 | 351 |
| 348 void MaximizeModeController::EnterMaximizeMode() { | 352 void MaximizeModeController::EnterMaximizeMode() { |
| 349 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 353 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 350 current_rotation_ = user_rotation_ = display_manager-> | 354 current_rotation_ = user_rotation_ = display_manager-> |
| 351 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation(); | 355 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation(); |
| 352 EnableMaximizeModeWindowManager(true); | 356 EnableMaximizeModeWindowManager(true); |
| 353 event_blocker_.reset(new MaximizeModeEventBlocker); | 357 #if defined(USE_X11) |
| 358 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); |
| 359 #endif |
| 354 #if defined(OS_CHROMEOS) | 360 #if defined(OS_CHROMEOS) |
| 355 event_handler_.reset(new ScreenshotActionHandler); | 361 event_handler_.reset(new ScreenshotActionHandler); |
| 356 #endif | 362 #endif |
| 357 Shell::GetInstance()->display_controller()->AddObserver(this); | 363 Shell::GetInstance()->display_controller()->AddObserver(this); |
| 358 } | 364 } |
| 359 | 365 |
| 360 void MaximizeModeController::LeaveMaximizeMode() { | 366 void MaximizeModeController::LeaveMaximizeMode() { |
| 361 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 367 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 362 gfx::Display::Rotation current_rotation = display_manager-> | 368 gfx::Display::Rotation current_rotation = display_manager-> |
| 363 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation(); | 369 GetDisplayInfo(gfx::Display::InternalDisplayId()).rotation(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 total_non_touchview_time_; | 422 total_non_touchview_time_; |
| 417 if (total_runtime.InSeconds() > 0) { | 423 if (total_runtime.InSeconds() > 0) { |
| 418 UMA_HISTOGRAM_PERCENTAGE("Ash.TouchView.TouchViewActivePercentage", | 424 UMA_HISTOGRAM_PERCENTAGE("Ash.TouchView.TouchViewActivePercentage", |
| 419 100 * total_touchview_time_.InSeconds() / total_runtime.InSeconds()); | 425 100 * total_touchview_time_.InSeconds() / total_runtime.InSeconds()); |
| 420 } | 426 } |
| 421 } | 427 } |
| 422 Shell::GetInstance()->display_controller()->RemoveObserver(this); | 428 Shell::GetInstance()->display_controller()->RemoveObserver(this); |
| 423 } | 429 } |
| 424 | 430 |
| 425 } // namespace ash | 431 } // namespace ash |
| OLD | NEW |