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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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.h" 13 #include "base/timer.h"
14 #include "chrome/browser/extensions/update_observer.h" 14 #include "chrome/browser/extensions/update_observer.h"
15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
16 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h" 16 #include "components/browser_context_keyed_service/browser_context_keyed_service _factory.h"
17 17
18 class Profile; 18 class Profile;
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 // This class enforces automatic restart on app and Chrome updates in app mode. 22 // This class enforces automatic restart on app and Chrome updates in app mode.
23 class KioskAppUpdateService : public ProfileKeyedService, 23 class KioskAppUpdateService : public BrowserContextKeyedService,
24 public extensions::UpdateObserver { 24 public extensions::UpdateObserver {
25 public: 25 public:
26 explicit KioskAppUpdateService(Profile* profile); 26 explicit KioskAppUpdateService(Profile* profile);
27 virtual ~KioskAppUpdateService(); 27 virtual ~KioskAppUpdateService();
28 28
29 void set_app_id(const std::string& app_id) { app_id_ = app_id; } 29 void set_app_id(const std::string& app_id) { app_id_ = app_id; }
30 std::string get_app_id() const { return app_id_; } 30 std::string get_app_id() const { return app_id_; }
31 31
32 private: 32 private:
33 void StartRestartTimer(); 33 void StartRestartTimer();
34 void ForceRestart(); 34 void ForceRestart();
35 35
36 // extensions::UpdateObserver overrides: 36 // extensions::UpdateObserver overrides:
37 virtual void OnAppUpdateAvailable(const std::string& app_id) OVERRIDE; 37 virtual void OnAppUpdateAvailable(const std::string& app_id) OVERRIDE;
38 virtual void OnChromeUpdateAvailable() OVERRIDE {} 38 virtual void OnChromeUpdateAvailable() OVERRIDE {}
39 39
40 // ProfileKeyedService overrides: 40 // BrowserContextKeyedService overrides:
41 virtual void Shutdown() OVERRIDE; 41 virtual void Shutdown() OVERRIDE;
42 42
43 private: 43 private:
44 Profile* profile_; 44 Profile* profile_;
45 std::string app_id_; 45 std::string app_id_;
46 46
47 // After we detect an upgrade we start a one-short timer to force restart. 47 // After we detect an upgrade we start a one-short timer to force restart.
48 base::OneShotTimer<KioskAppUpdateService> restart_timer_; 48 base::OneShotTimer<KioskAppUpdateService> restart_timer_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateService); 50 DISALLOW_COPY_AND_ASSIGN(KioskAppUpdateService);
51 }; 51 };
52 52
53 // Singleton that owns all KioskAppUpdateServices and associates them with 53 // Singleton that owns all KioskAppUpdateServices and associates them with
54 // profiles. 54 // profiles.
55 class KioskAppUpdateServiceFactory: public ProfileKeyedServiceFactory { 55 class KioskAppUpdateServiceFactory : public BrowserContextKeyedServiceFactory {
56 public: 56 public:
57 // Returns the KioskAppUpdateService for |profile|, creating it if it is not 57 // Returns the KioskAppUpdateService for |profile|, creating it if it is not
58 // yet created. 58 // yet created.
59 static KioskAppUpdateService* GetForProfile(Profile* profile); 59 static KioskAppUpdateService* GetForProfile(Profile* profile);
60 60
61 // Returns the KioskAppUpdateServiceFactory instance. 61 // Returns the KioskAppUpdateServiceFactory instance.
62 static KioskAppUpdateServiceFactory* GetInstance(); 62 static KioskAppUpdateServiceFactory* GetInstance();
63 63
64 private: 64 private:
65 friend struct DefaultSingletonTraits<KioskAppUpdateServiceFactory>; 65 friend struct DefaultSingletonTraits<KioskAppUpdateServiceFactory>;
66 66
67 KioskAppUpdateServiceFactory(); 67 KioskAppUpdateServiceFactory();
68 virtual ~KioskAppUpdateServiceFactory(); 68 virtual ~KioskAppUpdateServiceFactory();
69 69
70 // ProfileKeyedServiceFactory overrides: 70 // BrowserContextKeyedServiceFactory overrides:
71 virtual ProfileKeyedService* BuildServiceInstanceFor( 71 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
72 content::BrowserContext* profile) const OVERRIDE; 72 content::BrowserContext* profile) const OVERRIDE;
73 }; 73 };
74 74
75 } // namespace chromeos 75 } // namespace chromeos
76 76
77 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_ 77 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_KIOSK_APP_UPDATE_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698