summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/supervised_user_signin_manager_wrapper.cc
blob: 2e197af2e4d0d2c824642c296a89ba10ecb35ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"

#include "chrome/browser/profiles/profile.h"
#include "components/signin/core/browser/signin_manager_base.h"
#include "google_apis/gaia/gaia_constants.h"

#if defined(ENABLE_SUPERVISED_USERS)
#include "chrome/browser/supervised_user/supervised_user_constants.h"
#endif

SupervisedUserSigninManagerWrapper::SupervisedUserSigninManagerWrapper(
    Profile* profile,
    SigninManagerBase* original)
    : SigninManagerWrapper(original), profile_(profile) {}

SupervisedUserSigninManagerWrapper::~SupervisedUserSigninManagerWrapper() {}

std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const {
#if defined(ENABLE_SUPERVISED_USERS)
  if (profile_->IsLegacySupervised())
    return supervised_users::kSupervisedUserPseudoEmail;
#endif
  return SigninManagerWrapper::GetEffectiveUsername();
}

std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const {
#if defined(ENABLE_SUPERVISED_USERS)
  if (profile_->IsLegacySupervised())
    return supervised_users::kSupervisedUserPseudoEmail;
#endif
  return SigninManagerWrapper::GetAccountIdToUse();
}

std::string SupervisedUserSigninManagerWrapper::GetSyncScopeToUse() const {
#if defined(ENABLE_SUPERVISED_USERS)
  if (profile_->IsLegacySupervised())
    return GaiaConstants::kChromeSyncSupervisedOAuth2Scope;
#endif
  return SigninManagerWrapper::GetSyncScopeToUse();
}