Chromium Code Reviews| Index: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| index 43e92626217fa1abf39fb7a986b1443f40e369d2..d910c4067a9b0ad36542c1f62c17a9411f2d410f 100644 |
| --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc |
| @@ -215,20 +215,6 @@ MultiUserWindowManagerChromeOS::MultiUserWindowManagerChromeOS( |
| message_center::MessageCenter::Get(), current_user_id)), |
| suppress_visibility_changes_(false), |
| animation_speed_(ANIMATION_SPEED_NORMAL) { |
| - // Add a session state observer to be able to monitor session changes. |
| - if (ash::Shell::HasInstance()) |
| - ash::Shell::GetInstance()->session_state_delegate()-> |
| - AddSessionStateObserver(this); |
| - |
| - // The BrowserListObserver would have been better to use then the old |
| - // notification system, but that observer fires before the window got created. |
| - registrar_.Add(this, NOTIFICATION_BROWSER_WINDOW_READY, |
| - content::NotificationService::AllSources()); |
| - |
| - // Add an app window observer & all already running apps. |
| - Profile* profile = multi_user_util::GetProfileFromUserID(current_user_id); |
| - if (profile) |
| - AddUser(profile); |
| } |
| MultiUserWindowManagerChromeOS::~MultiUserWindowManagerChromeOS() { |
| @@ -264,6 +250,27 @@ MultiUserWindowManagerChromeOS::~MultiUserWindowManagerChromeOS() { |
| RemoveSessionStateObserver(this); |
| } |
| +void MultiUserWindowManagerChromeOS::Init() { |
| + // We should call this function only once. |
| + DCHECK(user_id_to_app_observer_.find(current_user_id_) == |
| + user_id_to_app_observer_.end()); |
|
stevenjb
2015/02/03 01:31:58
nit: This only actually ensures that we don't call
Mr4D (OOO till 08-26)
2015/02/03 02:06:05
We add the observer as well - so it is not only th
|
| + |
| + // Add a session state observer to be able to monitor session changes. |
| + if (ash::Shell::HasInstance()) |
| + ash::Shell::GetInstance()->session_state_delegate()-> |
| + AddSessionStateObserver(this); |
|
stevenjb
2015/02/03 01:31:58
nit: {}
Mr4D (OOO till 08-26)
2015/02/03 02:06:05
Done.
|
| + |
| + // The BrowserListObserver would have been better to use then the old |
| + // notification system, but that observer fires before the window got created. |
| + registrar_.Add(this, NOTIFICATION_BROWSER_WINDOW_READY, |
| + content::NotificationService::AllSources()); |
| + |
| + // Add an app window observer & all already running apps. |
| + Profile* profile = multi_user_util::GetProfileFromUserID(current_user_id_); |
| + if (profile) |
| + AddUser(profile); |
| +} |
| + |
| void MultiUserWindowManagerChromeOS::SetWindowOwner( |
| aura::Window* window, |
| const std::string& user_id) { |