| OLD | NEW |
| 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/enrollment/enterprise_enrollment_screen.
h" | 5 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_screen.
h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 RegisterForDevicePolicy(token, | 92 RegisterForDevicePolicy(token, |
| 93 policy::BrowserPolicyConnector::TOKEN_TYPE_OAUTH); | 93 policy::BrowserPolicyConnector::TOKEN_TYPE_OAUTH); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void EnterpriseEnrollmentScreen::OnAuthCancelled() { | 96 void EnterpriseEnrollmentScreen::OnAuthCancelled() { |
| 97 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, | 97 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, |
| 98 policy::kMetricEnrollmentCancelled, | 98 policy::kMetricEnrollmentCancelled, |
| 99 policy::kMetricEnrollmentSize); | 99 policy::kMetricEnrollmentSize); |
| 100 auth_fetcher_.reset(); | 100 auth_fetcher_.reset(); |
| 101 registrar_.reset(); | 101 registrar_.reset(); |
| 102 g_browser_process->browser_policy_connector()->ResetDevicePolicy(); | 102 g_browser_process->browser_policy_connector()->ResetCloudPolicy(); |
| 103 get_screen_observer()->OnExit( | 103 get_screen_observer()->OnExit( |
| 104 ScreenObserver::ENTERPRISE_ENROLLMENT_CANCELLED); | 104 ScreenObserver::ENTERPRISE_ENROLLMENT_CANCELLED); |
| 105 } | 105 } |
| 106 | 106 |
| 107 void EnterpriseEnrollmentScreen::OnConfirmationClosed() { | 107 void EnterpriseEnrollmentScreen::OnConfirmationClosed() { |
| 108 auth_fetcher_.reset(); | 108 auth_fetcher_.reset(); |
| 109 get_screen_observer()->OnExit( | 109 get_screen_observer()->OnExit( |
| 110 ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED); | 110 ScreenObserver::ENTERPRISE_ENROLLMENT_COMPLETED); |
| 111 } | 111 } |
| 112 | 112 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // We have an error. | 216 // We have an error. |
| 217 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, | 217 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, |
| 218 metric, | 218 metric, |
| 219 policy::kMetricEnrollmentSize); | 219 policy::kMetricEnrollmentSize); |
| 220 LOG(WARNING) << "Policy subsystem error during enrollment: " << state | 220 LOG(WARNING) << "Policy subsystem error during enrollment: " << state |
| 221 << " details: " << error_details; | 221 << " details: " << error_details; |
| 222 } | 222 } |
| 223 | 223 |
| 224 // Stop the policy infrastructure. | 224 // Stop the policy infrastructure. |
| 225 registrar_.reset(); | 225 registrar_.reset(); |
| 226 g_browser_process->browser_policy_connector()->ResetDevicePolicy(); | 226 g_browser_process->browser_policy_connector()->ResetCloudPolicy(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void EnterpriseEnrollmentScreen::HandleAuthError( | 229 void EnterpriseEnrollmentScreen::HandleAuthError( |
| 230 const GoogleServiceAuthError& error) { | 230 const GoogleServiceAuthError& error) { |
| 231 scoped_ptr<GaiaAuthFetcher> scoped_killer(auth_fetcher_.release()); | 231 scoped_ptr<GaiaAuthFetcher> scoped_killer(auth_fetcher_.release()); |
| 232 | 232 |
| 233 if (!is_showing_) | 233 if (!is_showing_) |
| 234 return; | 234 return; |
| 235 | 235 |
| 236 switch (error.state()) { | 236 switch (error.state()) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 void EnterpriseEnrollmentScreen::WriteInstallAttributesData() { | 279 void EnterpriseEnrollmentScreen::WriteInstallAttributesData() { |
| 280 // Since this method is also called directly. | 280 // Since this method is also called directly. |
| 281 weak_ptr_factory_.InvalidateWeakPtrs(); | 281 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 282 | 282 |
| 283 switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) { | 283 switch (g_browser_process->browser_policy_connector()->LockDevice(user_)) { |
| 284 case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: { | 284 case policy::EnterpriseInstallAttributes::LOCK_SUCCESS: { |
| 285 actor_->SetEditableUser(false); | 285 actor_->SetEditableUser(false); |
| 286 // Proceed with policy fetch. | 286 // Proceed with policy fetch. |
| 287 policy::BrowserPolicyConnector* connector = | 287 policy::BrowserPolicyConnector* connector = |
| 288 g_browser_process->browser_policy_connector(); | 288 g_browser_process->browser_policy_connector(); |
| 289 connector->FetchDevicePolicy(); | 289 connector->FetchCloudPolicy(); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: { | 292 case policy::EnterpriseInstallAttributes::LOCK_NOT_READY: { |
| 293 // InstallAttributes not ready yet, retry later. | 293 // InstallAttributes not ready yet, retry later. |
| 294 LOG(WARNING) << "Install Attributes not ready yet will retry in " | 294 LOG(WARNING) << "Install Attributes not ready yet will retry in " |
| 295 << kLockRetryIntervalMs << "ms."; | 295 << kLockRetryIntervalMs << "ms."; |
| 296 MessageLoop::current()->PostDelayedTask( | 296 MessageLoop::current()->PostDelayedTask( |
| 297 FROM_HERE, | 297 FROM_HERE, |
| 298 base::Bind(&EnterpriseEnrollmentScreen::WriteInstallAttributesData, | 298 base::Bind(&EnterpriseEnrollmentScreen::WriteInstallAttributesData, |
| 299 weak_ptr_factory_.GetWeakPtr()), | 299 weak_ptr_factory_.GetWeakPtr()), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 connector->ScheduleServiceInitialization(0); | 333 connector->ScheduleServiceInitialization(0); |
| 334 registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar( | 334 registrar_.reset(new policy::CloudPolicySubsystem::ObserverRegistrar( |
| 335 connector->device_cloud_policy_subsystem(), this)); | 335 connector->device_cloud_policy_subsystem(), this)); |
| 336 | 336 |
| 337 // Push the credentials to the policy infrastructure. It'll start enrollment | 337 // Push the credentials to the policy infrastructure. It'll start enrollment |
| 338 // and notify us of progress through CloudPolicySubsystem::Observer. | 338 // and notify us of progress through CloudPolicySubsystem::Observer. |
| 339 connector->RegisterForDevicePolicy(user_, token, token_type); | 339 connector->RegisterForDevicePolicy(user_, token, token_type); |
| 340 } | 340 } |
| 341 | 341 |
| 342 } // namespace chromeos | 342 } // namespace chromeos |
| OLD | NEW |