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

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

Issue 10854213: Added UserCloudPolicyManager::ShutdownAndRemovePolicy() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_store_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (!profile_->GetPrefs()->GetBoolean(prefs::kLoadCloudPolicyOnSignin)) 100 if (!profile_->GetPrefs()->GetBoolean(prefs::kLoadCloudPolicyOnSignin))
101 return; 101 return;
102 102
103 // Either startup or shutdown the UserCloudPolicyManager depending on whether 103 // Either startup or shutdown the UserCloudPolicyManager depending on whether
104 // the user is signed in or not. 104 // the user is signed in or not.
105 if (!manager_) 105 if (!manager_)
106 return; // Can be null in unit tests. 106 return; // Can be null in unit tests.
107 107
108 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_); 108 SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_);
109 if (signin_manager->GetAuthenticatedUsername().empty()) { 109 if (signin_manager->GetAuthenticatedUsername().empty()) {
110 manager_->Shutdown(); 110 manager_->ShutdownAndRemovePolicy();
111 } else { 111 } else {
112 if (!manager_->cloud_policy_service()) { 112 if (!manager_->cloud_policy_service()) {
113 // Make sure we've initialized the DeviceManagementService. It's OK to 113 // Make sure we've initialized the DeviceManagementService. It's OK to
114 // call this multiple times so we do it every time we initialize the 114 // call this multiple times so we do it every time we initialize the
115 // UserCloudPolicyManager. 115 // UserCloudPolicyManager.
116 g_browser_process->browser_policy_connector()-> 116 g_browser_process->browser_policy_connector()->
117 ScheduleServiceInitialization( 117 ScheduleServiceInitialization(
118 kPolicyServiceInitializationDelayMilliseconds); 118 kPolicyServiceInitializationDelayMilliseconds);
119 // Initialize the UserCloudPolicyManager if it isn't already initialized. 119 // Initialize the UserCloudPolicyManager if it isn't already initialized.
120 policy::DeviceManagementService* service = g_browser_process-> 120 policy::DeviceManagementService* service = g_browser_process->
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 void UserPolicySigninService::OnGetTokenSuccess( 169 void UserPolicySigninService::OnGetTokenSuccess(
170 const std::string& access_token, 170 const std::string& access_token,
171 const base::Time& expiration_time) { 171 const base::Time& expiration_time) {
172 // Pass along the new access token to the CloudPolicyClient. 172 // Pass along the new access token to the CloudPolicyClient.
173 manager_->RegisterClient(access_token); 173 manager_->RegisterClient(access_token);
174 oauth2_access_token_fetcher_.reset(); 174 oauth2_access_token_fetcher_.reset();
175 } 175 }
176 176
177 } // namespace policy 177 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_store_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698