Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / sync / supervised_user_signin_manager_wrapper.cc
blob2e197af2e4d0d2c824642c296a89ba10ecb35ad5
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 : SigninManagerWrapper(original), profile_(profile) {}
20 SupervisedUserSigninManagerWrapper::~SupervisedUserSigninManagerWrapper() {}
22 std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const {
23 #if defined(ENABLE_SUPERVISED_USERS)
24 if (profile_->IsLegacySupervised())
25 return supervised_users::kSupervisedUserPseudoEmail;
26 #endif
27 return SigninManagerWrapper::GetEffectiveUsername();
30 std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const {
31 #if defined(ENABLE_SUPERVISED_USERS)
32 if (profile_->IsLegacySupervised())
33 return supervised_users::kSupervisedUserPseudoEmail;
34 #endif
35 return SigninManagerWrapper::GetAccountIdToUse();
38 std::string SupervisedUserSigninManagerWrapper::GetSyncScopeToUse() const {
39 #if defined(ENABLE_SUPERVISED_USERS)
40 if (profile_->IsLegacySupervised())
41 return GaiaConstants::kChromeSyncSupervisedOAuth2Scope;
42 #endif
43 return SigninManagerWrapper::GetSyncScopeToUse();