blob: 21b045ed000c636b7f2ca78e8653cffc563516af (
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
45
46
47
48
49
50
|
// 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_MANAGED_USERS)
#include "chrome/browser/supervised_user/supervised_user_constants.h"
#endif
SupervisedUserSigninManagerWrapper::SupervisedUserSigninManagerWrapper(
Profile* profile,
SigninManagerBase* original)
: profile_(profile), original_(original) {}
SupervisedUserSigninManagerWrapper::~SupervisedUserSigninManagerWrapper() {
}
SigninManagerBase* SupervisedUserSigninManagerWrapper::GetOriginal() {
return original_;
}
std::string SupervisedUserSigninManagerWrapper::GetEffectiveUsername() const {
const std::string& auth_username = original_->GetAuthenticatedUsername();
#if defined(ENABLE_MANAGED_USERS)
if (auth_username.empty() && profile_->IsSupervised())
return supervised_users::kSupervisedUserPseudoEmail;
#endif
return auth_username;
}
std::string SupervisedUserSigninManagerWrapper::GetAccountIdToUse() const {
#if defined(ENABLE_MANAGED_USERS)
if (!original_->IsAuthenticated() && profile_->IsSupervised())
return supervised_users::kSupervisedUserPseudoEmail;
#endif
return original_->GetAuthenticatedAccountId();
}
std::string SupervisedUserSigninManagerWrapper::GetSyncScopeToUse() const {
#if defined(ENABLE_MANAGED_USERS)
if (!original_->IsAuthenticated() && profile_->IsSupervised())
return GaiaConstants::kChromeSyncSupervisedOAuth2Scope;
#endif
return GaiaConstants::kChromeSyncOAuth2Scope;
}
|