Commit 0cb28a73 authored by treib@chromium.org's avatar treib@chromium.org

Cleanup: Pull Managed User logic out of ProfileSyncService.

BUG=372381

Review URL: https://codereview.chromium.org/281433004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269790 0039d316-1c4b-4281-b951-d872f2087c98
parent 90704678
......@@ -6,6 +6,7 @@
#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/managed_mode/managed_user_constants.h"
......@@ -40,3 +41,12 @@ std::string ManagedUserSigninManagerWrapper::GetAccountIdToUse() const {
#endif
return auth_account;
}
std::string ManagedUserSigninManagerWrapper::GetSyncScopeToUse() const {
#if defined(ENABLE_MANAGED_USERS)
const std::string& auth_account = original_->GetAuthenticatedAccountId();
if (auth_account.empty() && profile_->IsManaged())
return GaiaConstants::kChromeSyncManagedOAuth2Scope;
#endif
return GaiaConstants::kChromeSyncOAuth2Scope;
}
......@@ -26,6 +26,8 @@ class ManagedUserSigninManagerWrapper {
virtual std::string GetEffectiveUsername() const;
virtual std::string GetAccountIdToUse() const;
virtual std::string GetSyncScopeToUse() const;
SigninManagerBase* GetOriginal();
private:
......
......@@ -69,7 +69,6 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "google_apis/gaia/gaia_constants.h"
#include "grit/generated_resources.h"
#include "net/cookies/cookie_monster.h"
#include "net/url_request/url_request_context_getter.h"
......@@ -87,10 +86,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#if defined(ENABLE_MANAGED_USERS)
#include "chrome/browser/managed_mode/managed_user_constants.h"
#endif
#if defined(OS_ANDROID)
#include "sync/internal_api/public/read_transaction.h"
#endif
......@@ -1976,11 +1971,7 @@ void ProfileSyncService::RequestAccessToken() {
return;
request_access_token_retry_timer_.Stop();
OAuth2TokenService::ScopeSet oauth2_scopes;
if (profile_->IsManaged()) {
oauth2_scopes.insert(GaiaConstants::kChromeSyncManagedOAuth2Scope);
} else {
oauth2_scopes.insert(GaiaConstants::kChromeSyncOAuth2Scope);
}
oauth2_scopes.insert(signin_->GetSyncScopeToUse());
// Invalidate previous token, otherwise token service will return the same
// token again.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment