OLD | NEW |
---|---|
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" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 #if defined(USE_X11) | 27 #if defined(USE_X11) |
28 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" | 28 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #if defined(USE_OZONE) | 31 #if defined(USE_OZONE) |
32 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h" | 32 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone. h" |
33 #endif | 33 #endif |
34 | 34 |
35 #if defined(OS_CHROMEOS) | 35 #if defined(OS_CHROMEOS) |
36 #include "base/sys_info.h" | |
36 #include "chromeos/dbus/dbus_thread_manager.h" | 37 #include "chromeos/dbus/dbus_thread_manager.h" |
37 #include "ui/chromeos/accelerometer/accelerometer_util.h" | 38 #include "ui/chromeos/accelerometer/accelerometer_util.h" |
38 #endif // OS_CHROMEOS | 39 #endif // OS_CHROMEOS |
39 | 40 |
40 namespace ash { | 41 namespace ash { |
41 | 42 |
42 namespace { | 43 namespace { |
43 | 44 |
44 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
45 // The hinge angle at which to enter maximize mode. | 46 // The hinge angle at which to enter maximize mode. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 switches::kAshEnableTouchView)) { | 135 switches::kAshEnableTouchView)) { |
135 chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this); | 136 chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this); |
136 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); | 137 Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); |
137 } | 138 } |
138 chromeos::DBusThreadManager::Get()-> | 139 chromeos::DBusThreadManager::Get()-> |
139 GetPowerManagerClient()->RemoveObserver(this); | 140 GetPowerManagerClient()->RemoveObserver(this); |
140 #endif // OS_CHROMEOS | 141 #endif // OS_CHROMEOS |
141 } | 142 } |
142 | 143 |
143 bool MaximizeModeController::CanEnterMaximizeMode() { | 144 bool MaximizeModeController::CanEnterMaximizeMode() { |
145 #if defined(OS_CHROMEOS) | |
146 if (!base::SysInfo::IsRunningOnChromeOS()) | |
147 return true; | |
148 #endif | |
oshima
2016/06/23 23:39:35
tuns out that this isn't necessary. reverted.
| |
144 // If we have ever seen accelerometer data, then HandleHingeRotation may | 149 // If we have ever seen accelerometer data, then HandleHingeRotation may |
145 // trigger maximize mode at some point in the future. | 150 // trigger maximize mode at some point in the future. |
146 // The --enable-touch-view-testing switch can also mean that we may enter | 151 // The --enable-touch-view-testing switch can also mean that we may enter |
147 // maximize mode. | 152 // maximize mode. |
148 // TODO(mgiuca): This can result in false positives, as it returns true for | 153 // TODO(mgiuca): This can result in false positives, as it returns true for |
149 // any device with an accelerometer. Have TouchView-enabled devices explicitly | 154 // any device with an accelerometer. Have TouchView-enabled devices explicitly |
150 // set a flag, and change this implementation to simply return true iff the | 155 // set a flag, and change this implementation to simply return true iff the |
151 // flag is present (http://crbug.com/457445). | 156 // flag is present (http://crbug.com/457445). |
152 return have_seen_accelerometer_data_ || | 157 return have_seen_accelerometer_data_ || |
153 base::CommandLine::ForCurrentProcess()->HasSwitch( | 158 base::CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; | 438 return elapsed_time.InSeconds() <= kLidRecentlyOpenedDurationSeconds; |
434 } | 439 } |
435 | 440 |
436 void MaximizeModeController::SetTickClockForTest( | 441 void MaximizeModeController::SetTickClockForTest( |
437 std::unique_ptr<base::TickClock> tick_clock) { | 442 std::unique_ptr<base::TickClock> tick_clock) { |
438 DCHECK(tick_clock_); | 443 DCHECK(tick_clock_); |
439 tick_clock_ = std::move(tick_clock); | 444 tick_clock_ = std::move(tick_clock); |
440 } | 445 } |
441 | 446 |
442 } // namespace ash | 447 } // namespace ash |
OLD | NEW |