Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: ash/wm/maximize_mode/maximize_mode_controller.cc

Issue 806693009: Port ScopedDisableInternalMouseAndKeyboardX11 to Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/auto_reset.h" 14 #include "base/auto_reset.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/time/default_tick_clock.h" 17 #include "base/time/default_tick_clock.h"
18 #include "base/time/tick_clock.h" 18 #include "base/time/tick_clock.h"
19 #include "ui/base/accelerators/accelerator.h" 19 #include "ui/base/accelerators/accelerator.h"
20 #include "ui/events/event.h" 20 #include "ui/events/event.h"
21 #include "ui/events/keycodes/keyboard_codes.h" 21 #include "ui/events/keycodes/keyboard_codes.h"
22 #include "ui/gfx/geometry/vector3d_f.h" 22 #include "ui/gfx/geometry/vector3d_f.h"
23 23
24 #if defined(USE_X11) 24 #if defined(USE_X11)
25 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" 25 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h"
26 #endif 26 #endif
27 27
28 #if defined(USE_OZONE)
29 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h"
30 #endif
31
28 #if defined(OS_CHROMEOS) 32 #if defined(OS_CHROMEOS)
29 #include "chromeos/dbus/dbus_thread_manager.h" 33 #include "chromeos/dbus/dbus_thread_manager.h"
30 #endif // OS_CHROMEOS 34 #endif // OS_CHROMEOS
31 35
32 namespace ash { 36 namespace ash {
33 37
34 namespace { 38 namespace {
35 39
36 // The hinge angle at which to enter maximize mode. 40 // The hinge angle at which to enter maximize mode.
37 const float kEnterMaximizeModeAngle = 200.0f; 41 const float kEnterMaximizeModeAngle = 200.0f;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } else if (!lid_open_past_180_ && !lid_is_closed_ && 334 } else if (!lid_open_past_180_ && !lid_is_closed_ &&
331 lid_angle >= kEnterMaximizeModeAngle && 335 lid_angle >= kEnterMaximizeModeAngle &&
332 (is_angle_stable || !WasLidOpenedRecently())) { 336 (is_angle_stable || !WasLidOpenedRecently())) {
333 lid_open_past_180_ = true; 337 lid_open_past_180_ = true;
334 if (!base::CommandLine::ForCurrentProcess()-> 338 if (!base::CommandLine::ForCurrentProcess()->
335 HasSwitch(switches::kAshEnableTouchViewTesting)) { 339 HasSwitch(switches::kAshEnableTouchViewTesting)) {
336 EnterMaximizeMode(); 340 EnterMaximizeMode();
337 } 341 }
338 #if defined(USE_X11) 342 #if defined(USE_X11)
339 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); 343 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11);
344 #elif defined(USE_OZONE)
345 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardOzone);
340 #endif 346 #endif
341 } 347 }
342 } 348 }
343 349
344 void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) { 350 void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) {
345 bool maximize_mode_engaged = IsMaximizeModeWindowManagerEnabled(); 351 bool maximize_mode_engaged = IsMaximizeModeWindowManagerEnabled();
346 352
347 // TODO(jonross): track the updated rotation angle even when locked. So that 353 // TODO(jonross): track the updated rotation angle even when locked. So that
348 // when rotation lock is removed the accelerometer rotation can be applied 354 // when rotation lock is removed the accelerometer rotation can be applied
349 // without waiting for the next update. 355 // without waiting for the next update.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 return elapsed_time <= kLidRecentlyOpenedDuration; 514 return elapsed_time <= kLidRecentlyOpenedDuration;
509 } 515 }
510 516
511 void MaximizeModeController::SetTickClockForTest( 517 void MaximizeModeController::SetTickClockForTest(
512 scoped_ptr<base::TickClock> tick_clock) { 518 scoped_ptr<base::TickClock> tick_clock) {
513 DCHECK(tick_clock_); 519 DCHECK(tick_clock_);
514 tick_clock_ = tick_clock.Pass(); 520 tick_clock_ = tick_clock.Pass();
515 } 521 }
516 522
517 } // namespace ash 523 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698