// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_ #pragma once #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" namespace chromeos { class UpdateController { public: // Starts update. virtual void StartUpdate() = 0; // Cancels pending update without error. virtual void CancelUpdate() = 0; }; class UpdateScreen: public DefaultViewScreen<chromeos::UpdateView>, public UpdateLibrary::Observer, public UpdateController { public: explicit UpdateScreen(WizardScreenDelegate* delegate); virtual ~UpdateScreen(); // UpdateLibrary::Observer implementation: virtual void UpdateStatusChanged(UpdateLibrary* library); // Overridden from UpdateController: virtual void StartUpdate(); virtual void CancelUpdate(); // Reports update results to the ScreenObserver. // |forced| should be set to true when calling this method and update status // is not one of UPDATE_STATUS_IDLE, UPDATE_STATUS_ERROR, // UPDATE_STATUS_REPORTING_ERROR_EVENT. virtual void ExitUpdate(bool forced); // Reboot check delay get/set, in seconds. int reboot_check_delay() const { return reboot_check_delay_; } void SetRebootCheckDelay(int seconds); // Returns true if there is critical system update that requires installation // and immediate reboot. bool HasCriticalUpdate(); // Set flag to treat all updates as critical (for test purpose mainly). // Default value is false. void SetAllUpdatesCritical(bool is_critical); private: // Timer notification handlers. void OnWaitForRebootTimeElapsed(); // Timer for the interval to wait for the reboot. // If reboot didn't happen - ask user to reboot manually. base::OneShotTimer<UpdateScreen> reboot_timer_; // True if in the process of checking for update. bool checking_for_update_; // Time in seconds after which we decide that the device has not rebooted // automatically. If reboot didn't happen during this interval, ask user to // reboot device manually. int reboot_check_delay_; // Flag that is used to detect when update download has just started. bool is_downloading_update_; // Is all updates critical? If true, update deadlines are ignored. bool is_all_updates_critical_; DISALLOW_COPY_AND_ASSIGN(UpdateScreen); }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_LOGIN_UPDATE_SCREEN_H_