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

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: . 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 !WmShell::Get()->IsActiveDisplayId(
232 display::Display::InternalDisplayId())) {
233 return;
234 }
229 if (on && !IsMaximizeModeWindowManagerEnabled()) 235 if (on && !IsMaximizeModeWindowManagerEnabled())
230 EnterMaximizeMode(); 236 EnterMaximizeMode();
231 } 237 }
232 238
233 void MaximizeModeController::SuspendImminent() { 239 void MaximizeModeController::SuspendImminent() {
234 // The system is about to suspend, so record TouchView usage interval metrics 240 // The system is about to suspend, so record TouchView usage interval metrics
235 // based on whether TouchView mode is currently active. 241 // based on whether TouchView mode is currently active.
236 RecordTouchViewUsageInterval(CurrentTouchViewIntervalType()); 242 RecordTouchViewUsageInterval(CurrentTouchViewIntervalType());
237 } 243 }
238 244
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // their original position. 358 // their original position.
353 void MaximizeModeController::OnMaximizeModeEnded() { 359 void MaximizeModeController::OnMaximizeModeEnded() {
354 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE); 360 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE);
355 } 361 }
356 362
357 void MaximizeModeController::OnDisplayConfigurationChanged() { 363 void MaximizeModeController::OnDisplayConfigurationChanged() {
358 if (!display::Display::HasInternalDisplay() || 364 if (!display::Display::HasInternalDisplay() ||
359 !WmShell::Get()->IsActiveDisplayId( 365 !WmShell::Get()->IsActiveDisplayId(
360 display::Display::InternalDisplayId())) { 366 display::Display::InternalDisplayId())) {
361 LeaveMaximizeMode(); 367 LeaveMaximizeMode();
368 } else if (tablet_mode_switch_is_on_ &&
369 !IsMaximizeModeWindowManagerEnabled()) {
370 // The internal display has returned, as we are exiting docked mode.
371 // The device is still in tablet mode, so trigger maximize mode, as this
372 // switch leads to the ignoring of accelerometer events. When the switch is
373 // not set the next stable accelerometer readings will trigger maximize
374 // mode.
375 EnterMaximizeMode();
362 } 376 }
363 } 377 }
364 378
365 void MaximizeModeController::RecordTouchViewUsageInterval( 379 void MaximizeModeController::RecordTouchViewUsageInterval(
366 TouchViewIntervalType type) { 380 TouchViewIntervalType type) {
367 if (!CanEnterMaximizeMode()) 381 if (!CanEnterMaximizeMode())
368 return; 382 return;
369 383
370 base::Time current_time = base::Time::Now(); 384 base::Time current_time = base::Time::Now();
371 base::TimeDelta delta = current_time - touchview_usage_interval_start_time_; 385 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; 441 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds;
428 } 442 }
429 443
430 void MaximizeModeController::SetTickClockForTest( 444 void MaximizeModeController::SetTickClockForTest(
431 std::unique_ptr<base::TickClock> tick_clock) { 445 std::unique_ptr<base::TickClock> tick_clock) {
432 DCHECK(tick_clock_); 446 DCHECK(tick_clock_);
433 tick_clock_ = std::move(tick_clock); 447 tick_clock_ = std::move(tick_clock);
434 } 448 }
435 449
436 } // namespace ash 450 } // 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