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

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: fix undocking 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 | no next file » | 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;
229 if (on && !IsMaximizeModeWindowManagerEnabled()) 232 if (on && !IsMaximizeModeWindowManagerEnabled())
230 EnterMaximizeMode(); 233 EnterMaximizeMode();
231 } 234 }
232 235
233 void MaximizeModeController::SuspendImminent() { 236 void MaximizeModeController::SuspendImminent() {
234 // The system is about to suspend, so record TouchView usage interval metrics 237 // The system is about to suspend, so record TouchView usage interval metrics
235 // based on whether TouchView mode is currently active. 238 // based on whether TouchView mode is currently active.
236 RecordTouchViewUsageInterval(CurrentTouchViewIntervalType()); 239 RecordTouchViewUsageInterval(CurrentTouchViewIntervalType());
237 } 240 }
238 241
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // their original position. 355 // their original position.
353 void MaximizeModeController::OnMaximizeModeEnded() { 356 void MaximizeModeController::OnMaximizeModeEnded() {
354 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE); 357 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE);
355 } 358 }
356 359
357 void MaximizeModeController::OnDisplayConfigurationChanged() { 360 void MaximizeModeController::OnDisplayConfigurationChanged() {
358 if (!display::Display::HasInternalDisplay() || 361 if (!display::Display::HasInternalDisplay() ||
359 !WmShell::Get()->IsActiveDisplayId( 362 !WmShell::Get()->IsActiveDisplayId(
360 display::Display::InternalDisplayId())) { 363 display::Display::InternalDisplayId())) {
361 LeaveMaximizeMode(); 364 LeaveMaximizeMode();
365 } else if (tablet_mode_switch_is_on_) {
gwendal 2017/01/23 20:48:31 not enough: what if the use is in tent mode, and t
jonross 2017/01/23 21:08:30 With the internal display back on we will automati
366 // The internal display has returned, as we are exiting docked mode.
367 // The device is still in tablet mode, so trigger maximize mode.
368 EnterMaximizeMode();
362 } 369 }
363 } 370 }
364 371
365 void MaximizeModeController::RecordTouchViewUsageInterval( 372 void MaximizeModeController::RecordTouchViewUsageInterval(
366 TouchViewIntervalType type) { 373 TouchViewIntervalType type) {
367 if (!CanEnterMaximizeMode()) 374 if (!CanEnterMaximizeMode())
368 return; 375 return;
369 376
370 base::Time current_time = base::Time::Now(); 377 base::Time current_time = base::Time::Now();
371 base::TimeDelta delta = current_time - touchview_usage_interval_start_time_; 378 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; 434 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds;
428 } 435 }
429 436
430 void MaximizeModeController::SetTickClockForTest( 437 void MaximizeModeController::SetTickClockForTest(
431 std::unique_ptr<base::TickClock> tick_clock) { 438 std::unique_ptr<base::TickClock> tick_clock) {
432 DCHECK(tick_clock_); 439 DCHECK(tick_clock_);
433 tick_clock_ = std::move(tick_clock); 440 tick_clock_ = std::move(tick_clock);
434 } 441 }
435 442
436 } // namespace ash 443 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698