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

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

Issue 2736573002: chromeos: Move files in //ash/common to //ash, part 2 (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « ash/common/wm/maximize_mode/OWNERS ('k') | ash/common/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/maximize_mode/maximize_mode_controller.h
diff --git a/ash/common/wm/maximize_mode/maximize_mode_controller.h b/ash/common/wm/maximize_mode/maximize_mode_controller.h
deleted file mode 100644
index 32650fec2cbcb11e479e651beeb0a58112dcf414..0000000000000000000000000000000000000000
--- a/ash/common/wm/maximize_mode/maximize_mode_controller.h
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
-#define ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
-
-#include <memory>
-
-#include "ash/ash_export.h"
-#include "ash/common/shell_observer.h"
-#include "ash/common/wm_display_observer.h"
-#include "ash/public/interfaces/touch_view.mojom.h"
-#include "base/compiler_specific.h"
-#include "base/macros.h"
-#include "base/time/time.h"
-#include "chromeos/accelerometer/accelerometer_reader.h"
-#include "chromeos/accelerometer/accelerometer_types.h"
-#include "chromeos/dbus/power_manager_client.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "mojo/public/cpp/bindings/interface_ptr_set.h"
-#include "ui/gfx/geometry/vector3d_f.h"
-
-namespace base {
-class TickClock;
-}
-
-namespace gfx {
-class Vector3dF;
-}
-
-namespace ash {
-
-class MaximizeModeControllerTest;
-class ScopedDisableInternalMouseAndKeyboard;
-class MaximizeModeWindowManager;
-class MaximizeModeWindowManagerTest;
-class WmWindow;
-namespace test {
-class MultiUserWindowManagerChromeOSTest;
-class VirtualKeyboardControllerTest;
-}
-
-// MaximizeModeController listens to accelerometer events and automatically
-// enters and exits maximize mode when the lid is opened beyond the triggering
-// angle and rotates the display to match the device when in maximize mode.
-class ASH_EXPORT MaximizeModeController :
- public chromeos::AccelerometerReader::Observer,
- public chromeos::PowerManagerClient::Observer,
- NON_EXPORTED_BASE(public mojom::TouchViewManager),
- public ShellObserver,
- public WmDisplayObserver {
- public:
- MaximizeModeController();
- ~MaximizeModeController() override;
-
- // True if it is possible to enter maximize mode in the current
- // configuration. If this returns false, it should never be the case that
- // maximize mode becomes enabled.
- bool CanEnterMaximizeMode();
-
- // TODO(jonross): Merge this with EnterMaximizeMode. Currently these are
- // separate for several reasons: there is no internal display when running
- // unittests; the event blocker prevents keyboard input when running ChromeOS
- // on linux. http://crbug.com/362881
- // Turn the always maximize mode window manager on or off.
- void EnableMaximizeModeWindowManager(bool should_enable);
-
- // Test if the MaximizeModeWindowManager is enabled or not.
- bool IsMaximizeModeWindowManagerEnabled() const;
-
- // Add a special window to the MaximizeModeWindowManager for tracking. This is
- // only required for special windows which are handled by other window
- // managers like the |MultiUserWindowManager|.
- // If the maximize mode is not enabled no action will be performed.
- void AddWindow(WmWindow* window);
-
- // Binds the mojom::TouchViewManager interface request to this object.
- void BindRequest(mojom::TouchViewManagerRequest request);
-
- // ShellObserver:
- void OnAppTerminating() override;
- void OnMaximizeModeStarted() override;
- void OnMaximizeModeEnded() override;
-
- // WmDisplayObserver:
- void OnDisplayConfigurationChanged() override;
-
- // chromeos::AccelerometerReader::Observer:
- void OnAccelerometerUpdated(
- scoped_refptr<const chromeos::AccelerometerUpdate> update) override;
-
- // PowerManagerClient::Observer:
- void LidEventReceived(bool open, const base::TimeTicks& time) override;
- void TabletModeEventReceived(bool on, const base::TimeTicks& time) override;
- void SuspendImminent() override;
- void SuspendDone(const base::TimeDelta& sleep_duration) override;
-
- private:
- friend class MaximizeModeControllerTest;
- friend class MaximizeModeWindowManagerTest;
- friend class test::MultiUserWindowManagerChromeOSTest;
- friend class test::VirtualKeyboardControllerTest;
-
- // Used for recording metrics for intervals of time spent in
- // and out of TouchView.
- enum TouchViewIntervalType {
- TOUCH_VIEW_INTERVAL_INACTIVE,
- TOUCH_VIEW_INTERVAL_ACTIVE
- };
-
- // Set the TickClock. This is only to be used by tests that need to
- // artificially and deterministically control the current time.
- void SetTickClockForTest(std::unique_ptr<base::TickClock> tick_clock);
-
- // Detect hinge rotation from base and lid accelerometers and automatically
- // start / stop maximize mode.
- void HandleHingeRotation(
- scoped_refptr<const chromeos::AccelerometerUpdate> update);
-
- // Returns true if the lid was recently opened.
- bool WasLidOpenedRecently() const;
-
- // Enables MaximizeModeWindowManager, and determines the current state of
- // rotation lock.
- void EnterMaximizeMode();
-
- // Removes MaximizeModeWindowManager and resets the display rotation if there
- // is no rotation lock.
- void LeaveMaximizeMode();
-
- // Record UMA stats tracking TouchView usage. If |type| is
- // TOUCH_VIEW_INTERVAL_INACTIVE, then record that TouchView has been
- // inactive from |touchview_usage_interval_start_time_| until now.
- // Similarly, record that TouchView has been active if |type| is
- // TOUCH_VIEW_INTERVAL_ACTIVE.
- void RecordTouchViewUsageInterval(TouchViewIntervalType type);
-
- // Returns TOUCH_VIEW_INTERVAL_ACTIVE if TouchView is currently active,
- // otherwise returns TOUCH_VIEW_INTERNAL_INACTIVE.
- TouchViewIntervalType CurrentTouchViewIntervalType();
-
- // mojom::TouchViewManager:
- void AddObserver(mojom::TouchViewObserverPtr observer) override;
-
- // The maximized window manager (if enabled).
- std::unique_ptr<MaximizeModeWindowManager> maximize_mode_window_manager_;
-
- // A helper class which when instantiated will block native events from the
- // internal keyboard and touchpad.
- std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> event_blocker_;
-
- // Whether we have ever seen accelerometer data.
- bool have_seen_accelerometer_data_;
-
- // Tracks time spent in (and out of) touchview mode.
- base::Time touchview_usage_interval_start_time_;
- base::TimeDelta total_touchview_time_;
- base::TimeDelta total_non_touchview_time_;
-
- // Tracks the last time we received a lid open event. This is used to suppress
- // erroneous accelerometer readings as the lid is opened but the accelerometer
- // reports readings that make the lid to appear near fully open.
- base::TimeTicks last_lid_open_time_;
-
- // Source for the current time in base::TimeTicks.
- std::unique_ptr<base::TickClock> tick_clock_;
-
- // Set when tablet mode switch is on. This is used to force maximize mode.
- bool tablet_mode_switch_is_on_;
-
- // Tracks when the lid is closed. Used to prevent entering maximize mode.
- bool lid_is_closed_;
-
- // Tracks smoothed accelerometer data over time. This is done when the hinge
- // is approaching vertical to remove abrupt acceleration that can lead to
- // incorrect calculations of hinge angles.
- gfx::Vector3dF base_smoothed_;
- gfx::Vector3dF lid_smoothed_;
-
- // Bindings for the TouchViewManager interface.
- mojo::BindingSet<mojom::TouchViewManager> bindings_;
-
- // The set of touchview observers to be notified about mode changes.
- mojo::InterfacePtrSet<mojom::TouchViewObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
-};
-
-} // namespace ash
-
-#endif // ASH_COMMON_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
« no previous file with comments | « ash/common/wm/maximize_mode/OWNERS ('k') | ash/common/wm/maximize_mode/maximize_mode_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698