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

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

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 <utility> 7 #include <utility>
8 8
9 #include "ash/accelerators/accelerator_controller.h" 9 #include "ash/accelerators/accelerator_controller.h"
10 #include "ash/accelerators/accelerator_table.h" 10 #include "ash/accelerators/accelerator_table.h"
11 #include "ash/ash_switches.h" 11 #include "ash/ash_switches.h"
12 #include "ash/display/display_manager.h" 12 #include "ash/display/display_manager.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h" 14 #include "ash/wm/maximize_mode/maximize_mode_window_manager.h"
15 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h" 15 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/time/default_tick_clock.h" 18 #include "base/time/default_tick_clock.h"
19 #include "base/time/tick_clock.h" 19 #include "base/time/tick_clock.h"
20 #include "ui/base/accelerators/accelerator.h" 20 #include "ui/base/accelerators/accelerator.h"
21 #include "ui/display/display.h"
21 #include "ui/events/event.h" 22 #include "ui/events/event.h"
22 #include "ui/events/keycodes/keyboard_codes.h" 23 #include "ui/events/keycodes/keyboard_codes.h"
23 #include "ui/gfx/display.h"
24 #include "ui/gfx/geometry/vector3d_f.h" 24 #include "ui/gfx/geometry/vector3d_f.h"
25 25
26 #if defined(USE_X11) 26 #if defined(USE_X11)
27 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" 27 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h"
28 #endif 28 #endif
29 29
30 #if defined(USE_OZONE) 30 #if defined(USE_OZONE)
31 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h" 31 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h"
32 #endif 32 #endif
33 33
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 #if defined(OS_CHROMEOS) 184 #if defined(OS_CHROMEOS)
185 void MaximizeModeController::OnAccelerometerUpdated( 185 void MaximizeModeController::OnAccelerometerUpdated(
186 scoped_refptr<const chromeos::AccelerometerUpdate> update) { 186 scoped_refptr<const chromeos::AccelerometerUpdate> update) {
187 bool first_accelerometer_update = !have_seen_accelerometer_data_; 187 bool first_accelerometer_update = !have_seen_accelerometer_data_;
188 have_seen_accelerometer_data_ = true; 188 have_seen_accelerometer_data_ = true;
189 189
190 if (!update->has(chromeos::ACCELEROMETER_SOURCE_SCREEN)) 190 if (!update->has(chromeos::ACCELEROMETER_SOURCE_SCREEN))
191 return; 191 return;
192 192
193 if (!gfx::Display::HasInternalDisplay()) 193 if (!display::Display::HasInternalDisplay())
194 return; 194 return;
195 195
196 if (!Shell::GetInstance()->display_manager()->IsActiveDisplayId( 196 if (!Shell::GetInstance()->display_manager()->IsActiveDisplayId(
197 gfx::Display::InternalDisplayId())) { 197 display::Display::InternalDisplayId())) {
198 return; 198 return;
199 } 199 }
200 200
201 // Whether or not we enter maximize mode affects whether we handle screen 201 // Whether or not we enter maximize mode affects whether we handle screen
202 // rotation, so determine whether to enter maximize mode first. 202 // rotation, so determine whether to enter maximize mode first.
203 if (!update->has(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD)) { 203 if (!update->has(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD)) {
204 if (first_accelerometer_update) 204 if (first_accelerometer_update)
205 EnterMaximizeMode(); 205 EnterMaximizeMode();
206 } else if (ui::IsAccelerometerReadingStable( 206 } else if (ui::IsAccelerometerReadingStable(
207 *update, chromeos::ACCELEROMETER_SOURCE_SCREEN) && 207 *update, chromeos::ACCELEROMETER_SOURCE_SCREEN) &&
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_INACTIVE); 342 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_INACTIVE);
343 } 343 }
344 344
345 // Called after maximize mode has ended, windows might still be returning to 345 // Called after maximize mode has ended, windows might still be returning to
346 // their original position. 346 // their original position.
347 void MaximizeModeController::OnMaximizeModeEnded() { 347 void MaximizeModeController::OnMaximizeModeEnded() {
348 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE); 348 RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE);
349 } 349 }
350 350
351 void MaximizeModeController::OnDisplayConfigurationChanged() { 351 void MaximizeModeController::OnDisplayConfigurationChanged() {
352 if (!gfx::Display::HasInternalDisplay() || 352 if (!display::Display::HasInternalDisplay() ||
353 !Shell::GetInstance()->display_manager()->IsActiveDisplayId( 353 !Shell::GetInstance()->display_manager()->IsActiveDisplayId(
354 gfx::Display::InternalDisplayId())) { 354 display::Display::InternalDisplayId())) {
355 LeaveMaximizeMode(); 355 LeaveMaximizeMode();
356 } 356 }
357 } 357 }
358 358
359 void MaximizeModeController::RecordTouchViewUsageInterval( 359 void MaximizeModeController::RecordTouchViewUsageInterval(
360 TouchViewIntervalType type) { 360 TouchViewIntervalType type) {
361 if (!CanEnterMaximizeMode()) 361 if (!CanEnterMaximizeMode())
362 return; 362 return;
363 363
364 base::Time current_time = base::Time::Now(); 364 base::Time current_time = base::Time::Now();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; 415 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds;
416 } 416 }
417 417
418 void MaximizeModeController::SetTickClockForTest( 418 void MaximizeModeController::SetTickClockForTest(
419 std::unique_ptr<base::TickClock> tick_clock) { 419 std::unique_ptr<base::TickClock> tick_clock) {
420 DCHECK(tick_clock_); 420 DCHECK(tick_clock_);
421 tick_clock_ = std::move(tick_clock); 421 tick_clock_ = std::move(tick_clock);
422 } 422 }
423 423
424 } // namespace ash 424 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.h ('k') | ash/wm/maximize_mode/maximize_mode_window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698