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/sync/supervised_user_signin_manager_wrapper.h" | 5 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "components/signin/core/browser/signin_manager_base.h" | 8 #include "components/signin/core/browser/signin_manager_base.h" |
9 #include "google_apis/gaia/gaia_constants.h" | 9 #include "google_apis/gaia/gaia_constants.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const { | 27 std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const { |
28 const std::string& auth_username = original_->GetAuthenticatedUsername(); | 28 const std::string& auth_username = original_->GetAuthenticatedUsername(); |
29 #if defined(ENABLE_MANAGED_USERS) | 29 #if defined(ENABLE_MANAGED_USERS) |
30 if (auth_username.empty() && profile_->IsSupervised()) | 30 if (auth_username.empty() && profile_->IsSupervised()) |
31 return supervised_users::kSupervisedUserPseudoEmail; | 31 return supervised_users::kSupervisedUserPseudoEmail; |
32 #endif | 32 #endif |
33 return auth_username; | 33 return auth_username; |
34 } | 34 } |
35 | 35 |
36 std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const { | 36 std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const { |
37 const std::string& auth_account = original_->GetAuthenticatedAccountId(); | |
38 #if defined(ENABLE_MANAGED_USERS) | 37 #if defined(ENABLE_MANAGED_USERS) |
39 if (auth_account.empty() && profile_->IsSupervised()) | 38 if (!original_->IsAuthenticated() && profile_->IsSupervised()) |
40 return supervised_users::kSupervisedUserPseudoEmail; | 39 return supervised_users::kSupervisedUserPseudoEmail; |
41 #endif | 40 #endif |
42 return auth_account; | 41 return original_->GetAuthenticatedAccountId(); |
43 } | 42 } |
44 | 43 |
45 std::string SupervisedUserSigninManagerWrapper::GetSyncScopeToUse() const { | 44 std::string SupervisedUserSigninManagerWrapper::GetSyncScopeToUse() const { |
46 #if defined(ENABLE_MANAGED_USERS) | 45 #if defined(ENABLE_MANAGED_USERS) |
47 const std::string& auth_account = original_->GetAuthenticatedAccountId(); | 46 if (!original_->IsAuthenticated() && profile_->IsSupervised()) |
48 if (auth_account.empty() && profile_->IsSupervised()) | |
49 return GaiaConstants::kChromeSyncSupervisedOAuth2Scope; | 47 return GaiaConstants::kChromeSyncSupervisedOAuth2Scope; |
50 #endif | 48 #endif |
51 return GaiaConstants::kChromeSyncOAuth2Scope; | 49 return GaiaConstants::kChromeSyncOAuth2Scope; |
52 } | 50 } |
OLD | NEW |