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

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

Issue 232133003: Fixing too long running unit tests on valgrind (produced by user switch animation) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self nit 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // visibility changes from the owning user. This way the visibility can be 54 // visibility changes from the owning user. This way the visibility can be
55 // changed back to its requested state upon showing by us - or when the window 55 // changed back to its requested state upon showing by us - or when the window
56 // gets detached from its current owning parent. 56 // gets detached from its current owning parent.
57 class MultiUserWindowManagerChromeOS 57 class MultiUserWindowManagerChromeOS
58 : public MultiUserWindowManager, 58 : public MultiUserWindowManager,
59 public ash::SessionStateObserver, 59 public ash::SessionStateObserver,
60 public aura::WindowObserver, 60 public aura::WindowObserver,
61 public content::NotificationObserver, 61 public content::NotificationObserver,
62 public wm::TransientWindowObserver { 62 public wm::TransientWindowObserver {
63 public: 63 public:
64 // The speed which should be used to perform animations.
65 enum AnimationSpeed {
66 ANIMATION_SPEED_NORMAL, // The normal animation speed.
67 ANIMATION_SPEED_FAST, // Unit test speed which test animations.
68 ANIMATION_SPEED_DISABLED // Unit tests which do not require animations.
69 };
70
64 // Create the manager and use |active_user_id| as the active user. 71 // Create the manager and use |active_user_id| as the active user.
65 explicit MultiUserWindowManagerChromeOS(const std::string& active_user_id); 72 explicit MultiUserWindowManagerChromeOS(const std::string& active_user_id);
66 virtual ~MultiUserWindowManagerChromeOS(); 73 virtual ~MultiUserWindowManagerChromeOS();
67 74
68 // MultiUserWindowManager overrides: 75 // MultiUserWindowManager overrides:
69 virtual void SetWindowOwner( 76 virtual void SetWindowOwner(
70 aura::Window* window, const std::string& user_id) OVERRIDE; 77 aura::Window* window, const std::string& user_id) OVERRIDE;
71 virtual const std::string& GetWindowOwner(aura::Window* window) OVERRIDE; 78 virtual const std::string& GetWindowOwner(aura::Window* window) OVERRIDE;
72 virtual void ShowWindowForUser( 79 virtual void ShowWindowForUser(
73 aura::Window* window, const std::string& user_id) OVERRIDE; 80 aura::Window* window, const std::string& user_id) OVERRIDE;
(...skipping 23 matching lines...) Expand all
97 aura::Window* transient) OVERRIDE; 104 aura::Window* transient) OVERRIDE;
98 virtual void OnTransientChildRemoved(aura::Window* window, 105 virtual void OnTransientChildRemoved(aura::Window* window,
99 aura::Window* transient) OVERRIDE; 106 aura::Window* transient) OVERRIDE;
100 107
101 // content::NotificationObserver overrides: 108 // content::NotificationObserver overrides:
102 virtual void Observe(int type, 109 virtual void Observe(int type,
103 const content::NotificationSource& source, 110 const content::NotificationSource& source,
104 const content::NotificationDetails& details) OVERRIDE; 111 const content::NotificationDetails& details) OVERRIDE;
105 112
106 // Disable any animations for unit tests. 113 // Disable any animations for unit tests.
107 void SetAnimationsForTest(bool disable); 114 void SetAnimationSpeedForTest(AnimationSpeed speed);
108 115
109 // Returns true when a user switch animation is running. For unit tests. 116 // Returns true when a user switch animation is running. For unit tests.
110 bool IsAnimationRunningForTest(); 117 bool IsAnimationRunningForTest();
111 118
112 // Returns the current user for unit tests. 119 // Returns the current user for unit tests.
113 const std::string& GetCurrentUserForTest(); 120 const std::string& GetCurrentUserForTest();
114 121
115 protected: 122 protected:
116 friend class UserSwichAnimatorChromeOS; 123 friend class UserSwichAnimatorChromeOS;
117 124
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 212
206 // A window and its children were removed from its parent and can be 213 // A window and its children were removed from its parent and can be
207 // unregistered. 214 // unregistered.
208 void RemoveTransientOwnerRecursive(aura::Window* window); 215 void RemoveTransientOwnerRecursive(aura::Window* window);
209 216
210 // Animate a |window| to be |visible| in |animation_time_in_ms|. 217 // Animate a |window| to be |visible| in |animation_time_in_ms|.
211 void SetWindowVisible(aura::Window* window, 218 void SetWindowVisible(aura::Window* window,
212 bool visible, 219 bool visible,
213 int aimation_time_in_ms); 220 int aimation_time_in_ms);
214 221
222 // Get the animation time in milliseconds dependent on the |AnimationSpeed|
223 // from the passed |default_time_in_ms|.
224 int GetAdjustedAnimationTimeInMS(int default_time_in_ms);
225
215 // A lookup to see to which user the given window belongs to, where and if it 226 // A lookup to see to which user the given window belongs to, where and if it
216 // should get shown. 227 // should get shown.
217 WindowToEntryMap window_to_entry_; 228 WindowToEntryMap window_to_entry_;
218 229
219 // A list of all known users and their app window observers. 230 // A list of all known users and their app window observers.
220 UserIDToAppWindowObserver user_id_to_app_observer_; 231 UserIDToAppWindowObserver user_id_to_app_observer_;
221 232
222 // An observer list to be notified upon window owner changes. 233 // An observer list to be notified upon window owner changes.
223 ObserverList<Observer> observers_; 234 ObserverList<Observer> observers_;
224 235
(...skipping 12 matching lines...) Expand all
237 // The notification registrar to track the creation of browser windows. 248 // The notification registrar to track the creation of browser windows.
238 content::NotificationRegistrar registrar_; 249 content::NotificationRegistrar registrar_;
239 250
240 // Suppress changes to the visibility flag while we are changing it ourselves. 251 // Suppress changes to the visibility flag while we are changing it ourselves.
241 bool suppress_visibility_changes_; 252 bool suppress_visibility_changes_;
242 253
243 // Caching the current multi profile mode since the detection which mode is 254 // Caching the current multi profile mode since the detection which mode is
244 // used is quite expensive. 255 // used is quite expensive.
245 static MultiProfileMode multi_user_mode_; 256 static MultiProfileMode multi_user_mode_;
246 257
247 // If true, all animations will be suppressed. 258 // The speed which is used to perform any animations.
248 bool animations_disabled_; 259 AnimationSpeed animation_speed_;
249 260
250 // The animation between users. 261 // The animation between users.
251 scoped_ptr<UserSwichAnimatorChromeOS> animation_; 262 scoped_ptr<UserSwichAnimatorChromeOS> animation_;
252 263
253 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS); 264 DISALLOW_COPY_AND_ASSIGN(MultiUserWindowManagerChromeOS);
254 }; 265 };
255 266
256 } // namespace chrome 267 } // namespace chrome
257 268
258 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H _ 269 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_CHROMEOS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698