Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_update_service.h

Issue 491403003: Update cached kiosk app crx from usb stick. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h"
14 #include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h" 15 #include "chrome/browser/chromeos/system/automatic_reboot_manager_observer.h"
15 #include "components/keyed_service/content/browser_context_keyed_service_factory .h" 16 #include "components/keyed_service/content/browser_context_keyed_service_factory .h"
16 #include "components/keyed_service/core/keyed_service.h" 17 #include "components/keyed_service/core/keyed_service.h"
17 #include "extensions/browser/update_observer.h" 18 #include "extensions/browser/update_observer.h"
18 19
19 class Profile; 20 class Profile;
20 21
21 namespace extensions { 22 namespace extensions {
22 class Extension; 23 class Extension;
23 } 24 }
24 25
25 namespace chromeos { 26 namespace chromeos {
26 27
27 namespace system { 28 namespace system {
28 class AutomaticRebootManager; 29 class AutomaticRebootManager;
29 } 30 }
30 31
31 // This class enforces automatic restart on app and Chrome updates in app mode. 32 // This class enforces automatic restart on app and Chrome updates in app mode.
32 class KioskAppUpdateService : public KeyedService, 33 class KioskAppUpdateService : public KeyedService,
33 public extensions::UpdateObserver, 34 public extensions::UpdateObserver,
34 public system::AutomaticRebootManagerObserver { 35 public system::AutomaticRebootManagerObserver,
36 public KioskAppManagerObserver {
35 public: 37 public:
36 KioskAppUpdateService( 38 KioskAppUpdateService(
37 Profile* profile, 39 Profile* profile,
38 system::AutomaticRebootManager* automatic_reboot_manager); 40 system::AutomaticRebootManager* automatic_reboot_manager);
39 virtual ~KioskAppUpdateService(); 41 virtual ~KioskAppUpdateService();
40 42
41 void set_app_id(const std::string& app_id) { app_id_ = app_id; } 43 void set_app_id(const std::string& app_id) { app_id_ = app_id; }
42 std::string get_app_id() const { return app_id_; } 44 std::string get_app_id() const { return app_id_; }
43 45
44 private: 46 private:
45 friend class KioskAppUpdateServiceTest; 47 friend class KioskAppUpdateServiceTest;
46 48
47 void StartAppUpdateRestartTimer(); 49 void StartAppUpdateRestartTimer();
48 void ForceAppUpdateRestart(); 50 void ForceAppUpdateRestart();
49 51
50 // KeyedService overrides: 52 // KeyedService overrides:
51 virtual void Shutdown() OVERRIDE; 53 virtual void Shutdown() OVERRIDE;
52 54
53 // extensions::UpdateObserver overrides: 55 // extensions::UpdateObserver overrides:
54 virtual void OnAppUpdateAvailable( 56 virtual void OnAppUpdateAvailable(
55 const extensions::Extension* extension) OVERRIDE; 57 const extensions::Extension* extension) OVERRIDE;
56 virtual void OnChromeUpdateAvailable() OVERRIDE {} 58 virtual void OnChromeUpdateAvailable() OVERRIDE {}
57 59
58 // system::AutomaticRebootManagerObserver overrides: 60 // system::AutomaticRebootManagerObserver overrides:
59 virtual void OnRebootScheduled(Reason reason) OVERRIDE; 61 virtual void OnRebootScheduled(Reason reason) OVERRIDE;
60 virtual void WillDestroyAutomaticRebootManager() OVERRIDE; 62 virtual void WillDestroyAutomaticRebootManager() OVERRIDE;
61 63
64 // KioskAppManagerObserver overrides:
65 virtual void OnKioskAppCacheUpdated(const std::string& app_id) OVERRIDE;
66
62 Profile* profile_; 67 Profile* profile_;
63 std::string app_id_; 68 std::string app_id_;
64 69
65 // After we detect an upgrade we start a one-short timer to force restart. 70 // After we detect an upgrade we start a one-short timer to force restart.
66 base::OneShotTimer<KioskAppUpdateService> restart_timer_; 71 base::OneShotTimer<KioskAppUpdateService> restart_timer_;
67 72
68 system::AutomaticRebootManager* automatic_reboot_manager_; // Not owned. 73 system::AutomaticRebootManager* automatic_reboot_manager_; // Not owned.
69 74
70 DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateService); 75 DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateService);
71 }; 76 };
(...skipping 16 matching lines...) Expand all
88 virtual ~KioskAppUpdateServiceFactory(); 93 virtual ~KioskAppUpdateServiceFactory();
89 94
90 // BrowserContextKeyedServiceFactory overrides: 95 // BrowserContextKeyedServiceFactory overrides:
91 virtual KeyedService* BuildServiceInstanceFor( 96 virtual KeyedService* BuildServiceInstanceFor(
92 content::BrowserContext* profile) const OVERRIDE; 97 content::BrowserContext* profile) const OVERRIDE;
93 }; 98 };
94 99
95 } // namespace chromeos 100 } // namespace chromeos
96 101
97 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_ 102 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698