Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1731)

Unified Diff: chrome/browser/managed_mode/managed_user_service.cc

Issue 33173005: Correctly deal with tokens for supervised users in ProfileOAuth2TokenService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/managed_mode/managed_user_service.cc
diff --git a/chrome/browser/managed_mode/managed_user_service.cc b/chrome/browser/managed_mode/managed_user_service.cc
index bbfb9bdd8c8e6f0471ac2d04d83f8f8963876b80..170cee3df23d8379aa4c05479aa12070e123783e 100644
--- a/chrome/browser/managed_mode/managed_user_service.cc
+++ b/chrome/browser/managed_mode/managed_user_service.cc
@@ -25,11 +25,11 @@
#include "chrome/browser/managed_mode/managed_user_sync_service.h"
#include "chrome/browser/managed_mode/managed_user_sync_service_factory.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/signin/profile_oauth2_token_service.h"
+#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_base.h"
#include "chrome/browser/signin/signin_manager_factory.h"
-#include "chrome/browser/signin/token_service.h"
-#include "chrome/browser/signin/token_service_factory.h"
#include "chrome/browser/sync/glue/session_model_associator.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
@@ -66,7 +66,6 @@ const char kManagedModeFinchName[] = "ManagedModeLaunch";
const char kManagedUserAccessRequestKeyPrefix[] =
"X-ManagedUser-AccessRequests";
const char kManagedUserAccessRequestTime[] = "timestamp";
-const char kManagedUserPseudoEmail[] = "managed_user@localhost";
const char kOpenManagedProfileKeyPrefix[] = "X-ManagedUser-Events-OpenProfile";
const char kQuitBrowserKeyPrefix[] = "X-ManagedUser-Events-QuitBrowser";
const char kSwitchFromManagedProfileKeyPrefix[] =
@@ -531,9 +530,10 @@ void ManagedUserService::InitSync(const std::string& refresh_token) {
// until we've finished configuration.
service->SetSetupInProgress(true);
- TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
- token_service->UpdateCredentialsWithOAuth2(
- GaiaAuthConsumer::ClientOAuthResult(refresh_token, std::string(), 0));
+ ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
+ token_service->UpdateCredentials(managed_users::kManagedUserPseudoEmail,
+ refresh_token);
// Continue in SetupSync() once the Sync backend has been initialized.
if (service->sync_initialized()) {
@@ -544,11 +544,6 @@ void ManagedUserService::InitSync(const std::string& refresh_token) {
}
}
-// static
-const char* ManagedUserService::GetManagedUserPseudoEmail() {
- return kManagedUserPseudoEmail;
-}
-
void ManagedUserService::Init() {
ManagedUserSettingsService* settings_service = GetSettingsService();
DCHECK(settings_service->IsReady());
@@ -565,10 +560,10 @@ void ManagedUserService::Init() {
command_line->GetSwitchValueASCII(switches::kManagedUserSyncToken));
}
- // TokenService only loads tokens automatically if we're signed in, so we have
- // to nudge it ourselves.
- TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
- token_service->LoadTokensFromDB();
+ // TODO(rogerta): Remove this once PO2TS has replaced TokenService.
+ ProfileOAuth2TokenService* token_service =
+ ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
+ token_service->LoadCredentials();
Andrew T Wilson (Slow) 2013/11/05 14:52:23 Is this still required (I thought PO2TS already se
Bernhard Bauer 2013/11/05 16:26:51 I hope it doesn't self-initialize yet, otherwise w
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile_);

Powered by Google App Engine
This is Rietveld 408576698