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

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

Issue 684783004: Prefix CommandLine usage with base namespace (Part 4: ash/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 6 years, 1 month 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
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/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/accelerometer/accelerometer_controller.h" 9 #include "ash/accelerometer/accelerometer_controller.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void MaximizeModeController::RemoveObserver(Observer* observer) { 160 void MaximizeModeController::RemoveObserver(Observer* observer) {
161 observers_.RemoveObserver(observer); 161 observers_.RemoveObserver(observer);
162 } 162 }
163 163
164 bool MaximizeModeController::CanEnterMaximizeMode() { 164 bool MaximizeModeController::CanEnterMaximizeMode() {
165 // If we have ever seen accelerometer data, then HandleHingeRotation may 165 // If we have ever seen accelerometer data, then HandleHingeRotation may
166 // trigger maximize mode at some point in the future. 166 // trigger maximize mode at some point in the future.
167 // The --enable-touch-view-testing switch can also mean that we may enter 167 // The --enable-touch-view-testing switch can also mean that we may enter
168 // maximize mode. 168 // maximize mode.
169 return have_seen_accelerometer_data_ || 169 return have_seen_accelerometer_data_ ||
170 CommandLine::ForCurrentProcess()->HasSwitch( 170 base::CommandLine::ForCurrentProcess()->HasSwitch(
171 switches::kAshEnableTouchViewTesting); 171 switches::kAshEnableTouchViewTesting);
172 } 172 }
173 173
174 void MaximizeModeController::EnableMaximizeModeWindowManager(bool enable) { 174 void MaximizeModeController::EnableMaximizeModeWindowManager(bool enable) {
175 if (enable && !maximize_mode_window_manager_.get()) { 175 if (enable && !maximize_mode_window_manager_.get()) {
176 maximize_mode_window_manager_.reset(new MaximizeModeWindowManager()); 176 maximize_mode_window_manager_.reset(new MaximizeModeWindowManager());
177 // TODO(jonross): Move the maximize mode notifications from ShellObserver 177 // TODO(jonross): Move the maximize mode notifications from ShellObserver
178 // to MaximizeModeController::Observer 178 // to MaximizeModeController::Observer
179 Shell::GetInstance()->OnMaximizeModeStarted(); 179 Shell::GetInstance()->OnMaximizeModeStarted();
180 } else if (!enable && maximize_mode_window_manager_.get()) { 180 } else if (!enable && maximize_mode_window_manager_.get()) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // Clear the last_lid_open_time_ for a stable reading so that there is less 302 // Clear the last_lid_open_time_ for a stable reading so that there is less
303 // chance of a delay if the lid is moved from the close state to the fully 303 // chance of a delay if the lid is moved from the close state to the fully
304 // open state very quickly. 304 // open state very quickly.
305 if (is_angle_stable) 305 if (is_angle_stable)
306 last_lid_open_time_ = base::TimeTicks(); 306 last_lid_open_time_ = base::TimeTicks();
307 307
308 // Toggle maximize mode on or off when corresponding thresholds are passed. 308 // Toggle maximize mode on or off when corresponding thresholds are passed.
309 if (lid_open_past_180_ && is_angle_stable && 309 if (lid_open_past_180_ && is_angle_stable &&
310 lid_angle <= kExitMaximizeModeAngle) { 310 lid_angle <= kExitMaximizeModeAngle) {
311 lid_open_past_180_ = false; 311 lid_open_past_180_ = false;
312 if (!CommandLine::ForCurrentProcess()-> 312 if (!base::CommandLine::ForCurrentProcess()->
313 HasSwitch(switches::kAshEnableTouchViewTesting)) { 313 HasSwitch(switches::kAshEnableTouchViewTesting)) {
314 LeaveMaximizeMode(); 314 LeaveMaximizeMode();
315 } 315 }
316 event_blocker_.reset(); 316 event_blocker_.reset();
317 } else if (!lid_open_past_180_ && !lid_is_closed_ && 317 } else if (!lid_open_past_180_ && !lid_is_closed_ &&
318 lid_angle >= kEnterMaximizeModeAngle && 318 lid_angle >= kEnterMaximizeModeAngle &&
319 (is_angle_stable || !WasLidOpenedRecently())) { 319 (is_angle_stable || !WasLidOpenedRecently())) {
320 lid_open_past_180_ = true; 320 lid_open_past_180_ = true;
321 if (!CommandLine::ForCurrentProcess()-> 321 if (!base::CommandLine::ForCurrentProcess()->
322 HasSwitch(switches::kAshEnableTouchViewTesting)) { 322 HasSwitch(switches::kAshEnableTouchViewTesting)) {
323 EnterMaximizeMode(); 323 EnterMaximizeMode();
324 } 324 }
325 #if defined(USE_X11) 325 #if defined(USE_X11)
326 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11); 326 event_blocker_.reset(new ScopedDisableInternalMouseAndKeyboardX11);
327 #endif 327 #endif
328 } 328 }
329 } 329 }
330 330
331 void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) { 331 void MaximizeModeController::HandleScreenRotation(const gfx::Vector3dF& lid) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return elapsed_time <= kLidRecentlyOpenedDuration; 495 return elapsed_time <= kLidRecentlyOpenedDuration;
496 } 496 }
497 497
498 void MaximizeModeController::SetTickClockForTest( 498 void MaximizeModeController::SetTickClockForTest(
499 scoped_ptr<base::TickClock> tick_clock) { 499 scoped_ptr<base::TickClock> tick_clock) {
500 DCHECK(tick_clock_); 500 DCHECK(tick_clock_);
501 tick_clock_ = tick_clock.Pass(); 501 tick_clock_ = tick_clock.Pass();
502 } 502 }
503 503
504 } // namespace ash 504 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/lock_layout_manager_unittest.cc ('k') | ash/wm/maximize_mode/maximize_mode_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698