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

Unified Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h

Issue 223823004: Improving the user transition to add special cases for maximized windows and make the transition "m… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
index 644d5ca3f8b52ee1d0e45fce495ba75e402935de..793e715097ea7f7c8446207b7c56076104b5fc8a 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h
@@ -112,6 +112,11 @@ class MultiUserWindowManagerChromeOS
// Returns the current user for unit tests.
const std::string& GetCurrentUserForTest();
+ // Returns the user id for which the wallpaper is currently shown.
+ // If a wallpaper is transitioning from A to B it will be returned as
+ // "A->B".
+ const std::string& GetWallaperUserIdForTest() { return wallpaper_user_id_; }
+
private:
friend class ::MultiUserNotificationBlockerChromeOSTest;
friend class ash::test::MultiUserWindowManagerChromeOSTest;
@@ -159,11 +164,23 @@ class MultiUserWindowManagerChromeOS
typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver;
typedef std::map<aura::Window*, bool> TransientWindowToVisibility;
- // The animation step for the user change animation. First the old user gets
- // hidden and then the new one gets presented.
+ // The animation step for the user change animation.
enum AnimationStep {
- HIDE_OLD_USER,
- SHOW_NEW_USER
+ ANIMATION_STEP_HIDE_OLD_USER, // Hiding the old user (and shelf).
+ ANIMATION_STEP_SHOW_NEW_USER, // Show the shelf of the new user.
+ ANIMATION_STEP_FINALIZE, // All animations are done - final cleanup.
+ ANIMATION_STEP_ENDED // The animation has ended.
+ };
oshima 2014/04/03 19:21:41 I like this design.
+
+ // The window configuration of screen covering windows before an animation.
+ enum TransitioningScreenCover {
+ NO_USER_COVERS_SCREEN, // No window covers the entire screen.
+ OLD_USER_COVERS_SCREEN, // The current user has at least one window
+ // covering the entire screen.
+ NEW_USER_COVERS_SCREEN, // The user which becomes active has at least one
+ // window covering the entire screen.
+ BOTH_USERS_COVER_SCREEN // Both users have at least one window each
+ // covering the entire screen.
};
// Show a window for a user without switching the user.
@@ -171,17 +188,6 @@ class MultiUserWindowManagerChromeOS
bool ShowWindowForUserIntern(aura::Window* window,
const std::string& user_id);
- // Start the user change animation required for |animation_step|.
- // Note that a call with SHOW_NEW_USER will finalize the animation and kill
- // the timer (if there is one).
- void TransitionUser(AnimationStep animtion_step);
-
- // Start the user wallpaper animations.
- void TransitionWallpaper(AnimationStep animtion_step);
-
- // Start the user shelf animations.
- void TransitionUserShelf(AnimationStep animtion_step);
-
// Add a browser window to the system so that the owner can be remembered.
void AddBrowserWindow(Browser* browser);
@@ -221,6 +227,32 @@ class MultiUserWindowManagerChromeOS
bool visible,
int aimation_time_in_ms);
+ // Start a transition animation for the current user to the new |user_id|.
+ // Any ongoing transition animations get automatically finished first.
+ void StartUserTransitionAnimation(const std::string& user_id);
+
+ // Advances the user switch animation to the next step. It reads the current
+ // step from |animation_step_| and increments it thereafter. When
+ // |ANIMATION_STEP_FINALIZE| gets executed, the animation is finished and the
+ // timer (if one exists) will get destroyed.
+ void AdvanceUserTransitionAnimation();
+
+ // Execute the user wallpaper animations for |animation_step|.
+ void TransitionWallpaper(AnimationStep animtion_step);
+
+ // Execute the user shelf animations for |animation_step|.
+ void TransitionUserShelf(AnimationStep animtion_step);
+
+ // Execute the window animations for |animation_step|.
+ void TransitionWindows(AnimationStep animation_step);
+
+ // Check if a window is maximized / fullscreen / covering the entire screen.
+ // TODO(skuhne): We might want to do this on a per screen basis.
+ TransitioningScreenCover GetScreenCover();
+
+ // Check if a window is covering the entire work area of the screen it is on.
+ bool CoversScreen(aura::Window* window);
+
// A lookup to see to which user the given window belongs to, where and if it
// should get shown.
WindowToEntryMap window_to_entry_;
@@ -257,9 +289,18 @@ class MultiUserWindowManagerChromeOS
// animation. Note that this timer exists only during such an animation.
scoped_ptr<base::Timer> user_changed_animation_timer_;
+ // The screen cover status before the animation has started.
+ TransitioningScreenCover screen_cover_;
+
+ // The next animation step for AdvanceUserTransitionAnimation().
+ AnimationStep animation_step_;
+
// If true, all animations will be suppressed.
bool animations_disabled_;
+ // For unit tests: Check which wallpaper was set.
+ std::string wallpaper_user_id_;
+
DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS);
};

Powered by Google App Engine
This is Rietveld 408576698