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

Side by Side Diff: chrome/browser/policy/cloud/user_policy_signin_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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/cloud/user_policy_signin_service.h" 5 #include "chrome/browser/policy/cloud/user_policy_signin_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void UserPolicySigninService::OnRefreshTokenAvailable( 105 void UserPolicySigninService::OnRefreshTokenAvailable(
106 const std::string& account_id) { 106 const std::string& account_id) {
107 // If using a TestingProfile with no UserCloudPolicyManager, skip 107 // If using a TestingProfile with no UserCloudPolicyManager, skip
108 // initialization. 108 // initialization.
109 if (!GetManager()) { 109 if (!GetManager()) {
110 DVLOG(1) << "Skipping initialization for tests due to missing components."; 110 DVLOG(1) << "Skipping initialization for tests due to missing components.";
111 return; 111 return;
112 } 112 }
113 113
114 std::string username = GetSigninManager()->GetAuthenticatedUsername(); 114 std::string username = GetSigninManager()->GetAuthenticatedUsername();
115 // Should not have OAuth tokens if the user isn't signed in. 115
116 DCHECK(!username.empty()); 116 // Ignore OAuth tokens for any account but the primary one.
117 if (username != account_id)
Andrew T Wilson (Slow) 2013/11/05 14:52:23 I think this should be: if (account_id != oauth2_
Bernhard Bauer 2013/11/05 16:26:51 Done.
118 return;
119
117 // ProfileOAuth2TokenService now has a refresh token so initialize the 120 // ProfileOAuth2TokenService now has a refresh token so initialize the
118 // UserCloudPolicyManager. 121 // UserCloudPolicyManager.
119 InitializeForSignedInUser(username); 122 InitializeForSignedInUser(username);
120 } 123 }
121 124
122 void UserPolicySigninService::InitializeUserCloudPolicyManager( 125 void UserPolicySigninService::InitializeUserCloudPolicyManager(
123 scoped_ptr<CloudPolicyClient> client) { 126 scoped_ptr<CloudPolicyClient> client) {
124 UserPolicySigninServiceBase::InitializeUserCloudPolicyManager(client.Pass()); 127 UserPolicySigninServiceBase::InitializeUserCloudPolicyManager(client.Pass());
125 ProhibitSignoutIfNeeded(); 128 ProhibitSignoutIfNeeded();
126 } 129 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 187 }
185 188
186 void UserPolicySigninService::ProhibitSignoutIfNeeded() { 189 void UserPolicySigninService::ProhibitSignoutIfNeeded() {
187 if (GetManager()->IsClientRegistered()) { 190 if (GetManager()->IsClientRegistered()) {
188 DVLOG(1) << "User is registered for policy - prohibiting signout"; 191 DVLOG(1) << "User is registered for policy - prohibiting signout";
189 GetSigninManager()->ProhibitSignout(true); 192 GetSigninManager()->ProhibitSignout(true);
190 } 193 }
191 } 194 }
192 195
193 } // namespace policy 196 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698