Make KioskExternalUpdater::ExternalUpdateStatus an enum class
This CL is part of the Chrome OS source code directory migration:
https://docs.google.com/document/d/1g-98HpzA8XcoGBWUv1gQNr4rbnD5yfvbtYZyPDDbkaE.
Bug: 1101837, 1164001
Change-Id: I0108d52f30555e3945a324cf73038a0e39618d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640353
Owners-Override: James Cook <jamescook@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Auto-Submit: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845834}
diff --git a/chrome/browser/chromeos/app_mode/kiosk_external_updater.cc b/chrome/browser/chromeos/app_mode/kiosk_external_updater.cc
index c7c133d..6fabaf6 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_external_updater.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_external_updater.cc
@@ -162,7 +162,7 @@
return;
if (!ShouldDoExternalUpdate(app_id, version, min_browser_version)) {
- external_updates_[app_id].update_status = FAILED;
+ external_updates_[app_id].update_status = UpdateStatus::kFailed;
MaybeValidateNextExternalUpdate();
return;
}
@@ -190,7 +190,7 @@
if (CheckExternalUpdateInterrupted())
return;
- external_updates_[app_id].update_status = FAILED;
+ external_updates_[app_id].update_status = UpdateStatus::kFailed;
external_updates_[app_id].error =
ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
IDS_KIOSK_EXTERNAL_UPDATE_BAD_CRX);
@@ -266,7 +266,7 @@
external_update_path_.AppendASCII(external_crx_str),
extensions::GetExternalVerifierFormat());
update.external_crx.extension_id = app_id;
- update.update_status = PENDING;
+ update.update_status = UpdateStatus::kPending;
external_updates_[app_id] = update;
}
@@ -296,7 +296,7 @@
void KioskExternalUpdater::ValidateExternalUpdates() {
for (const auto& it : external_updates_) {
const ExternalUpdate& update = it.second;
- if (update.update_status == PENDING) {
+ if (update.update_status == UpdateStatus::kPending) {
auto crx_validator = base::MakeRefCounted<KioskExternalUpdateValidator>(
backend_task_runner_, update.external_crx, crx_unpack_dir_,
weak_factory_.GetWeakPtr());
@@ -308,7 +308,7 @@
bool KioskExternalUpdater::IsExternalUpdatePending() const {
for (const auto& it : external_updates_) {
- if (it.second.update_status == PENDING)
+ if (it.second.update_status == UpdateStatus::kPending)
return true;
}
return false;
@@ -316,7 +316,7 @@
bool KioskExternalUpdater::IsAllExternalUpdatesSucceeded() const {
for (const auto& it : external_updates_) {
- if (it.second.update_status != SUCCESS)
+ if (it.second.update_status != UpdateStatus::kSuccess)
return false;
}
return true;
@@ -366,7 +366,7 @@
if (!crx_copied) {
LOG(ERROR) << "Cannot copy external crx file to " << crx_file.value();
- external_updates_[app_id].update_status = FAILED;
+ external_updates_[app_id].update_status = UpdateStatus::kFailed;
external_updates_[app_id].error = l10n_util::GetStringFUTF16(
IDS_KIOSK_EXTERNAL_UPDATE_FAILED_COPY_CRX_TO_TEMP,
base::UTF8ToUTF16(crx_file.value()));
@@ -388,12 +388,12 @@
return;
if (!success) {
- external_updates_[app_id].update_status = FAILED;
+ external_updates_[app_id].update_status = UpdateStatus::kFailed;
external_updates_[app_id].error = l10n_util::GetStringFUTF16(
IDS_KIOSK_EXTERNAL_UPDATE_CANNOT_INSTALL_IN_LOCAL_CACHE,
base::UTF8ToUTF16(external_updates_[app_id].external_crx.path.value()));
} else {
- external_updates_[app_id].update_status = SUCCESS;
+ external_updates_[app_id].update_status = UpdateStatus::kSuccess;
}
// Validate the next pending external update.
@@ -421,7 +421,7 @@
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
for (const auto& it : external_updates_) {
- if (it.second.update_status == SUCCESS) {
+ if (it.second.update_status == UpdateStatus::kSuccess) {
KioskAppManager::Get()->OnKioskAppCacheUpdated(it.first);
}
}
@@ -450,13 +450,13 @@
for (const auto& it : external_updates_) {
const ExternalUpdate& update = it.second;
base::string16 app_name = base::UTF8ToUTF16(update.app_name);
- if (update.update_status == SUCCESS) {
+ if (update.update_status == UpdateStatus::kSuccess) {
++updated;
if (updated_apps.empty())
updated_apps = app_name;
else
updated_apps += base::ASCIIToUTF16(", ") + app_name;
- } else { // FAILED
+ } else { // UpdateStatus::kFailed
++failed;
if (failed_apps.empty()) {
failed_apps = app_name + base::ASCIIToUTF16(": ") + update.error;
diff --git a/chrome/browser/chromeos/app_mode/kiosk_external_updater.h b/chrome/browser/chromeos/app_mode/kiosk_external_updater.h
index 63ad13259..c8a0e7ec 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_external_updater.h
+++ b/chrome/browser/chromeos/app_mode/kiosk_external_updater.h
@@ -40,10 +40,10 @@
~KioskExternalUpdater() override;
private:
- enum ExternalUpdateStatus {
- PENDING,
- SUCCESS,
- FAILED,
+ enum class UpdateStatus {
+ kPending,
+ kSuccess,
+ kFailed,
};
struct ExternalUpdate {
ExternalUpdate();
@@ -52,7 +52,7 @@
std::string app_name;
extensions::CRXFileInfo external_crx;
- ExternalUpdateStatus update_status;
+ UpdateStatus update_status;
base::string16 error;
};