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

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

Issue 1428213004: This CL replaces std::string user_id in ash/* with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_USER_SWITCH_ANIMATOR_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_MULTI_USER_USER_SWITCH_ANIMATOR_CHROMEOS_H_
6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_USER_SWITCH_ANIMATOR_CHROMEOS_H_ 6 #define CHROME_BROWSER_UI_ASH_MULTI_USER_USER_SWITCH_ANIMATOR_CHROMEOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "components/signin/core/account_id/account_id.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 15
15 namespace chrome { 16 namespace chrome {
16 17
17 class MultiUserWindowManagerChromeOS; 18 class MultiUserWindowManagerChromeOS;
18 19
19 // A class which performs transitions animations between users. Upon creation, 20 // A class which performs transitions animations between users. Upon creation,
20 // the animation gets started and upon destruction the animation gets finished 21 // the animation gets started and upon destruction the animation gets finished
21 // if not done yet. 22 // if not done yet.
22 // Specifying |animation_disabled| upon creation will perform the transition 23 // Specifying |animation_disabled| upon creation will perform the transition
23 // without visible animations. 24 // without visible animations.
24 class UserSwitchAnimatorChromeOS { 25 class UserSwitchAnimatorChromeOS {
25 public: 26 public:
26 // The animation step for the user change animation. 27 // The animation step for the user change animation.
27 enum AnimationStep { 28 enum AnimationStep {
28 ANIMATION_STEP_HIDE_OLD_USER, // Hiding the old user (and shelf). 29 ANIMATION_STEP_HIDE_OLD_USER, // Hiding the old user (and shelf).
29 ANIMATION_STEP_SHOW_NEW_USER, // Show the shelf of the new user. 30 ANIMATION_STEP_SHOW_NEW_USER, // Show the shelf of the new user.
30 ANIMATION_STEP_FINALIZE, // All animations are done - final cleanup. 31 ANIMATION_STEP_FINALIZE, // All animations are done - final cleanup.
31 ANIMATION_STEP_ENDED // The animation has ended. 32 ANIMATION_STEP_ENDED // The animation has ended.
32 }; 33 };
33 34
34 UserSwitchAnimatorChromeOS(MultiUserWindowManagerChromeOS* owner, 35 UserSwitchAnimatorChromeOS(MultiUserWindowManagerChromeOS* owner,
35 const std::string& new_user_id, 36 const AccountId& new_account_id,
36 int animation_speed_ms); 37 int animation_speed_ms);
37 ~UserSwitchAnimatorChromeOS(); 38 ~UserSwitchAnimatorChromeOS();
38 39
39 // Check if a window is covering the entire work area of the screen it is on. 40 // Check if a window is covering the entire work area of the screen it is on.
40 static bool CoversScreen(aura::Window* window); 41 static bool CoversScreen(aura::Window* window);
41 42
42 bool IsAnimationFinished() { 43 bool IsAnimationFinished() {
43 return animation_step_ == ANIMATION_STEP_ENDED; 44 return animation_step_ == ANIMATION_STEP_ENDED;
44 } 45 }
45 46
46 // Returns the user id for which the wallpaper is currently shown. 47 // Returns the user id for which the wallpaper is currently shown.
47 // If a wallpaper is transitioning to B it will be returned as "->B". 48 // If a wallpaper is transitioning to B it will be returned as "->B".
48 const std::string& wallpaper_user_id_for_test() { return wallpaper_user_id_; } 49 const std::string& wallpaper_user_id_for_test() {
50 return wallpaper_user_id_for_test_;
51 }
49 52
50 // Advances the user switch animation to the next step. It reads the current 53 // Advances the user switch animation to the next step. It reads the current
51 // step from |animation_step_| and increments it thereafter. When 54 // step from |animation_step_| and increments it thereafter. When
52 // |ANIMATION_STEP_FINALIZE| gets executed, the animation is finished and the 55 // |ANIMATION_STEP_FINALIZE| gets executed, the animation is finished and the
53 // timer (if one exists) will get destroyed. 56 // timer (if one exists) will get destroyed.
54 void AdvanceUserTransitionAnimation(); 57 void AdvanceUserTransitionAnimation();
55 58
56 // When the system is shutting down, the animation can be stopped without 59 // When the system is shutting down, the animation can be stopped without
57 // ending it. 60 // ending it.
58 void CancelAnimation(); 61 void CancelAnimation();
(...skipping 29 matching lines...) Expand all
88 91
89 // Builds the map that a user ID to the list of windows that should be shown 92 // Builds the map that a user ID to the list of windows that should be shown
90 // for this user. This operation happens once upon the construction of this 93 // for this user. This operation happens once upon the construction of this
91 // animation. 94 // animation.
92 void BuildUserToWindowsListMap(); 95 void BuildUserToWindowsListMap();
93 96
94 // The owning window manager. 97 // The owning window manager.
95 MultiUserWindowManagerChromeOS* owner_; 98 MultiUserWindowManagerChromeOS* owner_;
96 99
97 // The new user to set. 100 // The new user to set.
98 std::string new_user_id_; 101 AccountId new_account_id_;
99 102
100 // The animation speed in ms. If 0, animations are disabled. 103 // The animation speed in ms. If 0, animations are disabled.
101 int animation_speed_ms_; 104 int animation_speed_ms_;
102 105
103 // The next animation step for AdvanceUserTransitionAnimation(). 106 // The next animation step for AdvanceUserTransitionAnimation().
104 AnimationStep animation_step_; 107 AnimationStep animation_step_;
105 108
106 // The screen cover status before the animation has started. 109 // The screen cover status before the animation has started.
107 TransitioningScreenCover screen_cover_; 110 TransitioningScreenCover screen_cover_;
108 111
109 // Mapping users IDs to the list of windows to show for these users. 112 // Mapping users IDs to the list of windows to show for these users.
110 typedef std::map<std::string, aura::Window::Windows> UserToWindowsMap; 113 typedef std::map<AccountId, aura::Window::Windows> UserToWindowsMap;
111 UserToWindowsMap windows_by_user_id_; 114 UserToWindowsMap windows_by_account_id_;
112 115
113 // A timer which watches to executes the second part of a "user changed" 116 // A timer which watches to executes the second part of a "user changed"
114 // animation. Note that this timer exists only during such an animation. 117 // animation. Note that this timer exists only during such an animation.
115 scoped_ptr<base::Timer> user_changed_animation_timer_; 118 scoped_ptr<base::Timer> user_changed_animation_timer_;
116 119
117 // For unit tests: Check which wallpaper was set. 120 // For unit tests: Check which wallpaper was set.
118 std::string wallpaper_user_id_; 121 std::string wallpaper_user_id_for_test_;
119 122
120 DISALLOW_COPY_AND_ASSIGN(UserSwitchAnimatorChromeOS); 123 DISALLOW_COPY_AND_ASSIGN(UserSwitchAnimatorChromeOS);
121 }; 124 };
122 125
123 } // namespace chrome 126 } // namespace chrome
124 127
125 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_USER_SWITCH_ANIMATOR_CHROMEOS_H_ 128 #endif // CHROME_BROWSER_UI_ASH_MULTI_USER_USER_SWITCH_ANIMATOR_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698