| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signin/chrome_signin_client.h" | 5 #include "chrome/browser/signin/chrome_signin_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #else | 57 #else |
| 58 // UserManager may not exist in unit_tests. | 58 // UserManager may not exist in unit_tests. |
| 59 if (!user_manager::UserManager::IsInitialized()) | 59 if (!user_manager::UserManager::IsInitialized()) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 const user_manager::User* user = | 62 const user_manager::User* user = |
| 63 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); | 63 chromeos::ProfileHelper::Get()->GetUserByProfile(profile_); |
| 64 if (!user) | 64 if (!user) |
| 65 return; | 65 return; |
| 66 auto* user_manager = user_manager::UserManager::Get(); | 66 auto* user_manager = user_manager::UserManager::Get(); |
| 67 const std::string& user_id = user->GetUserID(); | 67 const AccountId user_id = user->GetUserID(); |
| 68 if (user_manager->GetKnownUserDeviceId(user_id).empty()) { | 68 if (user_manager->GetKnownUserDeviceId(user_id).empty()) { |
| 69 const std::string legacy_device_id = | 69 const std::string legacy_device_id = |
| 70 GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId); | 70 GetPrefs()->GetString(prefs::kGoogleServicesSigninScopedDeviceId); |
| 71 if (!legacy_device_id.empty()) { | 71 if (!legacy_device_id.empty()) { |
| 72 // Need to move device ID from the old location to the new one, if it has | 72 // Need to move device ID from the old location to the new one, if it has |
| 73 // not been done yet. | 73 // not been done yet. |
| 74 user_manager->SetKnownUserDeviceId(user_id, legacy_device_id); | 74 user_manager->SetKnownUserDeviceId(user_id, legacy_device_id); |
| 75 } else { | 75 } else { |
| 76 user_manager->SetKnownUserDeviceId( | 76 user_manager->SetKnownUserDeviceId( |
| 77 user_id, | 77 user_id, |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 ProfileOAuth2TokenService* token_service = | 370 ProfileOAuth2TokenService* token_service = |
| 371 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); | 371 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); |
| 372 OAuth2TokenService::ScopeSet scopes; | 372 OAuth2TokenService::ScopeSet scopes; |
| 373 scopes.insert(GaiaConstants::kGoogleUserInfoEmail); | 373 scopes.insert(GaiaConstants::kGoogleUserInfoEmail); |
| 374 oauth_request_ = token_service->StartRequest(account_id, scopes, this); | 374 oauth_request_ = token_service->StartRequest(account_id, scopes, this); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 #endif | 378 #endif |
| 379 } | 379 } |
| OLD | NEW |