Componentize HistoryURLProvider/ScoredHistoryMatch.
[chromium-blink-merge.git] / chrome / browser / sync / supervised_user_signin_manager_wrapper.cc
blob1c931a0bfa9143b1170a1eb88b02e5b6d498d34e
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
3 // found in the LICENSE file.
5 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "components/signin/core/browser/signin_manager_base.h"
9 #include "google_apis/gaia/gaia_constants.h"
11 #if defined(ENABLE_SUPERVISED_USERS)
12 #include "chrome/browser/supervised_user/supervised_user_constants.h"
13 #endif
15 SupervisedUserSigninManagerWrapper::SupervisedUserSigninManagerWrapper(
16 Profile* profile,
17 SigninManagerBase* original)
18 : profile_(profile), original_(original) {}
20 SupervisedUserSigninManagerWrapper::~SupervisedUserSigninManagerWrapper() {
23 SigninManagerBase* SupervisedUserSigninManagerWrapper::GetOriginal() {
24 return original_;
27 std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const {
28 #if defined(ENABLE_SUPERVISED_USERS)
29 if (profile_->IsLegacySupervised())
30 return supervised_users::kSupervisedUserPseudoEmail;
31 #endif
32 return original_->GetAuthenticatedUsername();
35 std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const {
36 #if defined(ENABLE_SUPERVISED_USERS)
37 if (profile_->IsLegacySupervised())
38 return supervised_users::kSupervisedUserPseudoEmail;
39 #endif
40 return original_->GetAuthenticatedAccountId();
43 std::string SupervisedUserSigninManagerWrapper::GetSyncScopeToUse() const {
44 #if defined(ENABLE_SUPERVISED_USERS)
45 if (profile_->IsLegacySupervised())
46 return GaiaConstants::kChromeSyncSupervisedOAuth2Scope;
47 #endif
48 return GaiaConstants::kChromeSyncOAuth2Scope;