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_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" | 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 "base/time/default_tick_clock.h" | 18 #include "base/time/default_tick_clock.h" |
19 #include "base/time/tick_clock.h" | 19 #include "base/time/tick_clock.h" |
20 #include "ui/base/accelerators/accelerator.h" | 20 #include "ui/base/accelerators/accelerator.h" |
21 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
22 #include "ui/events/keycodes/keyboard_codes.h" | 22 #include "ui/events/keycodes/keyboard_codes.h" |
23 #include "ui/gfx/geometry/vector3d_f.h" | 23 #include "ui/gfx/geometry/vector3d_f.h" |
24 | 24 |
25 #if defined(USE_X11) | 25 #if defined(USE_X11) |
26 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" | 26 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
27 #endif | 27 #endif |
28 | 28 |
| 29 #if defined(USE_OZONE) |
| 30 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.
h" |
| 31 #endif |
| 32 |
29 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
30 #include "chromeos/dbus/dbus_thread_manager.h" | 34 #include "chromeos/dbus/dbus_thread_manager.h" |
31 #endif // OS_CHROMEOS | 35 #endif // OS_CHROMEOS |
32 | 36 |
33 namespace ash { | 37 namespace ash { |
34 | 38 |
35 namespace { | 39 namespace { |
36 | 40 |
37 // The hinge angle at which to enter maximize mode. | 41 // The hinge angle at which to enter maximize mode. |
38 const float kEnterMaximizeModeAngle = 200.0f; | 42 const float kEnterMaximizeModeAngle = 200.0f; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } else if (!lid_open_past_180_ && !lid_is_closed_ && | 332 } else if (!lid_open_past_180_ && !lid_is_closed_ && |
329 lid_angle >= kEnterMaximizeModeAngle && | 333 lid_angle >= kEnterMaximizeModeAngle && |
330 (is_angle_stable || !WasLidOpenedRecently())) { | 334 (is_angle_stable || !WasLidOpenedRecently())) { |
331 lid_open_past_180_ = true; | 335 lid_open_past_180_ = true; |
332 if (!base::CommandLine::ForCurrentProcess()-> | 336 if (!base::CommandLine::ForCurrentProcess()-> |
333 HasSwitch(switches::kAshEnableTouchViewTesting)) { | 337 HasSwitch(switches::kAshEnableTouchViewTesting)) { |
334 EnterMaximizeMode(); | 338 EnterMaximizeMode(); |
335 } | 339 } |
336 #if defined(USE_X11) | 340 #if defined(USE_X11) |
337 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); | 341 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); |
| 342 #elif defined(USE_OZONE) |
| 343 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardOzone); |
338 #endif | 344 #endif |
339 } | 345 } |
340 } | 346 } |
341 | 347 |
342 void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) { | 348 void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) { |
343 bool maximize_mode_engaged = IsMaximizeModeWindowManagerEnabled(); | 349 bool maximize_mode_engaged = IsMaximizeModeWindowManagerEnabled(); |
344 | 350 |
345 // TODO(jonross): track the updated rotation angle even when locked. So that | 351 // TODO(jonross): track the updated rotation angle even when locked. So that |
346 // when rotation lock is removed the accelerometer rotation can be applied | 352 // when rotation lock is removed the accelerometer rotation can be applied |
347 // without waiting for the next update. | 353 // without waiting for the next update. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 return elapsed_time <= kLidRecentlyOpenedDuration; | 512 return elapsed_time <= kLidRecentlyOpenedDuration; |
507 } | 513 } |
508 | 514 |
509 void MaximizeModeController::SetTickClockForTest( | 515 void MaximizeModeController::SetTickClockForTest( |
510 scoped_ptr<base::TickClock> tick_clock) { | 516 scoped_ptr<base::TickClock> tick_clock) { |
511 DCHECK(tick_clock_); | 517 DCHECK(tick_clock_); |
512 tick_clock_ = tick_clock.Pass(); | 518 tick_clock_ = tick_clock.Pass(); |
513 } | 519 } |
514 | 520 |
515 } // namespace ash | 521 } // namespace ash |
OLD | NEW |