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

Side by Side 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, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Disable any animations for unit tests. 106 // Disable any animations for unit tests.
107 void SetAnimationsForTest(bool disable); 107 void SetAnimationsForTest(bool disable);
108 108
109 // Returns true when a user switch animation is running. For unit tests. 109 // Returns true when a user switch animation is running. For unit tests.
110 bool IsAnimationRunningForTest(); 110 bool IsAnimationRunningForTest();
111 111
112 // Returns the current user for unit tests. 112 // Returns the current user for unit tests.
113 const std::string& GetCurrentUserForTest(); 113 const std::string& GetCurrentUserForTest();
114 114
115 // Returns the user id for which the wallpaper is currently shown.
116 // If a wallpaper is transitioning from A to B it will be returned as
117 // "A->B".
118 const std::string& GetWallaperUserIdForTest() { return wallpaper_user_id_; }
119
115 private: 120 private:
116 friend class ::MultiUserNotificationBlockerChromeOSTest; 121 friend class ::MultiUserNotificationBlockerChromeOSTest;
117 friend class ash::test::MultiUserWindowManagerChromeOSTest; 122 friend class ash::test::MultiUserWindowManagerChromeOSTest;
118 123
119 class WindowEntry { 124 class WindowEntry {
120 public: 125 public:
121 explicit WindowEntry(const std::string& user_id) 126 explicit WindowEntry(const std::string& user_id)
122 : owner_(user_id), 127 : owner_(user_id),
123 show_for_user_(user_id), 128 show_for_user_(user_id),
124 show_(true) {} 129 show_(true) {}
(...skipping 27 matching lines...) Expand all
152 // True if the window should be visible for the user which shows the window. 157 // True if the window should be visible for the user which shows the window.
153 bool show_; 158 bool show_;
154 159
155 DISALLOW_COPY_AND_ASSIGN(WindowEntry); 160 DISALLOW_COPY_AND_ASSIGN(WindowEntry);
156 }; 161 };
157 162
158 typedef std::map<aura::Window*, WindowEntry*> WindowToEntryMap; 163 typedef std::map<aura::Window*, WindowEntry*> WindowToEntryMap;
159 typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver; 164 typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver;
160 typedef std::map<aura::Window*, bool> TransientWindowToVisibility; 165 typedef std::map<aura::Window*, bool> TransientWindowToVisibility;
161 166
162 // The animation step for the user change animation. First the old user gets 167 // The animation step for the user change animation.
163 // hidden and then the new one gets presented.
164 enum AnimationStep { 168 enum AnimationStep {
165 HIDE_OLD_USER, 169 ANIMATION_STEP_HIDE_OLD_USER, // Hiding the old user (and shelf).
166 SHOW_NEW_USER 170 ANIMATION_STEP_SHOW_NEW_USER, // Show the shelf of the new user.
171 ANIMATION_STEP_FINALIZE, // All animations are done - final cleanup.
172 ANIMATION_STEP_ENDED // The animation has ended.
173 };
oshima 2014/04/03 19:21:41 I like this design.
174
175 // The window configuration of screen covering windows before an animation.
176 enum TransitioningScreenCover {
177 NO_USER_COVERS_SCREEN, // No window covers the entire screen.
178 OLD_USER_COVERS_SCREEN, // The current user has at least one window
179 // covering the entire screen.
180 NEW_USER_COVERS_SCREEN, // The user which becomes active has at least one
181 // window covering the entire screen.
182 BOTH_USERS_COVER_SCREEN // Both users have at least one window each
183 // covering the entire screen.
167 }; 184 };
168 185
169 // Show a window for a user without switching the user. 186 // Show a window for a user without switching the user.
170 // Returns true when the window moved to a new desktop. 187 // Returns true when the window moved to a new desktop.
171 bool ShowWindowForUserIntern(aura::Window* window, 188 bool ShowWindowForUserIntern(aura::Window* window,
172 const std::string& user_id); 189 const std::string& user_id);
173 190
174 // Start the user change animation required for |animation_step|.
175 // Note that a call with SHOW_NEW_USER will finalize the animation and kill
176 // the timer (if there is one).
177 void TransitionUser(AnimationStep animtion_step);
178
179 // Start the user wallpaper animations.
180 void TransitionWallpaper(AnimationStep animtion_step);
181
182 // Start the user shelf animations.
183 void TransitionUserShelf(AnimationStep animtion_step);
184
185 // Add a browser window to the system so that the owner can be remembered. 191 // Add a browser window to the system so that the owner can be remembered.
186 void AddBrowserWindow(Browser* browser); 192 void AddBrowserWindow(Browser* browser);
187 193
188 // Show / hide the given window. Note: By not doing this within the functions, 194 // Show / hide the given window. Note: By not doing this within the functions,
189 // this allows to either switching to different ways to show/hide and / or to 195 // this allows to either switching to different ways to show/hide and / or to
190 // distinguish state changes performed by this class vs. state changes 196 // distinguish state changes performed by this class vs. state changes
191 // performed by the others. Note furthermore that system modal dialogs will 197 // performed by the others. Note furthermore that system modal dialogs will
192 // not get hidden. We will switch instead to the owners desktop. 198 // not get hidden. We will switch instead to the owners desktop.
193 // The |animation_time_in_ms| is the time the animation should take. Set to 0 199 // The |animation_time_in_ms| is the time the animation should take. Set to 0
194 // if it should get set instantly. 200 // if it should get set instantly.
(...skipping 19 matching lines...) Expand all
214 220
215 // A window and its children were removed from its parent and can be 221 // A window and its children were removed from its parent and can be
216 // unregistered. 222 // unregistered.
217 void RemoveTransientOwnerRecursive(aura::Window* window); 223 void RemoveTransientOwnerRecursive(aura::Window* window);
218 224
219 // Animate a |window| to be |visible| in |animation_time_in_ms|. 225 // Animate a |window| to be |visible| in |animation_time_in_ms|.
220 void SetWindowVisible(aura::Window* window, 226 void SetWindowVisible(aura::Window* window,
221 bool visible, 227 bool visible,
222 int aimation_time_in_ms); 228 int aimation_time_in_ms);
223 229
230 // Start a transition animation for the current user to the new |user_id|.
231 // Any ongoing transition animations get automatically finished first.
232 void StartUserTransitionAnimation(const std::string& user_id);
233
234 // Advances the user switch animation to the next step. It reads the current
235 // step from |animation_step_| and increments it thereafter. When
236 // |ANIMATION_STEP_FINALIZE| gets executed, the animation is finished and the
237 // timer (if one exists) will get destroyed.
238 void AdvanceUserTransitionAnimation();
239
240 // Execute the user wallpaper animations for |animation_step|.
241 void TransitionWallpaper(AnimationStep animtion_step);
242
243 // Execute the user shelf animations for |animation_step|.
244 void TransitionUserShelf(AnimationStep animtion_step);
245
246 // Execute the window animations for |animation_step|.
247 void TransitionWindows(AnimationStep animation_step);
248
249 // Check if a window is maximized / fullscreen / covering the entire screen.
250 // TODO(skuhne): We might want to do this on a per screen basis.
251 TransitioningScreenCover GetScreenCover();
252
253 // Check if a window is covering the entire work area of the screen it is on.
254 bool CoversScreen(aura::Window* window);
255
224 // A lookup to see to which user the given window belongs to, where and if it 256 // A lookup to see to which user the given window belongs to, where and if it
225 // should get shown. 257 // should get shown.
226 WindowToEntryMap window_to_entry_; 258 WindowToEntryMap window_to_entry_;
227 259
228 // A list of all known users and their app window observers. 260 // A list of all known users and their app window observers.
229 UserIDToAppWindowObserver user_id_to_app_observer_; 261 UserIDToAppWindowObserver user_id_to_app_observer_;
230 262
231 // An observer list to be notified upon window owner changes. 263 // An observer list to be notified upon window owner changes.
232 ObserverList<Observer> observers_; 264 ObserverList<Observer> observers_;
233 265
(...skipping 16 matching lines...) Expand all
250 bool suppress_visibility_changes_; 282 bool suppress_visibility_changes_;
251 283
252 // Caching the current multi profile mode since the detection which mode is 284 // Caching the current multi profile mode since the detection which mode is
253 // used is quite expensive. 285 // used is quite expensive.
254 static MultiProfileMode multi_user_mode_; 286 static MultiProfileMode multi_user_mode_;
255 287
256 // A timer which watches to executes the second part of a "user changed" 288 // A timer which watches to executes the second part of a "user changed"
257 // animation. Note that this timer exists only during such an animation. 289 // animation. Note that this timer exists only during such an animation.
258 scoped_ptr<base::Timer> user_changed_animation_timer_; 290 scoped_ptr<base::Timer> user_changed_animation_timer_;
259 291
292 // The screen cover status before the animation has started.
293 TransitioningScreenCover screen_cover_;
294
295 // The next animation step for AdvanceUserTransitionAnimation().
296 AnimationStep animation_step_;
297
260 // If true, all animations will be suppressed. 298 // If true, all animations will be suppressed.
261 bool animations_disabled_; 299 bool animations_disabled_;
262 300
301 // For unit tests: Check which wallpaper was set.
302 std::string wallpaper_user_id_;
303
263 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); 304 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS);
264 }; 305 };
265 306
266 } // namespace chrome 307 } // namespace chrome
267 308
268 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H _ 309 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698