| Index: chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
|
| diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
|
| index 7421a81a3db7655eee6cfa31f968f293e3fc9446..729da7fad389254917966911e01002de900acf6a 100644
|
| --- a/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
|
| +++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_service.h
|
| @@ -11,6 +11,7 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/singleton.h"
|
| #include "base/timer.h"
|
| +#include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
|
| #include "chrome/browser/extensions/update_observer.h"
|
| #include "components/browser_context_keyed_service/browser_context_keyed_service.h"
|
| #include "components/browser_context_keyed_service/browser_context_keyed_service_factory.h"
|
| @@ -19,34 +20,48 @@ class Profile;
|
|
|
| namespace chromeos {
|
|
|
| +namespace system {
|
| +class AutomaticRebootManager;
|
| +}
|
| +
|
| // This class enforces automatic restart on app and Chrome updates in app mode.
|
| class KioskAppUpdateService : public BrowserContextKeyedService,
|
| - public extensions::UpdateObserver {
|
| + public extensions::UpdateObserver,
|
| + public system::AutomaticRebootManagerObserver {
|
| public:
|
| - explicit KioskAppUpdateService(Profile* profile);
|
| + KioskAppUpdateService(
|
| + Profile* profile,
|
| + system::AutomaticRebootManager* automatic_reboot_manager);
|
| virtual ~KioskAppUpdateService();
|
|
|
| void set_app_id(const std::string& app_id) { app_id_ = app_id; }
|
| std::string get_app_id() const { return app_id_; }
|
|
|
| private:
|
| - void StartRestartTimer();
|
| - void ForceRestart();
|
| + friend class KioskAppUpdateServiceTest;
|
| +
|
| + void StartAppUpdateRestartTimer();
|
| + void ForceAppUpdateRestart();
|
| +
|
| + // BrowserContextKeyedService overrides:
|
| + virtual void Shutdown() OVERRIDE;
|
|
|
| // extensions::UpdateObserver overrides:
|
| virtual void OnAppUpdateAvailable(const std::string& app_id) OVERRIDE;
|
| virtual void OnChromeUpdateAvailable() OVERRIDE {}
|
|
|
| - // BrowserContextKeyedService overrides:
|
| - virtual void Shutdown() OVERRIDE;
|
| + // system::AutomaticRebootManagerObserver overrides:
|
| + virtual void OnRebootScheduled(Reason reason) OVERRIDE;
|
| + virtual void WillDestroyAutomaticRebootManager() OVERRIDE;
|
|
|
| - private:
|
| Profile* profile_;
|
| std::string app_id_;
|
|
|
| // After we detect an upgrade we start a one-short timer to force restart.
|
| base::OneShotTimer<KioskAppUpdateService> restart_timer_;
|
|
|
| + system::AutomaticRebootManager* automatic_reboot_manager_; // Not owned.
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateService);
|
| };
|
|
|
|
|