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

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

Issue 267743010: Suppressed screen rotation notifications triggeres by the accelerometer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor fix to some whitespace 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.h
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.h b/ash/wm/maximize_mode/maximize_mode_controller.h
index 86e5acaa63d03122ef42bf6164c13f7eda46fd7d..931069ab8b221572774ca6f6931b85215539be1d 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.h
+++ b/ash/wm/maximize_mode/maximize_mode_controller.h
@@ -7,8 +7,10 @@
#include "ash/accelerometer/accelerometer_observer.h"
#include "ash/ash_export.h"
+#include "ash/display/display_manager.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "ui/message_center/message_center.h"
namespace ash {
@@ -17,7 +19,9 @@ class MaximizeModeEventBlocker;
// 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 AccelerometerObserver {
+class ASH_EXPORT MaximizeModeController
+ : public message_center::NotificationBlocker,
+ public AccelerometerObserver {
public:
MaximizeModeController();
virtual ~MaximizeModeController();
@@ -38,6 +42,11 @@ class ASH_EXPORT MaximizeModeController : public AccelerometerObserver {
virtual void OnAccelerometerUpdated(const gfx::Vector3dF& base,
const gfx::Vector3dF& lid) OVERRIDE;
+ // message_center::NotificationBlocker:
+ virtual bool ShouldShowNotificationAsPopup(
+ const message_center::NotifierId& notifier_id) const OVERRIDE;
+ virtual bool ShouldShowNotification(
+ const message_center::NotifierId& notifier_id) const OVERRIDE;
jonross 2014/05/09 14:57:33 Nit: empty line after a function and a new scope d
bruthig 2014/05/14 00:36:16 Done.
private:
// Detect hinge rotation from |base| and |lid| accelerometers and
// automatically start / stop maximize mode.
@@ -48,6 +57,14 @@ class ASH_EXPORT MaximizeModeController : public AccelerometerObserver {
// screen.
void HandleScreenRotation(const gfx::Vector3dF& lid);
+ // Sets the display rotation and suppresses display notifications.
+ void SetDisplayRotation(DisplayManager* display_manager,
jonross 2014/05/09 14:57:33 Please forward declare DisplayManager
bruthig 2014/05/14 00:36:16 gfx::Display::Rotation also comes from display_man
+ int64 display_id,
+ gfx::Display::Rotation rotation);
+
+ // Set whether rotation notifications should be shown.
+ void set_show_notifications(bool should_show);
flackr 2014/05/08 21:56:15 non-trivial methods should use TitleCase. I.e. any
bruthig 2014/05/14 00:36:16 Done.
+
// Enables MaximizeModeWindowManager, and determines the current state of
// rotation lock.
void EnterMaximizeMode();
@@ -63,6 +80,10 @@ class ASH_EXPORT MaximizeModeController : public AccelerometerObserver {
// When true calls to OnAccelerometerUpdated will not rotate the display.
bool rotation_locked_;
+ // When true will display notifications. Use set_show_notifications to
+ // change the value.
+ bool show_notifications_;
+
DISALLOW_COPY_AND_ASSIGN(MaximizeModeController);
};

Powered by Google App Engine
This is Rietveld 408576698