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

Unified Diff: chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc

Issue 890293002: Fixing crash upon window manager creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698