| 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/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" | 12 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" |
| 13 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h" | 13 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/time/default_tick_clock.h" | 16 #include "base/time/default_tick_clock.h" |
| 17 #include "base/time/tick_clock.h" | 17 #include "base/time/tick_clock.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/keycodes/keyboard_codes.h" | 20 #include "ui/events/keycodes/keyboard_codes.h" |
| 21 #include "ui/gfx/geometry/vector3d_f.h" | 21 #include "ui/gfx/geometry/vector3d_f.h" |
| 22 | 22 |
| 23 #if defined(USE_X11) | 23 #if defined(USE_X11) |
| 24 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" | 24 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 #if defined(USE_OZONE) |
| 28 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.
h" |
| 29 #endif |
| 30 |
| 27 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 28 #include "chromeos/dbus/dbus_thread_manager.h" | 32 #include "chromeos/dbus/dbus_thread_manager.h" |
| 29 #endif // OS_CHROMEOS | 33 #endif // OS_CHROMEOS |
| 30 | 34 |
| 31 namespace ash { | 35 namespace ash { |
| 32 | 36 |
| 33 namespace { | 37 namespace { |
| 34 | 38 |
| 35 // The hinge angle at which to enter maximize mode. | 39 // The hinge angle at which to enter maximize mode. |
| 36 const float kEnterMaximizeModeAngle = 200.0f; | 40 const float kEnterMaximizeModeAngle = 200.0f; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } else if (!lid_open_past_180_ && !lid_is_closed_ && | 223 } else if (!lid_open_past_180_ && !lid_is_closed_ && |
| 220 lid_angle >= kEnterMaximizeModeAngle && | 224 lid_angle >= kEnterMaximizeModeAngle && |
| 221 (is_angle_stable || !WasLidOpenedRecently())) { | 225 (is_angle_stable || !WasLidOpenedRecently())) { |
| 222 lid_open_past_180_ = true; | 226 lid_open_past_180_ = true; |
| 223 if (!base::CommandLine::ForCurrentProcess()-> | 227 if (!base::CommandLine::ForCurrentProcess()-> |
| 224 HasSwitch(switches::kAshEnableTouchViewTesting)) { | 228 HasSwitch(switches::kAshEnableTouchViewTesting)) { |
| 225 EnterMaximizeMode(); | 229 EnterMaximizeMode(); |
| 226 } | 230 } |
| 227 #if defined(USE_X11) | 231 #if defined(USE_X11) |
| 228 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); | 232 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); |
| 233 #elif defined(USE_OZONE) |
| 234 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardOzone); |
| 229 #endif | 235 #endif |
| 230 } | 236 } |
| 231 } | 237 } |
| 232 | 238 |
| 233 void MaximizeModeController::EnterMaximizeMode() { | 239 void MaximizeModeController::EnterMaximizeMode() { |
| 234 if (IsMaximizeModeWindowManagerEnabled()) | 240 if (IsMaximizeModeWindowManagerEnabled()) |
| 235 return; | 241 return; |
| 236 EnableMaximizeModeWindowManager(true); | 242 EnableMaximizeModeWindowManager(true); |
| 237 } | 243 } |
| 238 | 244 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 return elapsed_time <= kLidRecentlyOpenedDuration; | 302 return elapsed_time <= kLidRecentlyOpenedDuration; |
| 297 } | 303 } |
| 298 | 304 |
| 299 void MaximizeModeController::SetTickClockForTest( | 305 void MaximizeModeController::SetTickClockForTest( |
| 300 scoped_ptr<base::TickClock> tick_clock) { | 306 scoped_ptr<base::TickClock> tick_clock) { |
| 301 DCHECK(tick_clock_); | 307 DCHECK(tick_clock_); |
| 302 tick_clock_ = tick_clock.Pass(); | 308 tick_clock_ = tick_clock.Pass(); |
| 303 } | 309 } |
| 304 | 310 |
| 305 } // namespace ash | 311 } // namespace ash |
| OLD | NEW |