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

Side by Side Diff: chrome/browser/chromeos/login/enterprise_enrollment_screen.cc

Issue 7147015: Move user cloud policy to BrowserProcess (was 6979011) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_test include breakage Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/login/enterprise_enrollment_screen.h" 5 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 10 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 auth_fetcher_->StartClientLogin(user, access_code, 55 auth_fetcher_->StartClientLogin(user, access_code,
56 GaiaConstants::kDeviceManagementService, 56 GaiaConstants::kDeviceManagementService,
57 std::string(), std::string(), 57 std::string(), std::string(),
58 GaiaAuthFetcher::HostedAccountsAllowed); 58 GaiaAuthFetcher::HostedAccountsAllowed);
59 } 59 }
60 } 60 }
61 61
62 void EnterpriseEnrollmentScreen::CancelEnrollment() { 62 void EnterpriseEnrollmentScreen::CancelEnrollment() {
63 auth_fetcher_.reset(); 63 auth_fetcher_.reset();
64 registrar_.reset(); 64 registrar_.reset();
65 g_browser_process->browser_policy_connector()->StopAutoRetry(); 65 g_browser_process->browser_policy_connector()->DeviceStopAutoRetry();
66 ScreenObserver* observer = delegate()->GetObserver(); 66 ScreenObserver* observer = delegate()->GetObserver();
67 observer->OnExit(ScreenObserver::ENTERPRISE_ENROLLMENT_CANCELLED); 67 observer->OnExit(ScreenObserver::ENTERPRISE_ENROLLMENT_CANCELLED);
68 } 68 }
69 69
70 void EnterpriseEnrollmentScreen::CloseConfirmation() { 70 void EnterpriseEnrollmentScreen::CloseConfirmation() {
71 auth_fetcher_.reset(); 71 auth_fetcher_.reset();
72 ScreenObserver* observer = delegate()->GetObserver(); 72 ScreenObserver* observer = delegate()->GetObserver();
73 observer->OnExit(ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED); 73 observer->OnExit(ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED);
74 } 74 }
75 75
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 const std::string& auth_token) { 114 const std::string& auth_token) {
115 if (service != GaiaConstants::kDeviceManagementService) { 115 if (service != GaiaConstants::kDeviceManagementService) {
116 NOTREACHED() << service; 116 NOTREACHED() << service;
117 return; 117 return;
118 } 118 }
119 119
120 scoped_ptr<GaiaAuthFetcher> auth_fetcher(auth_fetcher_.release()); 120 scoped_ptr<GaiaAuthFetcher> auth_fetcher(auth_fetcher_.release());
121 121
122 policy::BrowserPolicyConnector* connector = 122 policy::BrowserPolicyConnector* connector =
123 g_browser_process->browser_policy_connector(); 123 g_browser_process->browser_policy_connector();
124 if (!connector->cloud_policy_subsystem()) { 124 if (!connector->device_cloud_policy_subsystem()) {
125 NOTREACHED() << "Cloud policy subsystem not initialized."; 125 NOTREACHED() << "Cloud policy subsystem not initialized.";
126 if (view()) 126 if (view())
127 view()->ShowFatalEnrollmentError(); 127 view()->ShowFatalEnrollmentError();
128 return; 128 return;
129 } 129 }
130 130
131 connector->ScheduleServiceInitialization(0); 131 connector->ScheduleServiceInitialization(0);
132 registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar( 132 registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar(
133 connector->cloud_policy_subsystem(), this)); 133 connector->device_cloud_policy_subsystem(), this));
134 134
135 // Push the credentials to the policy infrastructure. It'll start enrollment 135 // Push the credentials to the policy infrastructure. It'll start enrollment
136 // and notify us of progress through CloudPolicySubsystem::Observer. 136 // and notify us of progress through CloudPolicySubsystem::Observer.
137 connector->SetCredentials(user_, auth_token); 137 connector->SetDeviceCredentials(user_, auth_token);
138 } 138 }
139 139
140 void EnterpriseEnrollmentScreen::OnIssueAuthTokenFailure( 140 void EnterpriseEnrollmentScreen::OnIssueAuthTokenFailure(
141 const std::string& service, 141 const std::string& service,
142 const GoogleServiceAuthError& error) { 142 const GoogleServiceAuthError& error) {
143 if (service != GaiaConstants::kDeviceManagementService) { 143 if (service != GaiaConstants::kDeviceManagementService) {
144 NOTREACHED() << service; 144 NOTREACHED() << service;
145 return; 145 return;
146 } 146 }
147 147
(...skipping 29 matching lines...) Expand all
177 return; 177 return;
178 } 178 }
179 179
180 // We have an error. 180 // We have an error.
181 LOG(WARNING) << "Policy subsystem error during enrollment: " << state 181 LOG(WARNING) << "Policy subsystem error during enrollment: " << state
182 << " details: " << error_details; 182 << " details: " << error_details;
183 } 183 }
184 184
185 // Stop the policy infrastructure. 185 // Stop the policy infrastructure.
186 registrar_.reset(); 186 registrar_.reset();
187 g_browser_process->browser_policy_connector()->StopAutoRetry(); 187 g_browser_process->browser_policy_connector()->DeviceStopAutoRetry();
188 } 188 }
189 189
190 EnterpriseEnrollmentView* EnterpriseEnrollmentScreen::AllocateView() { 190 EnterpriseEnrollmentView* EnterpriseEnrollmentScreen::AllocateView() {
191 return new EnterpriseEnrollmentView(this); 191 return new EnterpriseEnrollmentView(this);
192 } 192 }
193 193
194 void EnterpriseEnrollmentScreen::HandleAuthError( 194 void EnterpriseEnrollmentScreen::HandleAuthError(
195 const GoogleServiceAuthError& error) { 195 const GoogleServiceAuthError& error) {
196 scoped_ptr<GaiaAuthFetcher> scoped_killer(auth_fetcher_.release()); 196 scoped_ptr<GaiaAuthFetcher> scoped_killer(auth_fetcher_.release());
197 197
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 runnable_method_factory_.RevokeAll(); 229 runnable_method_factory_.RevokeAll();
230 230
231 if (!view()) 231 if (!view())
232 return; 232 return;
233 233
234 switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) { 234 switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) {
235 case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: { 235 case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: {
236 // Proceed with policy fetch. 236 // Proceed with policy fetch.
237 policy::BrowserPolicyConnector* connector = 237 policy::BrowserPolicyConnector* connector =
238 g_browser_process->browser_policy_connector(); 238 g_browser_process->browser_policy_connector();
239 connector->FetchPolicy(); 239 connector->FetchDevicePolicy();
240 return; 240 return;
241 } 241 }
242 case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: { 242 case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: {
243 // InstallAttributes not ready yet, retry later. 243 // InstallAttributes not ready yet, retry later.
244 LOG(WARNING) << "Install Attributes not ready yet will retry in " 244 LOG(WARNING) << "Install Attributes not ready yet will retry in "
245 << kLockRetryIntervalMs << "ms."; 245 << kLockRetryIntervalMs << "ms.";
246 MessageLoop::current()->PostDelayedTask( 246 MessageLoop::current()->PostDelayedTask(
247 FROM_HERE, 247 FROM_HERE,
248 runnable_method_factory_.NewRunnableMethod( 248 runnable_method_factory_.NewRunnableMethod(
249 &EnterpriseEnrollmentScreen::WriteInstallAttributesData), 249 &EnterpriseEnrollmentScreen::WriteInstallAttributesData),
250 kLockRetryIntervalMs); 250 kLockRetryIntervalMs);
251 return; 251 return;
252 } 252 }
253 case policy::EnterpriseInstallAttributes::LOCK_BACKEND_ERROR: { 253 case policy::EnterpriseInstallAttributes::LOCK_BACKEND_ERROR: {
254 view()->ShowFatalEnrollmentError(); 254 view()->ShowFatalEnrollmentError();
255 return; 255 return;
256 } 256 }
257 case policy::EnterpriseInstallAttributes::LOCK_WRONG_USER: { 257 case policy::EnterpriseInstallAttributes::LOCK_WRONG_USER: {
258 LOG(ERROR) << "Enrollment can not proceed because the InstallAttrs " 258 LOG(ERROR) << "Enrollment can not proceed because the InstallAttrs "
259 << "has been locked already!"; 259 << "has been locked already!";
260 view()->ShowFatalEnrollmentError(); 260 view()->ShowFatalEnrollmentError();
261 return; 261 return;
262 } 262 }
263 } 263 }
264 264
265 NOTREACHED(); 265 NOTREACHED();
266 } 266 }
267 267
268 } // namespace chromeos 268 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/base_login_display_host.cc ('k') | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698