Restore last used user session after crash
Since primary user profile is loaded synchronously its session will always show up first. Once all users profiles have been loaded we'll switch to the session of the user that was active before crash has happened.
BUG=409226
Review URL: https://codereview.chromium.org/594163002
Cr-Commit-Position: refs/heads/master@{#296907}
diff --git a/components/user_manager/user_manager_base.h b/components/user_manager/user_manager_base.h
index b117687..9da1cee8 100644
--- a/components/user_manager/user_manager_base.h
+++ b/components/user_manager/user_manager_base.h
@@ -52,6 +52,7 @@
const std::string& user_id_hash,
bool browser_restart) OVERRIDE;
virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE;
+ virtual void SwitchToLastActiveUser() OVERRIDE;
virtual void SessionStarted() OVERRIDE;
virtual void RemoveUser(const std::string& user_id,
RemoveUserDelegate* delegate) OVERRIDE;
@@ -369,6 +370,12 @@
// as soon as user's profile is loaded.
std::string pending_user_switch_;
+ // ID of the user that was active in the previous session.
+ // Preference value is stored here before first user signs in
+ // because pref will be overidden once session restore starts.
+ std::string last_session_active_user_;
+ bool last_session_active_user_initialized_;
+
// TaskRunner for UI thread.
scoped_refptr<base::TaskRunner> task_runner_;