Chromium Code Reviews| 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..e178e4e817a1c4ae9099fbeae3bd32682f9716b9 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,50 @@ class Profile; |
| namespace chromeos { |
| +class KioskAppUpdateServiceTest; |
|
bartfab (slow)
2013/06/21 06:27:58
Nit: This is not needed. Specifying the class as a
xiyuan
2013/06/21 16:50:56
Done.
|
| + |
| +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: |
| + friend class KioskAppUpdateServiceTest; |
| + |
| void StartRestartTimer(); |
| void ForceRestart(); |
| + // 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 willShutdownAutomaticRebootManager() 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); |
| }; |