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

Side by Side Diff: chrome/browser/chromeos/chrome_browser_main_chromeos.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 274 }
275 275
276 // If we're not running on real Chrome OS hardware (or under VM), and are not 276 // If we're not running on real Chrome OS hardware (or under VM), and are not
277 // showing the login manager or attempting a command line login, login with a 277 // showing the login manager or attempting a command line login, login with a
278 // stub user. 278 // stub user.
279 if (!base::SysInfo::IsRunningOnChromeOS() && 279 if (!base::SysInfo::IsRunningOnChromeOS() &&
280 !parsed_command_line().HasSwitch(switches::kLoginManager) && 280 !parsed_command_line().HasSwitch(switches::kLoginManager) &&
281 !parsed_command_line().HasSwitch(switches::kLoginUser) && 281 !parsed_command_line().HasSwitch(switches::kLoginUser) &&
282 !parsed_command_line().HasSwitch(switches::kGuestSession)) { 282 !parsed_command_line().HasSwitch(switches::kGuestSession)) {
283 singleton_command_line->AppendSwitchASCII(switches::kLoginUser, 283 singleton_command_line->AppendSwitchASCII(switches::kLoginUser,
284 chromeos::login::kStubUser); 284 chromeos::login::GetStubUserID().G etUserEmail());
285 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { 285 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) {
286 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, 286 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile,
287 chrome::kTestUserProfileDir); 287 chrome::kTestUserProfileDir);
288 } 288 }
289 LOG(WARNING) << "Running as stub user with profile dir: " 289 LOG(WARNING) << "Running as stub user with profile dir: "
290 << singleton_command_line->GetSwitchValuePath( 290 << singleton_command_line->GetSwitchValuePath(
291 switches::kLoginProfile).value(); 291 switches::kLoginProfile).value();
292 } 292 }
293 293
294 #if defined(GOOGLE_CHROME_BUILD) 294 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 ShouldAutoLaunchKioskApp(parsed_command_line())) { 443 ShouldAutoLaunchKioskApp(parsed_command_line())) {
444 WizardController::SetZeroDelays(); 444 WizardController::SetZeroDelays();
445 } 445 }
446 446
447 power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get())); 447 power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get()));
448 448
449 // In Aura builds this will initialize ash::Shell. 449 // In Aura builds this will initialize ash::Shell.
450 ChromeBrowserMainPartsLinux::PreProfileInit(); 450 ChromeBrowserMainPartsLinux::PreProfileInit();
451 451
452 if (immediate_login) { 452 if (immediate_login) {
453 const std::string user_id = login::CanonicalizeUserID( 453 const user_manager::UserID user_id(std::string() /* gaia_id */, login::Canon icalizeUserID(
Denis Kuznetsov (DE-MUC) 2015/06/10 16:50:45 FromUserEmail()
454 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); 454 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)));
455 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 455 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
456 456
457 if (policy::IsDeviceLocalAccountUser(user_id, NULL) && 457 if (policy::IsDeviceLocalAccountUser(user_id, NULL) &&
458 !user_manager->IsKnownUser(user_id)) { 458 !user_manager->IsKnownUser(user_id)) {
459 // When a device-local account is removed, its policy is deleted from disk 459 // When a device-local account is removed, its policy is deleted from disk
460 // immediately. If a session using this account happens to be in progress, 460 // immediately. If a session using this account happens to be in progress,
461 // the session is allowed to continue with policy served from an in-memory 461 // the session is allowed to continue with policy served from an in-memory
462 // cache. If Chrome crashes later in the session, the policy becomes 462 // cache. If Chrome crashes later in the session, the policy becomes
463 // completely unavailable. Exit the session in that case, rather than 463 // completely unavailable. Exit the session in that case, rather than
464 // allowing it to continue without policy. 464 // allowing it to continue without policy.
465 chrome::AttemptUserExit(); 465 chrome::AttemptUserExit();
466 return; 466 return;
467 } 467 }
468 468
469 // In case of multi-profiles --login-profile will contain user_id_hash. 469 // In case of multi-profiles --login-profile will contain user_id_hash.
470 std::string user_id_hash = 470 std::string user_id_hash =
471 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); 471 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile);
472 user_manager->UserLoggedIn(user_id, user_id_hash, true); 472 user_manager->UserLoggedIn(user_id, user_id_hash, true);
473 VLOG(1) << "Relaunching browser for user: " << user_id 473 VLOG(1) << "Relaunching browser for user: " << user_id.Serialize()
Denis Kuznetsov (DE-MUC) 2015/06/10 16:50:45 Not sure that Serialize() method is suitable for l
474 << " with hash: " << user_id_hash; 474 << " with hash: " << user_id_hash;
475 } 475 }
476 } 476 }
477 477
478 class GuestLanguageSetCallbackData { 478 class GuestLanguageSetCallbackData {
479 public: 479 public:
480 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { 480 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) {
481 } 481 }
482 482
483 // Must match SwitchLanguageCallback type. 483 // Must match SwitchLanguageCallback type.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // Destroy DBus services immediately after threads are stopped. 777 // Destroy DBus services immediately after threads are stopped.
778 dbus_services_.reset(); 778 dbus_services_.reset();
779 779
780 ChromeBrowserMainPartsLinux::PostDestroyThreads(); 780 ChromeBrowserMainPartsLinux::PostDestroyThreads();
781 781
782 // Destroy DeviceSettingsService after g_browser_process. 782 // Destroy DeviceSettingsService after g_browser_process.
783 DeviceSettingsService::Shutdown(); 783 DeviceSettingsService::Shutdown();
784 } 784 }
785 785
786 } // namespace chromeos 786 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698