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

Side by Side Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h

Issue 227243002: Revert of 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "ash/session_state_observer.h" 11 #include "ash/session_state_observer.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "base/timer/timer.h"
15 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 16 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
16 #include "content/public/browser/notification_observer.h" 17 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 18 #include "content/public/browser/notification_registrar.h"
18 #include "ui/aura/window_observer.h" 19 #include "ui/aura/window_observer.h"
19 #include "ui/wm/core/transient_window_observer.h" 20 #include "ui/wm/core/transient_window_observer.h"
20 21
21 class Browser; 22 class Browser;
22 class MultiUserNotificationBlockerChromeOS; 23 class MultiUserNotificationBlockerChromeOS;
23 class MultiUserNotificationBlockerChromeOSTest; 24 class MultiUserNotificationBlockerChromeOSTest;
24 25
25 namespace content { 26 namespace content {
26 class BrowserContext; 27 class BrowserContext;
27 } 28 }
28 29
29 namespace aura { 30 namespace aura {
30 class Window; 31 class Window;
31 } // namespace aura 32 } // namespace aura
32 33
33 namespace ash { 34 namespace ash {
34 namespace test { 35 namespace test {
35 class MultiUserWindowManagerChromeOSTest; 36 class MultiUserWindowManagerChromeOSTest;
36 } // namespace test 37 } // namespace test
37 } // namespace ash 38 } // namespace ash
38 39
39 namespace chrome { 40 namespace chrome {
40 41
41 class AppObserver; 42 class AppObserver;
42 class UserSwichAnimatorChromeOS;
43 43
44 // This ChromeOS implementation of the MultiUserWindowManager interface is 44 // This ChromeOS implementation of the MultiUserWindowManager interface is
45 // detecting app and browser creations, tagging their windows automatically and 45 // detecting app and browser creations, tagging their windows automatically and
46 // using (currently) show and hide to make the owned windows visible - or not. 46 // using (currently) show and hide to make the owned windows visible - or not.
47 // If it becomes necessary, the function |SetWindowVisibility| can be 47 // If it becomes necessary, the function |SetWindowVisibility| can be
48 // overwritten to match new ways of doing this. 48 // overwritten to match new ways of doing this.
49 // Note: 49 // Note:
50 // - aura::Window::Hide() is currently hiding the window and all owned transient 50 // - aura::Window::Hide() is currently hiding the window and all owned transient
51 // children. However aura::Window::Show() is only showing the window itself. 51 // children. However aura::Window::Show() is only showing the window itself.
52 // To address that, all transient children (and their children) are remembered 52 // To address that, all transient children (and their children) are remembered
(...skipping 52 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 protected: 115 private:
116 friend class UserSwichAnimatorChromeOS; 116 friend class ::MultiUserNotificationBlockerChromeOSTest;
117 friend class ash::test::MultiUserWindowManagerChromeOSTest;
117 118
118 class WindowEntry { 119 class WindowEntry {
119 public: 120 public:
120 explicit WindowEntry(const std::string& user_id) 121 explicit WindowEntry(const std::string& user_id)
121 : owner_(user_id), 122 : owner_(user_id),
122 show_for_user_(user_id), 123 show_for_user_(user_id),
123 show_(true) {} 124 show_(true) {}
124 virtual ~WindowEntry() {} 125 virtual ~WindowEntry() {}
125 126
126 // Returns the owner of this window. This cannot be changed. 127 // Returns the owner of this window. This cannot be changed.
(...skipping 21 matching lines...) Expand all
148 // The user id of the user on which desktop the window gets shown. 149 // The user id of the user on which desktop the window gets shown.
149 std::string show_for_user_; 150 std::string show_for_user_;
150 151
151 // True if the window should be visible for the user which shows the window. 152 // True if the window should be visible for the user which shows the window.
152 bool show_; 153 bool show_;
153 154
154 DISALLOW_COPY_AND_ASSIGN(WindowEntry); 155 DISALLOW_COPY_AND_ASSIGN(WindowEntry);
155 }; 156 };
156 157
157 typedef std::map<aura::Window*, WindowEntry*> WindowToEntryMap; 158 typedef std::map<aura::Window*, WindowEntry*> WindowToEntryMap;
159 typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver;
160 typedef std::map<aura::Window*, bool> TransientWindowToVisibility;
161
162 // The animation step for the user change animation. First the old user gets
163 // hidden and then the new one gets presented.
164 enum AnimationStep {
165 HIDE_OLD_USER,
166 SHOW_NEW_USER
167 };
158 168
159 // Show a window for a user without switching the user. 169 // Show a window for a user without switching the user.
160 // Returns true when the window moved to a new desktop. 170 // Returns true when the window moved to a new desktop.
161 bool ShowWindowForUserIntern(aura::Window* window, 171 bool ShowWindowForUserIntern(aura::Window* window,
162 const std::string& user_id); 172 const std::string& user_id);
163 173
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.
186 void AddBrowserWindow(Browser* browser);
187
164 // Show / hide the given window. Note: By not doing this within the functions, 188 // Show / hide the given window. Note: By not doing this within the functions,
165 // this allows to either switching to different ways to show/hide and / or to 189 // this allows to either switching to different ways to show/hide and / or to
166 // distinguish state changes performed by this class vs. state changes 190 // distinguish state changes performed by this class vs. state changes
167 // performed by the others. Note furthermore that system modal dialogs will 191 // performed by the others. Note furthermore that system modal dialogs will
168 // not get hidden. We will switch instead to the owners desktop. 192 // not get hidden. We will switch instead to the owners desktop.
169 // The |animation_time_in_ms| is the time the animation should take. Set to 0 193 // The |animation_time_in_ms| is the time the animation should take. Set to 0
170 // if it should get set instantly. 194 // if it should get set instantly.
171 void SetWindowVisibility(aura::Window* window, 195 void SetWindowVisibility(aura::Window* window,
172 bool visible, 196 bool visible,
173 int animation_time_in_ms); 197 int animation_time_in_ms);
174 198
175 const WindowToEntryMap& window_to_entry() { return window_to_entry_; }
176 MultiUserNotificationBlockerChromeOS* notification_blocker() {
177 return notification_blocker_.get();
178 }
179
180 private:
181 friend class ::MultiUserNotificationBlockerChromeOSTest;
182 friend class ash::test::MultiUserWindowManagerChromeOSTest;
183
184 typedef std::map<std::string, AppObserver*> UserIDToAppWindowObserver;
185 typedef std::map<aura::Window*, bool> TransientWindowToVisibility;
186
187 // Add a browser window to the system so that the owner can be remembered.
188 void AddBrowserWindow(Browser* browser);
189
190 // Show the window and its transient children. However - if a transient child 199 // Show the window and its transient children. However - if a transient child
191 // was turned invisible by some other operation, it will stay invisible. 200 // was turned invisible by some other operation, it will stay invisible.
192 // Use the given |animation_time_in_ms| for transitioning. 201 // Use the given |animation_time_in_ms| for transitioning.
193 void ShowWithTransientChildrenRecursive(aura::Window* window, 202 void ShowWithTransientChildrenRecursive(aura::Window* window,
194 int animation_time_in_ms); 203 int animation_time_in_ms);
195 204
196 // Find the first owned window in the chain. 205 // Find the first owned window in the chain.
197 // Returns NULL when the window itself is owned. 206 // Returns NULL when the window itself is owned.
198 aura::Window* GetOwningWindowInTransientChain(aura::Window* window); 207 aura::Window* GetOwningWindowInTransientChain(aura::Window* window);
199 208
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // The notification registrar to track the creation of browser windows. 246 // The notification registrar to track the creation of browser windows.
238 content::NotificationRegistrar registrar_; 247 content::NotificationRegistrar registrar_;
239 248
240 // Suppress changes to the visibility flag while we are changing it ourselves. 249 // Suppress changes to the visibility flag while we are changing it ourselves.
241 bool suppress_visibility_changes_; 250 bool suppress_visibility_changes_;
242 251
243 // Caching the current multi profile mode since the detection which mode is 252 // Caching the current multi profile mode since the detection which mode is
244 // used is quite expensive. 253 // used is quite expensive.
245 static MultiProfileMode multi_user_mode_; 254 static MultiProfileMode multi_user_mode_;
246 255
256 // 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.
258 scoped_ptr<base::Timer> user_changed_animation_timer_;
259
247 // If true, all animations will be suppressed. 260 // If true, all animations will be suppressed.
248 bool animations_disabled_; 261 bool animations_disabled_;
249 262
250 // The animation between users.
251 scoped_ptr<UserSwichAnimatorChromeOS> animation_;
252
253 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); 263 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS);
254 }; 264 };
255 265
256 } // namespace chrome 266 } // namespace chrome
257 267
258 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H _ 268 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698