Chromium Code Reviews| Index: chrome/browser/chromeos/login/existing_user_controller.cc |
| diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc |
| index 54a6820cbac13b39200f5b28d2bd910d0a33ada9..686ea1e0005be38f3defb75e67f63eb279707415 100644 |
| --- a/chrome/browser/chromeos/login/existing_user_controller.cc |
| +++ b/chrome/browser/chromeos/login/existing_user_controller.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/bind_helpers.h" |
| #include "base/callback.h" |
| #include "base/command_line.h" |
| +#include "base/guid.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/message_loop/message_loop.h" |
| @@ -89,6 +90,8 @@ namespace { |
| const char kCreateAccountURL[] = |
| "https://accounts.google.com/NewAccount?service=mail"; |
| +const char kEphemeralUserDeviceIDPrefix[] = "t_"; |
| + |
| // Delay for transferring the auth cache to the system profile. |
| const long int kAuthCacheTransferDelayMs = 2000; |
| @@ -1119,7 +1122,23 @@ void ExistingUserController::ContinueLoginIfDeviceNotDisabled( |
| continuation.Run(); |
| } |
| -void ExistingUserController::DoCompleteLogin(const UserContext& user_context) { |
| +void ExistingUserController::DoCompleteLogin( |
| + const UserContext& user_context_wo_device_id) { |
|
achuithb
2015/05/12 23:25:01
Maybe call this user_context, and use uc for the s
dzhioev (left Google)
2015/05/13 00:25:17
'user_context' variable is used 5-6 times in this
|
| + UserContext user_context = user_context_wo_device_id; |
| + std::string known_device_id = |
|
achuithb
2015/05/12 23:25:01
I'd suggest merging the variables known_device_id
dzhioev (left Google)
2015/05/13 00:25:17
Done.
|
| + user_manager::UserManager::Get()->GetKnownUserDeviceId( |
| + user_context.GetUserID()); |
| + if (known_device_id.empty()) { |
| + std::string new_device_id = base::GenerateGUID(); |
| + if (ChromeUserManager::Get()->AreEphemeralUsersEnabled() && |
| + user_context.GetUserID() != ChromeUserManager::Get()->GetOwnerEmail()) { |
| + new_device_id = kEphemeralUserDeviceIDPrefix + new_device_id; |
| + } |
| + user_context.SetDeviceId(new_device_id); |
| + } else { |
| + user_context.SetDeviceId(known_device_id); |
| + } |
| + |
| PerformPreLoginActions(user_context); |
| if (!time_init_.is_null()) { |