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

Side by Side Diff: chrome/browser/policy/user_policy_signin_service.cc

Issue 10919131: Break out base functionality of UserCloudPolicyManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, address comments, fix compilation. Created 8 years, 3 months 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/user_policy_signin_service.h" 5 #include "chrome/browser/policy/user_policy_signin_service.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/policy/browser_policy_connector.h" 8 #include "chrome/browser/policy/browser_policy_connector.h"
9 #include "chrome/browser/policy/cloud_policy_service.h" 9 #include "chrome/browser/policy/cloud_policy_service.h"
10 #include "chrome/browser/policy/user_cloud_policy_manager.h" 10 #include "chrome/browser/policy/user_cloud_policy_manager.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // The code below is somewhat racy in that if the store is not initialized 129 // The code below is somewhat racy in that if the store is not initialized
130 // by the time we get here, we won't register the client. In practice, we 130 // by the time we get here, we won't register the client. In practice, we
131 // handle the case where there's no policy file because checking for the 131 // handle the case where there's no policy file because checking for the
132 // file always completes before the token DB is loaded (since they use the 132 // file always completes before the token DB is loaded (since they use the
133 // same thread for their operations). 133 // same thread for their operations).
134 // TODO(atwilson): If there's a problem loading the stored policy, we could 134 // TODO(atwilson): If there's a problem loading the stored policy, we could
135 // be left with no policy, so we should move this code to 135 // be left with no policy, so we should move this code to
136 // UserCloudPolicyManager and have it initiate a DMToken fetch only once 136 // UserCloudPolicyManager and have it initiate a DMToken fetch only once
137 // the policy load is complete (http://crbug.com/143187). 137 // the policy load is complete (http://crbug.com/143187).
138 if (!manager_->IsClientRegistered() && 138 if (!manager_->IsClientRegistered() &&
139 manager_->cloud_policy_service()->store()->is_initialized()) { 139 manager_->cloud_policy_store()->is_initialized()) {
140 RegisterCloudPolicyService(); 140 RegisterCloudPolicyService();
141 } 141 }
142 } 142 }
143 } 143 }
144 144
145 void UserPolicySigninService::RegisterCloudPolicyService() { 145 void UserPolicySigninService::RegisterCloudPolicyService() {
146 DVLOG(1) << "Fetching new DM Token"; 146 DVLOG(1) << "Fetching new DM Token";
147 // TODO(atwilson): Move the code to mint the devicemanagement token into 147 // TODO(atwilson): Move the code to mint the devicemanagement token into
148 // TokenService. 148 // TokenService.
149 std::string token = TokenServiceFactory::GetForProfile(profile_)-> 149 std::string token = TokenServiceFactory::GetForProfile(profile_)->
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void UserPolicySigninService::OnGetTokenSuccess( 181 void UserPolicySigninService::OnGetTokenSuccess(
182 const std::string& access_token, 182 const std::string& access_token,
183 const base::Time& expiration_time) { 183 const base::Time& expiration_time) {
184 // Pass along the new access token to the CloudPolicyClient. 184 // Pass along the new access token to the CloudPolicyClient.
185 DVLOG(1) << "Fetched new scoped OAuth token:" << access_token; 185 DVLOG(1) << "Fetched new scoped OAuth token:" << access_token;
186 manager_->RegisterClient(access_token); 186 manager_->RegisterClient(access_token);
187 oauth2_access_token_fetcher_.reset(); 187 oauth2_access_token_fetcher_.reset();
188 } 188 }
189 189
190 } // namespace policy 190 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698