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

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

Issue 2649553004: Do not enter Maximize Mode while docked (Closed)
Patch Set: Unittests and associated fixes Created 3 years, 11 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
« no previous file with comments | « no previous file | ash/wm/maximize_mode/maximize_mode_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/wm/maximize_mode/maximize_mode_controller.h" 5 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/ash_switches.h" 9 #include "ash/common/ash_switches.h"
10 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" 10 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (open) 219 if (open)
220 last_lid_open_time_ = time; 220 last_lid_open_time_ = time;
221 lid_is_closed_ = !open; 221 lid_is_closed_ = !open;
222 LeaveMaximizeMode(); 222 LeaveMaximizeMode();
223 } 223 }
224 224
225 void MaximizeModeController::TabletModeEventReceived( 225 void MaximizeModeController::TabletModeEventReceived(
226 bool on, 226 bool on,
227 const base::TimeTicks& time) { 227 const base::TimeTicks& time) {
228 tablet_mode_switch_is_on_ = on; 228 tablet_mode_switch_is_on_ = on;
229 // Do not change if docked.
230 if (!display::Display::HasInternalDisplay())
231 return;
232 if (!WmShell::Get()->IsActiveDisplayId(
233 display::Display::InternalDisplayId())) {
234 return;
oshima 2017/01/25 22:13:19 optional: you may keep if you prefer that way. if
jonross 2017/01/26 00:58:39 Done.
235 }
229 if (on && !IsMaximizeModeWindowManagerEnabled()) 236 if (on && !IsMaximizeModeWindowManagerEnabled())
230 EnterMaximizeMode(); 237 EnterMaximizeMode();
231 } 238 }
232 239
233 void MaximizeModeController::SuspendImminent() { 240 void MaximizeModeController::SuspendImminent() {
234 // The system is about to suspend, so record TouchView usage interval metrics 241 // The system is about to suspend, so record TouchView usage interval metrics
235 // based on whether TouchView mode is currently active. 242 // based on whether TouchView mode is currently active.
236 RecordTouchViewUsageInterval(CurrentTouchViewIntervalType()); 243 RecordTouchViewUsageInterval(CurrentTouchViewIntervalType());
237 } 244 }
238 245
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // their original position. 359 // their original position.
353 void MaximizeModeController::OnMaximizeModeEnded() { 360 void MaximizeModeController::OnMaximizeModeEnded() {
354 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE); 361 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE);
355 } 362 }
356 363
357 void MaximizeModeController::OnDisplayConfigurationChanged() { 364 void MaximizeModeController::OnDisplayConfigurationChanged() {
358 if (!display::Display::HasInternalDisplay() || 365 if (!display::Display::HasInternalDisplay() ||
359 !WmShell::Get()->IsActiveDisplayId( 366 !WmShell::Get()->IsActiveDisplayId(
360 display::Display::InternalDisplayId())) { 367 display::Display::InternalDisplayId())) {
361 LeaveMaximizeMode(); 368 LeaveMaximizeMode();
369 } else if (tablet_mode_switch_is_on_ &&
370 !IsMaximizeModeWindowManagerEnabled()) {
371 // The internal display has returned, as we are exiting docked mode.
372 // The device is still in tablet mode, so trigger maximize mode, as this
373 // switch leads to the ignoring of accelerometer events. When the switch is
374 // not set the next stable accelerometer readings will trigger maximize
375 // mode.
376 EnterMaximizeMode();
362 } 377 }
363 } 378 }
364 379
365 void MaximizeModeController::RecordTouchViewUsageInterval( 380 void MaximizeModeController::RecordTouchViewUsageInterval(
366 TouchViewIntervalType type) { 381 TouchViewIntervalType type) {
367 if (!CanEnterMaximizeMode()) 382 if (!CanEnterMaximizeMode())
368 return; 383 return;
369 384
370 base::Time current_time = base::Time::Now(); 385 base::Time current_time = base::Time::Now();
371 base::TimeDelta delta = current_time - touchview_usage_interval_start_time_; 386 base::TimeDelta delta = current_time - touchview_usage_interval_start_time_;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; 442 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds;
428 } 443 }
429 444
430 void MaximizeModeController::SetTickClockForTest( 445 void MaximizeModeController::SetTickClockForTest(
431 std::unique_ptr<base::TickClock> tick_clock) { 446 std::unique_ptr<base::TickClock> tick_clock) {
432 DCHECK(tick_clock_); 447 DCHECK(tick_clock_);
433 tick_clock_ = std::move(tick_clock); 448 tick_clock_ = std::move(tick_clock);
434 } 449 }
435 450
436 } // namespace ash 451 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/maximize_mode/maximize_mode_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698