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

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

Issue 264523002: Use centered app list position whenever virtual keyboard is allowed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed crash on Windows (check for Ash instance before use). Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/maximize_mode/maximize_mode_controller.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.cc b/ash/wm/maximize_mode/maximize_mode_controller.cc
index f438d4944b44d52792d28594d0ce0c858e44ec54..b8f6f2651e939cec9e002ace511b59cc9cd2a1e2 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller.cc
@@ -5,9 +5,11 @@
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/accelerometer/accelerometer_controller.h"
+#include "ash/ash_switches.h"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
#include "ash/wm/maximize_mode/maximize_mode_event_blocker.h"
+#include "base/command_line.h"
#include "ui/gfx/vector3d_f.h"
namespace ash {
@@ -82,7 +84,8 @@ float ClockwiseAngleBetweenVectorsInDegrees(const gfx::Vector3dF& base,
} // namespace
MaximizeModeController::MaximizeModeController()
- : rotation_locked_(false) {
+ : rotation_locked_(false),
+ have_seen_accelerometer_data_(false) {
Shell::GetInstance()->accelerometer_controller()->AddObserver(this);
}
@@ -90,9 +93,21 @@ MaximizeModeController::~MaximizeModeController() {
Shell::GetInstance()->accelerometer_controller()->RemoveObserver(this);
}
+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.
+ return have_seen_accelerometer_data_ ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kAshEnableTouchViewTesting);
+}
+
void MaximizeModeController::OnAccelerometerUpdated(
const gfx::Vector3dF& base,
const gfx::Vector3dF& lid) {
+ have_seen_accelerometer_data_ = true;
+
// Ignore the reading if it appears unstable. The reading is considered
// unstable if it deviates too much from gravity and/or the magnitude of the
// reading from the lid differs too much from the reading from the base.
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.h ('k') | chrome/browser/ui/app_list/app_list_view_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698