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" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 event_blocker_.reset(); | 295 event_blocker_.reset(); |
296 } else if (!lid_open_past_180_ && !lid_is_closed_ && | 296 } else if (!lid_open_past_180_ && !lid_is_closed_ && |
297 lid_angle >= kEnterMaximizeModeAngle && | 297 lid_angle >= kEnterMaximizeModeAngle && |
298 (is_angle_stable || !WasLidOpenedRecently())) { | 298 (is_angle_stable || !WasLidOpenedRecently())) { |
299 lid_open_past_180_ = true; | 299 lid_open_past_180_ = true; |
300 if (!base::CommandLine::ForCurrentProcess()-> | 300 if (!base::CommandLine::ForCurrentProcess()-> |
301 HasSwitch(switches::kAshEnableTouchViewTesting)) { | 301 HasSwitch(switches::kAshEnableTouchViewTesting)) { |
302 EnterMaximizeMode(); | 302 EnterMaximizeMode(); |
303 } | 303 } |
| 304 // Always reset first to avoid creation before destruction of a previous |
| 305 // object. |
| 306 event_blocker_.reset(); |
304 #if defined(USE_X11) | 307 #if defined(USE_X11) |
305 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); | 308 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); |
306 #elif defined(USE_OZONE) | 309 #elif defined(USE_OZONE) |
307 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardOzone); | 310 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardOzone); |
308 #endif | 311 #endif |
309 } | 312 } |
310 } | 313 } |
311 #endif // OS_CHROMEOS | 314 #endif // OS_CHROMEOS |
312 | 315 |
313 void MaximizeModeController::EnterMaximizeMode() { | 316 void MaximizeModeController::EnterMaximizeMode() { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; | 403 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; |
401 } | 404 } |
402 | 405 |
403 void MaximizeModeController::SetTickClockForTest( | 406 void MaximizeModeController::SetTickClockForTest( |
404 scoped_ptr<base::TickClock> tick_clock) { | 407 scoped_ptr<base::TickClock> tick_clock) { |
405 DCHECK(tick_clock_); | 408 DCHECK(tick_clock_); |
406 tick_clock_ = tick_clock.Pass(); | 409 tick_clock_ = tick_clock.Pass(); |
407 } | 410 } |
408 | 411 |
409 } // namespace ash | 412 } // namespace ash |
OLD | NEW |