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

Unified Diff: ash/wm/power_button_controller.h

Issue 10909008: Improve existing lock transition - remove black splash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 3 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/power_button_controller.h
diff --git a/ash/wm/power_button_controller.h b/ash/wm/power_button_controller.h
index eee5f1cd9ee832ca9cd4509402e9f008eeddec70..1bb4d321a5449e1c981ebb67c0bfd5d6c5ce795b 100644
--- a/ash/wm/power_button_controller.h
+++ b/ash/wm/power_button_controller.h
@@ -43,7 +43,7 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
public ShellObserver {
public:
// Animations that can be applied to groups of containers.
- // Exposed here for TestApi::ContainerGroupIsAnimated().
+ // Exposed here for TestApi::ContainersAreAnimated().
enum AnimationType {
ANIMATION_SLOW_CLOSE = 0,
ANIMATION_UNDO_SLOW_CLOSE,
@@ -53,13 +53,27 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
ANIMATION_RESTORE,
};
- // Groups of containers that can be animated.
- // Exposed here for TestApi::ContainerGroupIsAnimated().
- enum ContainerGroup {
- ALL_CONTAINERS = 0,
- SCREEN_LOCKER_CONTAINERS,
- SCREEN_LOCKER_AND_RELATED_CONTAINERS,
- ALL_BUT_SCREEN_LOCKER_AND_RELATED_CONTAINERS,
+ // Specific containers or groups of containers that can be animated.
+ // Exposed here for TestApi::ContainersAreAnimated().
+ enum Container {
+ DESKTOP_BACKGROUND = 1 << 0,
+
+ // All user session related containers including system background but
+ // not including desktop background (wallpaper).
+ NON_LOCK_SCREEN_CONTAINERS = 1 << 1,
+
+ // Desktop wallpaper is moved to this layer when screen is locked.
+ // This layer is excluded from lock animation so that wallpaper stays as is,
+ // user session windows are hidden and lock UI is shown on top of it.
+ // This layer is included in shutdown animation.
+ LOCK_SCREEN_BACKGROUND = 1 << 2,
+
+ // Lock screen and lock screen modal containers.
+ LOCK_SCREEN_CONTAINERS = 1 << 3,
+
+ // Multiple system layers belong here like status, menu, tooltip
+ // and overlay layers.
+ LOCK_SCREEN_RELATED_CONTAINERS = 1 << 4,
};
// Helper class used by tests to access internal state.
@@ -83,8 +97,8 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
bool real_shutdown_timer_is_running() const {
return controller_->real_shutdown_timer_.IsRunning();
}
- bool hide_background_layer_timer_is_running() const {
- return controller_->hide_background_layer_timer_.IsRunning();
+ bool hide_black_layer_timer_is_running() const {
+ return controller_->hide_black_layer_timer_.IsRunning();
}
void trigger_lock_timeout() {
@@ -107,22 +121,22 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
controller_->OnRealShutdownTimeout();
controller_->real_shutdown_timer_.Stop();
}
- void trigger_hide_background_layer_timeout() {
- controller_->HideBackgroundLayer();
- controller_->hide_background_layer_timer_.Stop();
+ void trigger_hide_black_layer_timeout() {
+ controller_->HideBlackLayer();
+ controller_->hide_black_layer_timer_.Stop();
}
- // Returns true if the given set of containers was last animated with
- // |type| (probably; the analysis is fairly ad-hoc).
- bool ContainerGroupIsAnimated(ContainerGroup group,
- AnimationType type) const;
+ // Returns true if containers of a given |container_mask|
+ // were last animated with |type| (probably; the analysis is fairly ad-hoc).
+ // |container_mask| is a bitfield of a Container.
+ bool ContainersAreAnimated(int container_mask, AnimationType type) const;
- // Returns true if |background_layer_| is non-NULL and visible.
- bool BackgroundLayerIsVisible() const;
+ // Returns true if |black_layer_| is non-NULL and visible.
+ bool BlackLayerIsVisible() const;
- // Returns |background_layer_|'s bounds, or an empty rect if the layer is
+ // Returns |black_layer_|'s bounds, or an empty rect if the layer is
// NULL.
- gfx::Rect GetBackgroundLayerBounds() const;
+ gfx::Rect GetBlackLayerBounds() const;
private:
PowerButtonController* controller_; // not owned
@@ -130,6 +144,13 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
DISALLOW_COPY_AND_ASSIGN(TestApi);
};
+ // Helper method that returns a bitfield mask of all containers.
+ static int GetAllContainersMask();
+
+ // Helper method that returns a bitfield mask including LOCK_SCREEN_WALLPAPER,
+ // LOCK_SCREEN_CONTAINERS, and LOCK_SCREEN_RELATED_CONTAINERS.
+ static int GetAllLockScreenContainersMask();
+
PowerButtonController();
virtual ~PowerButtonController();
@@ -190,10 +211,10 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
// Displays the shutdown animation and starts |real_shutdown_timer_|.
void StartShutdownAnimationAndRequestShutdown();
- // Shows or hides |background_layer_|. The show method creates and
+ // Shows or hides |black_layer_|. The show method creates and
// initializes the layer if it doesn't already exist.
- void ShowBackgroundLayer();
- void HideBackgroundLayer();
+ void ShowBlackLayer();
+ void HideBlackLayer();
scoped_ptr<PowerButtonControllerDelegate> delegate_;
@@ -213,10 +234,6 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
// Are we in the process of shutting the machine down?
bool shutting_down_;
- // Should we start |shutdown_timer_| when we receive notification that the
- // screen has been locked?
- bool should_start_shutdown_timer_after_lock_;
-
// Was a command-line switch set telling us that we're running on hardware
// that misreports power button releases?
bool has_legacy_power_button_;
@@ -226,7 +243,7 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
// TODO(derat): Remove this in favor of having the compositor only clear the
// viewport when there are regions not covered by a layer:
// http://crbug.com/113445
- scoped_ptr<ui::Layer> background_layer_;
+ scoped_ptr<ui::Layer> black_layer_;
// Started when the user first presses the power button while in a
// logged-in-as-a-non-guest-user, unlocked state. When it fires, we lock the
@@ -252,9 +269,9 @@ class ASH_EXPORT PowerButtonController : public aura::RootWindowObserver,
base::OneShotTimer<PowerButtonController> real_shutdown_timer_;
// Started when we abort the pre-lock state. When it fires, we hide
- // |background_layer_|, as the desktop background is now covering the whole
+ // |black_layer_|, as the desktop background is now covering the whole
// screen.
- base::OneShotTimer<PowerButtonController> hide_background_layer_timer_;
+ base::OneShotTimer<PowerButtonController> hide_black_layer_timer_;
DISALLOW_COPY_AND_ASSIGN(PowerButtonController);
};

Powered by Google App Engine
This is Rietveld 408576698