| Index: chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
|
| diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
|
| index a0d7b4e0e228c308254b4d35fd0b378c67f6b216..67a2e3f65ca28036f1c4889981ac1818dc0f017e 100644
|
| --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
|
| +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
|
| @@ -44,19 +44,47 @@ using policy::EnrollmentConfig;
|
|
|
| namespace {
|
|
|
| -const char * const kMetricEnrollmentTimeCancel =
|
| +const char* const kMetricEnrollmentTimeCancel =
|
| "Enterprise.EnrollmentTime.Cancel";
|
| -const char * const kMetricEnrollmentTimeFailure =
|
| +const char* const kMetricEnrollmentTimeFailure =
|
| "Enterprise.EnrollmentTime.Failure";
|
| -const char * const kMetricEnrollmentTimeSuccess =
|
| +const char* const kMetricEnrollmentTimeSuccess =
|
| "Enterprise.EnrollmentTime.Success";
|
|
|
| +const char* const kLicenseTypePerpetual = "perpetual";
|
| +const char* const kLicenseTypeAnnual = "annual";
|
| +const char* const kLicenseTypeKiosk = "kiosk";
|
| +
|
| // Retry policy constants.
|
| constexpr int kInitialDelayMS = 4 * 1000; // 4 seconds
|
| constexpr double kMultiplyFactor = 1.5;
|
| constexpr double kJitterFactor = 0.1; // +/- 10% jitter
|
| constexpr int64_t kMaxDelayMS = 8 * 60 * 1000; // 8 minutes
|
|
|
| +::policy::LicenseType GetLicenseTypeById(const std::string& id) {
|
| + if (id == kLicenseTypePerpetual)
|
| + return ::policy::LicenseType::PERPETUAL;
|
| + if (id == kLicenseTypeAnnual)
|
| + return ::policy::LicenseType::ANNUAL;
|
| + if (id == kLicenseTypeKiosk)
|
| + return ::policy::LicenseType::KIOSK;
|
| + return ::policy::LicenseType::UNKNOWN;
|
| +}
|
| +
|
| +std::string GetLicenseIdByType(::policy::LicenseType type) {
|
| + switch (type) {
|
| + case ::policy::LicenseType::PERPETUAL:
|
| + return kLicenseTypePerpetual;
|
| + case ::policy::LicenseType::ANNUAL:
|
| + return kLicenseTypeAnnual;
|
| + case ::policy::LicenseType::KIOSK:
|
| + return kLicenseTypeKiosk;
|
| + default:
|
| + NOTREACHED();
|
| + return std::string();
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace chromeos {
|
| @@ -202,7 +230,13 @@ void EnrollmentScreen::OnLoginDone(const std::string& user,
|
| auth_code, shark_controller_ != nullptr /* fetch_additional_token */);
|
| }
|
|
|
| -void EnrollmentScreen::OnLicenseTypeSelected(const std::string& license_type) {}
|
| +void EnrollmentScreen::OnLicenseTypeSelected(const std::string& license_type) {
|
| + view_->ShowEnrollmentSpinnerScreen();
|
| + const ::policy::LicenseType license = GetLicenseTypeById(license_type);
|
| + CHECK(license != ::policy::LicenseType::UNKNOWN)
|
| + << "license_type = " << license_type;
|
| + enrollment_helper_->UseLicenseType(license);
|
| +}
|
|
|
| void EnrollmentScreen::OnRetry() {
|
| retry_task_.Cancel();
|
| @@ -265,6 +299,14 @@ void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) {
|
| view_->ShowAuthError(error);
|
| }
|
|
|
| +void EnrollmentScreen::OnMultipleLicensesAvailable(
|
| + const EnrollmentLicenseMap& licenses) {
|
| + base::DictionaryValue license_dict;
|
| + for (const auto& it : licenses)
|
| + license_dict.SetInteger(GetLicenseIdByType(it.first), it.second);
|
| + view_->ShowLicenseTypeSelectionScreen(license_dict);
|
| +}
|
| +
|
| void EnrollmentScreen::OnEnrollmentError(policy::EnrollmentStatus status) {
|
| // TODO(pbond): remove this LOG once http://crbug.com/586961 is fixed.
|
| LOG(WARNING) << "Enrollment error occured: status=" << status.status()
|
|
|