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

Unified Diff: ash/common/wm/maximize_mode/maximize_mode_controller.cc

Issue 2642853006: Remove the ash-enable-touch-view-testing flag (Closed)
Patch Set: Fix tests 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 side-by-side diff with in-line comments
Download patch
Index: ash/common/wm/maximize_mode/maximize_mode_controller.cc
diff --git a/ash/common/wm/maximize_mode/maximize_mode_controller.cc b/ash/common/wm/maximize_mode/maximize_mode_controller.cc
index ef07902244ecc33649b4b503a17bb766184afe73..c1e9fe07d214e6a0bd8f663f2ec13b7a73843da9 100644
--- a/ash/common/wm/maximize_mode/maximize_mode_controller.cc
+++ b/ash/common/wm/maximize_mode/maximize_mode_controller.cc
@@ -87,6 +87,7 @@ bool IsEnabled() {
MaximizeModeController::MaximizeModeController()
: have_seen_accelerometer_data_(false),
+ force_can_enter_maximize_mode_for_tests_(false),
touchview_usage_interval_start_time_(base::Time::Now()),
tick_clock_(new base::DefaultTickClock()),
tablet_mode_switch_is_on_(false),
@@ -98,24 +99,21 @@ MaximizeModeController::MaximizeModeController()
// unavailable. This will require refactoring
// IsMaximizeModeWindowManagerEnabled to check for the existance of the
// controller.
- const bool is_enabled = IsEnabled();
- if (is_enabled)
+ if (IsEnabled()) {
WmShell::Get()->AddDisplayObserver(this);
-
- if (is_enabled)
chromeos::AccelerometerReader::GetInstance()->AddObserver(this);
+ }
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(
this);
}
MaximizeModeController::~MaximizeModeController() {
WmShell::Get()->RemoveShellObserver(this);
- const bool is_enabled = IsEnabled();
- if (is_enabled)
- WmShell::Get()->RemoveDisplayObserver(this);
- if (is_enabled)
+ if (IsEnabled()) {
+ WmShell::Get()->RemoveDisplayObserver(this);
chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this);
+ }
chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(
this);
}
@@ -123,15 +121,12 @@ MaximizeModeController::~MaximizeModeController() {
bool MaximizeModeController::CanEnterMaximizeMode() {
// If we have ever seen accelerometer data, then HandleHingeRotation may
// trigger maximize mode at some point in the future.
- // The --enable-touch-view-testing switch can also mean that we may enter
- // maximize mode.
// TODO(mgiuca): This can result in false positives, as it returns true for
// any device with an accelerometer. Have TouchView-enabled devices explicitly
// set a flag, and change this implementation to simply return true iff the
// flag is present (http://crbug.com/457445).
return have_seen_accelerometer_data_ ||
Daniel Erat 2017/01/19 22:33:29 the comment makes me think that this should possib
afakhry 2017/01/24 03:00:09 That's a reasonable alternative, though from mgiuc
Daniel Erat 2017/01/24 04:30:06 would you mind updating/deleting the comment as pa
afakhry 2017/01/24 17:24:08 Done.
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableTouchViewTesting);
+ force_can_enter_maximize_mode_for_tests_;
}
// TODO(jcliang): Hide or remove EnableMaximizeModeWindowManager
@@ -316,13 +311,6 @@ void MaximizeModeController::EnterMaximizeMode() {
event_blocker_ =
WmShell::Get()->CreateScopedDisableInternalMouseAndKeyboard();
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableTouchViewTesting)) {
- // We don't let accelerometer updates interfere with the maximize mode
- // status as set by the touch-view-testing keyboard shortcut.
- return;
- }
-
if (IsMaximizeModeWindowManagerEnabled())
return;
EnableMaximizeModeWindowManager(true);
@@ -331,13 +319,6 @@ void MaximizeModeController::EnterMaximizeMode() {
void MaximizeModeController::LeaveMaximizeMode() {
event_blocker_.reset();
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kAshEnableTouchViewTesting)) {
- // We don't let accelerometer updates interfere with the maximize mode
- // status as set by the touch-view-testing keyboard shortcut.
- return;
- }
-
if (!IsMaximizeModeWindowManagerEnabled())
return;
EnableMaximizeModeWindowManager(false);

Powered by Google App Engine
This is Rietveld 408576698