summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd7
-rw-r--r--chrome/browser/chromeos/cros/mock_update_library.h3
-rw-r--r--chrome/browser/chromeos/cros/update_library.cc20
-rw-r--r--chrome/browser/chromeos/cros/update_library.h10
-rw-r--r--chrome/browser/chromeos/login/update_screen.cc182
-rw-r--r--chrome/browser/chromeos/login/update_screen.h32
-rw-r--r--chrome/browser/chromeos/login/update_view.cc44
-rw-r--r--chrome/browser/chromeos/login/update_view.h19
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc2
-rw-r--r--chrome/browser/chromeos/update_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/update_observer.cc6
-rw-r--r--chrome/browser/chromeos/update_observer.h2
12 files changed, 203 insertions, 126 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index caf5e10..0aef3cd 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7725,8 +7725,11 @@ Keep your key file in a safe place. You will need it to create new versions of y
System update complete. Please restart the system by pressing the power
button, wait for the system to power down, then press the power button again.
</message>
- <message name="IDS_INSTALLING_UPDATE" desc="Label shown on the updates installation screen">
- Please wait while <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> installs an important update.\nYour computer will restart after this is complete.
+ <message name="IDS_INSTALLING_UPDATE" desc="Label shown on the updates installation screen during OOBE">
+ Please wait while <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph> installs the latest system updates.
+ </message>
+ <message name="IDS_INSTALLING_UPDATE_DESC" desc="Additional info shown on the updates installation screen during OOBE">
+ Your computer will restart when the update is complete.
</message>
<message name="IDS_NETWORK_SELECTION_TITLE" desc="Welcome title shown on network selection screen">
Welcome to <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph>
diff --git a/chrome/browser/chromeos/cros/mock_update_library.h b/chrome/browser/chromeos/cros/mock_update_library.h
index 0a85f12..d4f14cb 100644
--- a/chrome/browser/chromeos/cros/mock_update_library.h
+++ b/chrome/browser/chromeos/cros/mock_update_library.h
@@ -18,7 +18,8 @@ class MockUpdateLibrary : public UpdateLibrary {
virtual ~MockUpdateLibrary() {}
MOCK_METHOD1(AddObserver, void(Observer*)); // NOLINT
MOCK_METHOD1(RemoveObserver, void(Observer*)); // NOLINT
-
+ MOCK_METHOD0(CheckForUpdate, bool(void));
+ MOCK_METHOD0(RebootAfterUpdate, bool(void));
MOCK_CONST_METHOD0(status, const Status&(void));
private:
diff --git a/chrome/browser/chromeos/cros/update_library.cc b/chrome/browser/chromeos/cros/update_library.cc
index 0ea5f2c..320ab45 100644
--- a/chrome/browser/chromeos/cros/update_library.cc
+++ b/chrome/browser/chromeos/cros/update_library.cc
@@ -36,6 +36,20 @@ void UpdateLibraryImpl::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
+bool UpdateLibraryImpl::CheckForUpdate() {
+ if (!CrosLibrary::Get()->EnsureLoaded())
+ return false;
+
+ return InitiateUpdateCheck();
+}
+
+bool UpdateLibraryImpl::RebootAfterUpdate() {
+ if (!CrosLibrary::Get()->EnsureLoaded())
+ return false;
+
+ return RebootIfUpdated();
+}
+
const UpdateLibrary::Status& UpdateLibraryImpl::status() const {
return status_;
}
@@ -43,8 +57,8 @@ const UpdateLibrary::Status& UpdateLibraryImpl::status() const {
// static
void UpdateLibraryImpl::ChangedHandler(void* object,
const UpdateProgress& status) {
- UpdateLibraryImpl* power = static_cast<UpdateLibraryImpl*>(object);
- power->UpdateStatus(Status(status));
+ UpdateLibraryImpl* updater = static_cast<UpdateLibraryImpl*>(object);
+ updater->UpdateStatus(Status(status));
}
void UpdateLibraryImpl::Init() {
@@ -61,7 +75,7 @@ void UpdateLibraryImpl::UpdateStatus(const Status& status) {
}
status_ = status;
- FOR_EACH_OBSERVER(Observer, observers_, Changed(this));
+ FOR_EACH_OBSERVER(Observer, observers_, UpdateStatusChanged(this));
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/update_library.h b/chrome/browser/chromeos/cros/update_library.h
index 5d10a38..223426e 100644
--- a/chrome/browser/chromeos/cros/update_library.h
+++ b/chrome/browser/chromeos/cros/update_library.h
@@ -53,13 +53,19 @@ class UpdateLibrary {
class Observer {
public:
virtual ~Observer() { }
- virtual void Changed(UpdateLibrary* obj) = 0;
+ virtual void UpdateStatusChanged(UpdateLibrary* library) = 0;
};
virtual ~UpdateLibrary() {}
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
+ // Initiates update check and returns true if check was initiated.
+ virtual bool CheckForUpdate() = 0;
+
+ // Reboots if update has been performed.
+ virtual bool RebootAfterUpdate() = 0;
+
virtual const Status& status() const = 0;
};
@@ -72,6 +78,8 @@ class UpdateLibraryImpl : public UpdateLibrary {
virtual void AddObserver(Observer* observer);
virtual void RemoveObserver(Observer* observer);
+ virtual bool CheckForUpdate();
+ virtual bool RebootAfterUpdate();
virtual const Status& status() const;
private:
diff --git a/chrome/browser/chromeos/login/update_screen.cc b/chrome/browser/chromeos/login/update_screen.cc
index 8e9a05a..7f801f1 100644
--- a/chrome/browser/chromeos/login/update_screen.cc
+++ b/chrome/browser/chromeos/login/update_screen.cc
@@ -5,18 +5,31 @@
#include "chrome/browser/chromeos/login/update_screen.h"
#include "base/logging.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/login/screen_observer.h"
#include "chrome/browser/chromeos/login/update_view.h"
namespace {
// Update window should appear for at least kMinimalUpdateTime seconds.
-const int kMinimalUpdateTime = 3;
+const int kMinimalUpdateTimeSec = 3;
-// Progress bar increment step.
-const int kBeforeUpdateCheckProgressIncrement = 10;
-const int kAfterUpdateCheckProgressIncrement = 10;
-const int kUpdateCompleteProgressIncrement = 75;
+// Time in seconds that we wait for the device to reboot.
+// If reboot didn't happen, ask user to reboot device manually.
+const int kWaitForRebootTimeSec = 3;
+
+// Progress bar stages. Each represents progress bar value
+// at the beginning of each stage.
+// TODO(nkostylev): Base stage progress values on approximate time.
+// TODO(nkostylev): Animate progress during each state.
+const int kBeforeUpdateCheckProgress = 7;
+const int kBeforeDownloadProgress = 14;
+const int kBeforeVerifyingProgress = 74;
+const int kBeforeFinalizingProgress = 81;
+const int kProgressComplete = 100;
+
+// Defines what part of update progress does download part takes.
+const int kDownloadProgressIncrement = 60;
} // anonymous namespace
@@ -24,8 +37,7 @@ namespace chromeos {
UpdateScreen::UpdateScreen(WizardScreenDelegate* delegate)
: DefaultViewScreen<chromeos::UpdateView>(delegate),
- update_result_(UPGRADE_STARTED),
- update_error_(GOOGLE_UPDATE_NO_ERROR),
+ proceed_with_oobe_(false),
checking_for_update_(true) {
}
@@ -33,55 +45,57 @@ UpdateScreen::~UpdateScreen() {
// Remove pointer to this object from view.
if (view())
view()->set_controller(NULL);
- // Google Updater is holding a pointer to us until it reports status,
- // so we need to remove it in case we were still listening.
- if (google_updater_.get())
- google_updater_->set_status_listener(NULL);
+ CrosLibrary::Get()->GetUpdateLibrary()->RemoveObserver(this);
}
-void UpdateScreen::OnReportResults(GoogleUpdateUpgradeResult result,
- GoogleUpdateErrorCode error_code,
- const std::wstring& version) {
- // Drop the last reference to the object so that it gets cleaned up here.
- if (google_updater_.get()) {
- google_updater_->set_status_listener(NULL);
- google_updater_ = NULL;
+void UpdateScreen::UpdateStatusChanged(UpdateLibrary* library) {
+ UpdateStatusOperation status = library->status().status;
+ LOG(INFO) << "Update status: " << status;
+ if (checking_for_update_ && status > UPDATE_STATUS_CHECKING_FOR_UPDATE) {
+ checking_for_update_ = false;
}
- // Depending on the result decide what to do next.
- update_result_ = result;
- update_error_ = error_code;
- LOG(INFO) << "Update result: " << result;
- if (error_code != GOOGLE_UPDATE_NO_ERROR)
- LOG(INFO) << "Update error code: " << error_code;
- LOG(INFO) << "Update version: " << version;
- switch (update_result_) {
- case UPGRADE_IS_AVAILABLE:
- checking_for_update_ = false;
- // Advance view progress bar.
- view()->AddProgress(kAfterUpdateCheckProgressIncrement);
- // Create new Google Updater instance and install the update.
- google_updater_ = CreateGoogleUpdate();
- google_updater_->CheckForUpdate(true, NULL);
- LOG(INFO) << "Installing an update";
+
+ switch (status) {
+ case UPDATE_STATUS_CHECKING_FOR_UPDATE:
+ // Do nothing in these cases, we don't want to notify the user of the
+ // check unless there is an update.
break;
- case UPGRADE_SUCCESSFUL:
- view()->AddProgress(kUpdateCompleteProgressIncrement);
- minimal_update_time_timer_.Stop();
- checking_for_update_ = false;
- // TODO(nkostylev): Call reboot API. http://crosbug.com/4002
- ExitUpdate();
+ case UPDATE_STATUS_UPDATE_AVAILABLE:
+ view()->SetProgress(kBeforeDownloadProgress);
+ LOG(INFO) << "Update available: " << library->status().new_version;
+ break;
+ case UPDATE_STATUS_DOWNLOADING:
+ {
+ int download_progress = static_cast<int>(
+ library->status().download_progress * kDownloadProgressIncrement);
+ view()->SetProgress(kBeforeDownloadProgress + download_progress);
+ }
+ break;
+ case UPDATE_STATUS_VERIFYING:
+ view()->SetProgress(kBeforeVerifyingProgress);
break;
- case UPGRADE_ALREADY_UP_TO_DATE:
- checking_for_update_ = false;
- view()->AddProgress(kAfterUpdateCheckProgressIncrement);
- // Fall through.
- case UPGRADE_ERROR:
+ case UPDATE_STATUS_FINALIZING:
+ view()->SetProgress(kBeforeFinalizingProgress);
+ break;
+ case UPDATE_STATUS_UPDATED_NEED_REBOOT:
+ view()->SetProgress(kProgressComplete);
+ CrosLibrary::Get()->GetUpdateLibrary()->RebootAfterUpdate();
+ LOG(INFO) << "Reboot API was called. Waiting for reboot.";
+ reboot_timer_.Start(base::TimeDelta::FromSeconds(kWaitForRebootTimeSec),
+ this,
+ &UpdateScreen::OnWaitForRebootTimeElapsed);
+ break;
+ case UPDATE_STATUS_IDLE:
+ case UPDATE_STATUS_ERROR:
+ case UPDATE_STATUS_REPORTING_ERROR_EVENT:
if (MinimalUpdateTimeElapsed()) {
ExitUpdate();
}
+ proceed_with_oobe_ = true;
break;
default:
NOTREACHED();
+ break;
}
}
@@ -92,51 +106,51 @@ void UpdateScreen::StartUpdate() {
// Start the minimal update time timer.
minimal_update_time_timer_.Start(
- base::TimeDelta::FromSeconds(kMinimalUpdateTime),
+ base::TimeDelta::FromSeconds(kMinimalUpdateTimeSec),
this,
&UpdateScreen::OnMinimalUpdateTimeElapsed);
- // Create Google Updater object and check if there is an update available.
- checking_for_update_ = true;
- google_updater_ = CreateGoogleUpdate();
- google_updater_->CheckForUpdate(false, NULL);
- view()->AddProgress(kBeforeUpdateCheckProgressIncrement);
- LOG(INFO) << "Checking for update";
+ view()->SetProgress(kBeforeUpdateCheckProgress);
+
+ if (!CrosLibrary::Get()->EnsureLoaded()) {
+ LOG(ERROR) << "Error loading CrosLibrary";
+ } else {
+ CrosLibrary::Get()->GetUpdateLibrary()->AddObserver(this);
+ LOG(INFO) << "Checking for update";
+ if (!CrosLibrary::Get()->GetUpdateLibrary()->CheckForUpdate()) {
+ ExitUpdate();
+ }
+ }
}
void UpdateScreen::CancelUpdate() {
#if !defined(OFFICIAL_BUILD)
- update_result_ = UPGRADE_ALREADY_UP_TO_DATE;
- update_error_ = GOOGLE_UPDATE_NO_ERROR;
ExitUpdate();
#endif
}
void UpdateScreen::ExitUpdate() {
- if (google_updater_.get()) {
- google_updater_->set_status_listener(NULL);
- google_updater_ = NULL;
- }
minimal_update_time_timer_.Stop();
ScreenObserver* observer = delegate()->GetObserver(this);
- if (observer) {
- switch (update_result_) {
- case UPGRADE_ALREADY_UP_TO_DATE:
- observer->OnExit(ScreenObserver::UPDATE_NOUPDATE);
- break;
- case UPGRADE_SUCCESSFUL:
- observer->OnExit(ScreenObserver::UPDATE_INSTALLED);
- break;
- case UPGRADE_ERROR:
- if (checking_for_update_) {
- observer->OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE);
- } else {
- observer->OnExit(ScreenObserver::UPDATE_ERROR_UPDATING);
- }
- break;
- default:
- NOTREACHED();
- }
+
+ if (!CrosLibrary::Get()->EnsureLoaded()) {
+ observer->OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE);
+ }
+
+ UpdateLibrary* update_library = CrosLibrary::Get()->GetUpdateLibrary();
+ update_library->RemoveObserver(this);
+ switch (update_library->status().status) {
+ case UPDATE_STATUS_IDLE:
+ observer->OnExit(ScreenObserver::UPDATE_NOUPDATE);
+ break;
+ case UPDATE_STATUS_ERROR:
+ case UPDATE_STATUS_REPORTING_ERROR_EVENT:
+ observer->OnExit(checking_for_update_ ?
+ ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE :
+ ScreenObserver::UPDATE_ERROR_UPDATING);
+ break;
+ default:
+ NOTREACHED();
}
}
@@ -144,18 +158,14 @@ bool UpdateScreen::MinimalUpdateTimeElapsed() {
return !minimal_update_time_timer_.IsRunning();
}
-GoogleUpdate* UpdateScreen::CreateGoogleUpdate() {
- GoogleUpdate* updater = new GoogleUpdate();
- updater->set_status_listener(this);
- return updater;
-}
-
void UpdateScreen::OnMinimalUpdateTimeElapsed() {
- if (update_result_ == UPGRADE_SUCCESSFUL ||
- update_result_ == UPGRADE_ALREADY_UP_TO_DATE ||
- update_result_ == UPGRADE_ERROR) {
+ if (proceed_with_oobe_)
ExitUpdate();
- }
+}
+
+void UpdateScreen::OnWaitForRebootTimeElapsed() {
+ LOG(ERROR) << "Unable to reboot - asking user for a manual reboot.";
+ view()->ShowManualRebootInfo();
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/update_screen.h b/chrome/browser/chromeos/login/update_screen.h
index 8ab88f7..c6fb76b 100644
--- a/chrome/browser/chromeos/login/update_screen.h
+++ b/chrome/browser/chromeos/login/update_screen.h
@@ -8,9 +8,9 @@
#include "base/ref_counted.h"
#include "base/timer.h"
+#include "chrome/browser/chromeos/cros/update_library.h"
#include "chrome/browser/chromeos/login/update_view.h"
#include "chrome/browser/chromeos/login/view_screen.h"
-#include "chrome/browser/google_update.h"
namespace chromeos {
@@ -23,16 +23,14 @@ class UpdateController {
};
class UpdateScreen: public DefaultViewScreen<chromeos::UpdateView>,
- public GoogleUpdateStatusListener,
+ public UpdateLibrary::Observer,
public UpdateController {
public:
explicit UpdateScreen(WizardScreenDelegate* delegate);
virtual ~UpdateScreen();
- // Overridden from GoogleUpdateStatusListener:
- virtual void OnReportResults(GoogleUpdateUpgradeResult result,
- GoogleUpdateErrorCode error_code,
- const std::wstring& version);
+ // UpdateLibrary::Observer implementation:
+ virtual void UpdateStatusChanged(UpdateLibrary* library);
// Overridden from UpdateController:
virtual void StartUpdate();
@@ -40,25 +38,27 @@ class UpdateScreen: public DefaultViewScreen<chromeos::UpdateView>,
// Reports update results to the ScreenObserver.
virtual void ExitUpdate();
+
// Returns true if minimal update time has elapsed.
virtual bool MinimalUpdateTimeElapsed();
- // Creates GoogleUpdate object.
- virtual GoogleUpdate* CreateGoogleUpdate();
private:
- // Timer notification handler.
+ // Timer notification handlers.
void OnMinimalUpdateTimeElapsed();
+ void OnWaitForRebootTimeElapsed();
- // Timer.
+ // Timer for the minimal interval when update screen is shown.
base::OneShotTimer<UpdateScreen> minimal_update_time_timer_;
- // Update status.
- GoogleUpdateUpgradeResult update_result_;
- GoogleUpdateErrorCode update_error_;
- bool checking_for_update_;
+ // Timer for the interval to wait for the reboot.
+ // If reboot didn't happen - ask user to reboot manually.
+ base::OneShotTimer<UpdateScreen> reboot_timer_;
- // Google Updater.
- scoped_refptr<GoogleUpdate> google_updater_;
+ // True if should proceed with OOBE once timer is elapsed.
+ bool proceed_with_oobe_;
+
+ // True if in the process of checking for update.
+ bool checking_for_update_;
DISALLOW_COPY_AND_ASSIGN(UpdateScreen);
};
diff --git a/chrome/browser/chromeos/login/update_view.cc b/chrome/browser/chromeos/login/update_view.cc
index 9facdbe..53943a8 100644
--- a/chrome/browser/chromeos/login/update_view.cc
+++ b/chrome/browser/chromeos/login/update_view.cc
@@ -25,12 +25,18 @@ using views::Widget;
namespace {
+// TODO(nkostylev): Switch to GridLayout.
+
+// Y offset for the 'installing updates' label.
+const int kManualRebootLabelY = 100;
// Y offset for the 'installing updates' label.
-const int kInstallingUpdatesLabelY = 200;
+const int kInstallingUpdatesLabelY = 130;
// Y offset for the progress bar.
-const int kProgressBarY = 250;
+const int kProgressBarY = 200;
+// Y offset for the 'computer will be rebooted' label.
+const int kRebootLabelY = 250;
// Y offset for the 'ESCAPE to skip' label.
-const int kEscapeToSkipLabelY = 290;
+const int kEscapeToSkipLabelY = 300;
// Progress bar width.
const int kProgressBarWidth = 450;
// Horizontal spacing (ex. min left and right margins for label on the screen).
@@ -39,6 +45,7 @@ const int kHorizontalSpacing = 25;
// Label color.
const SkColor kLabelColor = 0xFF000000;
const SkColor kSkipLabelColor = 0xFFAA0000;
+const SkColor kManualRebootLabelColor = 0xFFAA0000;
} // namespace
@@ -47,6 +54,8 @@ namespace chromeos {
UpdateView::UpdateView(chromeos::ScreenObserver* observer)
: escape_accelerator_(base::VKEY_ESCAPE, false, false, false),
installing_updates_label_(NULL),
+ reboot_label_(NULL),
+ manual_reboot_label_(NULL),
progress_bar_(NULL),
observer_(observer) {
}
@@ -61,10 +70,16 @@ void UpdateView::Init() {
set_background(views::Background::CreateBackgroundPainter(true, painter));
ResourceBundle& res_bundle = ResourceBundle::GetSharedInstance();
- gfx::Font base_font = res_bundle.GetFont(ResourceBundle::BaseFont);
+ gfx::Font label_font = res_bundle.GetFont(ResourceBundle::MediumFont);
InitLabel(&installing_updates_label_);
- installing_updates_label_->SetFont(base_font);
+ InitLabel(&reboot_label_);
+ InitLabel(&manual_reboot_label_);
+ installing_updates_label_->SetFont(label_font);
+ reboot_label_->SetFont(label_font);
+ manual_reboot_label_->SetFont(label_font);
+ manual_reboot_label_->SetVisible(false);
+ manual_reboot_label_->SetColor(kManualRebootLabelColor);
progress_bar_ = new views::ProgressBar();
AddChildView(progress_bar_);
@@ -74,7 +89,7 @@ void UpdateView::Init() {
#if !defined(OFFICIAL_BUILD)
escape_to_skip_label_ = new views::Label();
escape_to_skip_label_->SetColor(kSkipLabelColor);
- escape_to_skip_label_->SetFont(base_font);
+ escape_to_skip_label_->SetFont(label_font);
escape_to_skip_label_->SetText(
L"Press ESCAPE to skip (Non-official builds only)");
AddChildView(escape_to_skip_label_);
@@ -92,12 +107,24 @@ void UpdateView::UpdateLocalizedStrings() {
installing_updates_label_->SetText(
l10n_util::GetStringF(IDS_INSTALLING_UPDATE,
l10n_util::GetString(IDS_PRODUCT_OS_NAME)));
+ reboot_label_->SetText(l10n_util::GetString(IDS_INSTALLING_UPDATE_DESC));
+ manual_reboot_label_->SetText(l10n_util::GetString(IDS_UPDATE_COMPLETED));
}
void UpdateView::AddProgress(int ticks) {
progress_bar_->AddProgress(ticks);
}
+void UpdateView::SetProgress(int progress) {
+ progress_bar_->SetProgress(progress);
+}
+
+void UpdateView::ShowManualRebootInfo() {
+ installing_updates_label_->SetVisible(false);
+ reboot_label_->SetVisible(false);
+ manual_reboot_label_->SetVisible(true);
+}
+
// Sets the bounds of the view, placing it at the center of the screen
// with the |y| coordinate provided. |width| could specify desired view width
// otherwise preferred width/height are used.
@@ -117,8 +144,13 @@ void UpdateView::Layout() {
int x_center = width() / 2;
int max_width = width() - GetInsets().width() - 2 * kHorizontalSpacing;
installing_updates_label_->SizeToFit(max_width);
+ reboot_label_->SizeToFit(max_width);
+ manual_reboot_label_->SizeToFit(max_width);
+
+ setViewBounds(manual_reboot_label_, x_center, kManualRebootLabelY);
setViewBounds(installing_updates_label_, x_center, kInstallingUpdatesLabelY);
setViewBounds(progress_bar_, x_center, kProgressBarY, kProgressBarWidth);
+ setViewBounds(reboot_label_, x_center, kRebootLabelY);
#if !defined(OFFICIAL_BUILD)
setViewBounds(escape_to_skip_label_, x_center, kEscapeToSkipLabelY);
#endif
diff --git a/chrome/browser/chromeos/login/update_view.h b/chrome/browser/chromeos/login/update_view.h
index 15588af..9c929f2 100644
--- a/chrome/browser/chromeos/login/update_view.h
+++ b/chrome/browser/chromeos/login/update_view.h
@@ -24,17 +24,24 @@ class UpdateView : public views::View {
explicit UpdateView(ScreenObserver* observer);
virtual ~UpdateView();
- virtual void Init();
- virtual void Reset();
- virtual void UpdateLocalizedStrings();
+ void Init();
+ void Reset();
+ void UpdateLocalizedStrings();
// Sets update controller.
- virtual void set_controller(UpdateController* controller) {
+ void set_controller(UpdateController* controller) {
controller_ = controller;
}
// Advances view's progress bar. Maximum progress is 100.
- virtual void AddProgress(int progress);
+ void AddProgress(int progress);
+
+ // Sets the current value for the progress bar. Maximum progress is 100.
+ void SetProgress(int progress);
+
+ // Shows label with instructions for user to do a manual reboot.
+ // Usually is not called since we rely on API that will reboot after update.
+ void ShowManualRebootInfo();
// views::View implementation:
virtual void Layout();
@@ -49,6 +56,8 @@ class UpdateView : public views::View {
// Dialog controls.
views::Label* installing_updates_label_;
+ views::Label* reboot_label_;
+ views::Label* manual_reboot_label_;
views::Label* escape_to_skip_label_;
views::ProgressBar* progress_bar_;
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index de58c54..c3da978 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -90,7 +90,7 @@ class ContentView : public views::View {
accel_image_screen_(views::Accelerator(base::VKEY_I,
false, true, true)),
accel_eula_screen_(views::Accelerator(base::VKEY_E,
- false, true, true)) {
+ false, true, true)) {
AddAccelerator(accel_account_screen_);
AddAccelerator(accel_login_screen_);
AddAccelerator(accel_network_screen_);
diff --git a/chrome/browser/chromeos/update_browsertest.cc b/chrome/browser/chromeos/update_browsertest.cc
index 9dca0bb..f8dc7bd 100644
--- a/chrome/browser/chromeos/update_browsertest.cc
+++ b/chrome/browser/chromeos/update_browsertest.cc
@@ -34,7 +34,7 @@ void CallObservers(chromeos::MockUpdateLibrary* lib,
.WillRepeatedly((ReturnRef(x)))
.RetiresOnSaturation();
FOR_EACH_OBSERVER(chromeos::UpdateLibrary::Observer, *observers,
- Changed(lib));
+ UpdateStatusChanged(lib));
}
void FireSuccessSequence(chromeos::MockUpdateLibrary* lib,
diff --git a/chrome/browser/chromeos/update_observer.cc b/chrome/browser/chromeos/update_observer.cc
index 56c919e..b73fd0a 100644
--- a/chrome/browser/chromeos/update_observer.cc
+++ b/chrome/browser/chromeos/update_observer.cc
@@ -22,8 +22,8 @@ UpdateObserver::~UpdateObserver() {
notification_.Hide();
}
-void UpdateObserver::Changed(UpdateLibrary* object) {
- switch (object->status().status) {
+void UpdateObserver::UpdateStatusChanged(UpdateLibrary* library) {
+ switch (library->status().status) {
case UPDATE_STATUS_IDLE:
case UPDATE_STATUS_CHECKING_FOR_UPDATE:
// Do nothing in these cases, we don't want to notify the user of the
@@ -36,7 +36,7 @@ void UpdateObserver::Changed(UpdateLibrary* object) {
break;
case UPDATE_STATUS_DOWNLOADING:
{
- int progress = static_cast<int>(object->status().download_progress *
+ int progress = static_cast<int>(library->status().download_progress *
100.0);
if (progress != progress_) {
progress_ = progress;
diff --git a/chrome/browser/chromeos/update_observer.h b/chrome/browser/chromeos/update_observer.h
index 8f9068c..298e116 100644
--- a/chrome/browser/chromeos/update_observer.h
+++ b/chrome/browser/chromeos/update_observer.h
@@ -24,7 +24,7 @@ class UpdateObserver : public UpdateLibrary::Observer {
virtual ~UpdateObserver();
private:
- virtual void Changed(UpdateLibrary* object);
+ virtual void UpdateStatusChanged(UpdateLibrary* library);
SystemNotification notification_;
int progress_; // Last displayed remaining time in minutes