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

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

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 4 years, 10 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 <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 #include "chrome/common/chrome_paths.h" 86 #include "chrome/common/chrome_paths.h"
87 #include "chrome/common/chrome_switches.h" 87 #include "chrome/common/chrome_switches.h"
88 #include "chrome/common/logging_chrome.h" 88 #include "chrome/common/logging_chrome.h"
89 #include "chrome/common/pref_names.h" 89 #include "chrome/common/pref_names.h"
90 #include "chromeos/audio/audio_devices_pref_handler_impl.h" 90 #include "chromeos/audio/audio_devices_pref_handler_impl.h"
91 #include "chromeos/audio/cras_audio_handler.h" 91 #include "chromeos/audio/cras_audio_handler.h"
92 #include "chromeos/cert_loader.h" 92 #include "chromeos/cert_loader.h"
93 #include "chromeos/chromeos_paths.h" 93 #include "chromeos/chromeos_paths.h"
94 #include "chromeos/chromeos_switches.h" 94 #include "chromeos/chromeos_switches.h"
95 #include "chromeos/cryptohome/async_method_caller.h" 95 #include "chromeos/cryptohome/async_method_caller.h"
96 #include "chromeos/cryptohome/cryptohome_parameters.h"
96 #include "chromeos/cryptohome/homedir_methods.h" 97 #include "chromeos/cryptohome/homedir_methods.h"
97 #include "chromeos/cryptohome/system_salt_getter.h" 98 #include "chromeos/cryptohome/system_salt_getter.h"
98 #include "chromeos/dbus/dbus_thread_manager.h" 99 #include "chromeos/dbus/dbus_thread_manager.h"
99 #include "chromeos/dbus/power_policy_controller.h" 100 #include "chromeos/dbus/power_policy_controller.h"
100 #include "chromeos/dbus/services/console_service_provider.h" 101 #include "chromeos/dbus/services/console_service_provider.h"
101 #include "chromeos/dbus/services/cros_dbus_service.h" 102 #include "chromeos/dbus/services/cros_dbus_service.h"
102 #include "chromeos/dbus/services/display_power_service_provider.h" 103 #include "chromeos/dbus/services/display_power_service_provider.h"
103 #include "chromeos/dbus/services/liveness_service_provider.h" 104 #include "chromeos/dbus/services/liveness_service_provider.h"
104 #include "chromeos/dbus/services/proxy_resolution_service_provider.h" 105 #include "chromeos/dbus/services/proxy_resolution_service_provider.h"
105 #include "chromeos/dbus/session_manager_client.h" 106 #include "chromeos/dbus/session_manager_client.h"
106 #include "chromeos/disks/disk_mount_manager.h" 107 #include "chromeos/disks/disk_mount_manager.h"
108 #include "chromeos/login/auth/utils.h"
107 #include "chromeos/login/login_state.h" 109 #include "chromeos/login/login_state.h"
108 #include "chromeos/login/user_names.h" 110 #include "chromeos/login/user_names.h"
109 #include "chromeos/login_event_recorder.h" 111 #include "chromeos/login_event_recorder.h"
110 #include "chromeos/network/network_change_notifier_chromeos.h" 112 #include "chromeos/network/network_change_notifier_chromeos.h"
111 #include "chromeos/network/network_change_notifier_factory_chromeos.h" 113 #include "chromeos/network/network_change_notifier_factory_chromeos.h"
112 #include "chromeos/network/network_handler.h" 114 #include "chromeos/network/network_handler.h"
113 #include "chromeos/network/portal_detector/network_portal_detector_stub.h" 115 #include "chromeos/network/portal_detector/network_portal_detector_stub.h"
114 #include "chromeos/system/statistics_provider.h" 116 #include "chromeos/system/statistics_provider.h"
115 #include "chromeos/tpm/tpm_token_loader.h" 117 #include "chromeos/tpm/tpm_token_loader.h"
116 #include "components/arc/arc_bridge_service.h" 118 #include "components/arc/arc_bridge_service.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 312 }
311 313
312 // If we're not running on real Chrome OS hardware (or under VM), and are not 314 // If we're not running on real Chrome OS hardware (or under VM), and are not
313 // showing the login manager or attempting a command line login, login with a 315 // showing the login manager or attempting a command line login, login with a
314 // stub user. 316 // stub user.
315 if (!base::SysInfo::IsRunningOnChromeOS() && 317 if (!base::SysInfo::IsRunningOnChromeOS() &&
316 !parsed_command_line().HasSwitch(switches::kLoginManager) && 318 !parsed_command_line().HasSwitch(switches::kLoginManager) &&
317 !parsed_command_line().HasSwitch(switches::kLoginUser) && 319 !parsed_command_line().HasSwitch(switches::kLoginUser) &&
318 !parsed_command_line().HasSwitch(switches::kGuestSession)) { 320 !parsed_command_line().HasSwitch(switches::kGuestSession)) {
319 singleton_command_line->AppendSwitchASCII( 321 singleton_command_line->AppendSwitchASCII(
320 switches::kLoginUser, login::StubAccountId().GetUserEmail()); 322 switches::kLoginUser,
323 cryptohome::Identification(login::StubAccountId()).id());
321 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { 324 if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) {
322 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, 325 singleton_command_line->AppendSwitchASCII(switches::kLoginProfile,
323 chrome::kTestUserProfileDir); 326 chrome::kTestUserProfileDir);
324 } 327 }
325 LOG(WARNING) << "Running as stub user with profile dir: " 328 LOG(WARNING) << "Running as stub user with profile dir: "
326 << singleton_command_line->GetSwitchValuePath( 329 << singleton_command_line->GetSwitchValuePath(
327 switches::kLoginProfile).value(); 330 switches::kLoginProfile).value();
328 } 331 }
329 332
330 #if defined(GOOGLE_CHROME_BUILD) 333 #if defined(GOOGLE_CHROME_BUILD)
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 ShouldAutoLaunchKioskApp(parsed_command_line())) { 492 ShouldAutoLaunchKioskApp(parsed_command_line())) {
490 WizardController::SetZeroDelays(); 493 WizardController::SetZeroDelays();
491 } 494 }
492 495
493 power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get())); 496 power_prefs_.reset(new PowerPrefs(PowerPolicyController::Get()));
494 497
495 // In Aura builds this will initialize ash::Shell. 498 // In Aura builds this will initialize ash::Shell.
496 ChromeBrowserMainPartsLinux::PreProfileInit(); 499 ChromeBrowserMainPartsLinux::PreProfileInit();
497 500
498 if (immediate_login) { 501 if (immediate_login) {
499 const std::string user_email = login::CanonicalizeUserID( 502 const std::string cryptohome_id =
500 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser)); 503 parsed_command_line().GetSwitchValueASCII(switches::kLoginUser);
504 const AccountId account_id(cryptohome::GetAccountId(
505 cryptohome::Identification::FromString(cryptohome_id)));
506
501 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 507 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
502 508
503 const AccountId account_id(AccountId::FromUserEmail(user_email));
504 if (policy::IsDeviceLocalAccountUser(account_id.GetUserEmail(), NULL) && 509 if (policy::IsDeviceLocalAccountUser(account_id.GetUserEmail(), NULL) &&
505 !user_manager->IsKnownUser(account_id)) { 510 !user_manager->IsKnownUser(account_id)) {
506 // When a device-local account is removed, its policy is deleted from disk 511 // When a device-local account is removed, its policy is deleted from disk
507 // immediately. If a session using this account happens to be in progress, 512 // immediately. If a session using this account happens to be in progress,
508 // the session is allowed to continue with policy served from an in-memory 513 // the session is allowed to continue with policy served from an in-memory
509 // cache. If Chrome crashes later in the session, the policy becomes 514 // cache. If Chrome crashes later in the session, the policy becomes
510 // completely unavailable. Exit the session in that case, rather than 515 // completely unavailable. Exit the session in that case, rather than
511 // allowing it to continue without policy. 516 // allowing it to continue without policy.
512 chrome::AttemptUserExit(); 517 chrome::AttemptUserExit();
513 return; 518 return;
514 } 519 }
515 520
516 // In case of multi-profiles --login-profile will contain user_id_hash. 521 // In case of multi-profiles --login-profile will contain user_id_hash.
517 std::string user_id_hash = 522 std::string user_id_hash =
518 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile); 523 parsed_command_line().GetSwitchValueASCII(switches::kLoginProfile);
519 user_manager->UserLoggedIn(account_id, user_id_hash, true); 524 user_manager->UserLoggedIn(account_id, user_id_hash, true);
520 VLOG(1) << "Relaunching browser for user: " << user_email 525 VLOG(1) << "Relaunching browser for user: " << account_id.Serialize()
521 << " with hash: " << user_id_hash; 526 << " with hash: " << user_id_hash;
522 } 527 }
523 } 528 }
524 529
525 class GuestLanguageSetCallbackData { 530 class GuestLanguageSetCallbackData {
526 public: 531 public:
527 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) { 532 explicit GuestLanguageSetCallbackData(Profile* profile) : profile(profile) {
528 } 533 }
529 534
530 // Must match SwitchLanguageCallback type. 535 // Must match SwitchLanguageCallback type.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 // Destroy DBus services immediately after threads are stopped. 835 // Destroy DBus services immediately after threads are stopped.
831 dbus_services_.reset(); 836 dbus_services_.reset();
832 837
833 ChromeBrowserMainPartsLinux::PostDestroyThreads(); 838 ChromeBrowserMainPartsLinux::PostDestroyThreads();
834 839
835 // Destroy DeviceSettingsService after g_browser_process. 840 // Destroy DeviceSettingsService after g_browser_process.
836 DeviceSettingsService::Shutdown(); 841 DeviceSettingsService::Shutdown();
837 } 842 }
838 843
839 } // namespace chromeos 844 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698