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

Unified Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 252563007: End session on crash if current device-local account no longer exists (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Whitespace fix. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/chrome_browser_main_chromeos.cc
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
index cace86b39217b1e6eb2d8df89416965c23ea2d49..78ec16bd1627edd1550dfd855493ed53d4ef8abd 100644
--- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
+++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -67,6 +67,7 @@
#include "chrome/browser/chromeos/system/input_device_settings.h"
#include "chrome/browser/chromeos/upgrade_detector_chromeos.h"
#include "chrome/browser/defaults.h"
+#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/chrome_network_delegate.h"
#include "chrome/browser/profiles/profile.h"
@@ -521,15 +522,28 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() {
ChromeBrowserMainPartsLinux::PreProfileInit();
if (immediate_login) {
- std::string username =
+ const std::string user_id =
parsed_command_line().GetSwitchValueASCII(switches::kLoginUser);
UserManager* user_manager = UserManager::Get();
+
+ if (policy::IsDeviceLocalAccountUser(user_id, NULL) &&
+ !user_manager->IsKnownUser(user_id)) {
+ // When a device-local account is removed, its policy is deleted from disk
+ // immediately. If a session using this account happens to be in progress,
+ // the session is allowed to continue with policy served from an in-memory
+ // cache. If Chrome crashes later in the session, the policy becomes
+ // completely unavailable. Exit the session in that case, rather than
+ // allowing it to continue without policy.
+ chrome::AttemptUserExit();
+ return;
+ }
+
// In case of multi-profiles --login-profile will contain user_id_hash.
- std::string username_hash =
+ std::string user_id_hash =
parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile);
- user_manager->UserLoggedIn(username, username_hash, true);
- VLOG(1) << "Relaunching browser for user: " << username
- << " with hash: " << username_hash;
+ user_manager->UserLoggedIn(user_id, user_id_hash, true);
+ VLOG(1) << "Relaunching browser for user: " << user_id
+ << " with hash: " << user_id_hash;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698