OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_APP_RESTORE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ |
7 | 7 |
| 8 #include <string> |
| 9 |
8 #include "chrome/browser/profiles/profile_keyed_service.h" | 10 #include "chrome/browser/profiles/profile_keyed_service.h" |
9 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
11 | 13 |
12 #include <string> | |
13 | |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
| 17 class Extension; |
| 18 } |
17 | 19 |
18 class Extension; | 20 namespace apps { |
19 | 21 |
20 // Tracks what apps need to be restarted when the browser restarts. | 22 // Tracks what apps need to be restarted when the browser restarts. |
21 class AppRestoreService : public ProfileKeyedService, | 23 class AppRestoreService : public ProfileKeyedService, |
22 public content::NotificationObserver { | 24 public content::NotificationObserver { |
23 public: | 25 public: |
24 explicit AppRestoreService(Profile* profile); | 26 explicit AppRestoreService(Profile* profile); |
25 | 27 |
26 // Restart apps that need to be restarted and clear the "running" preference | 28 // Restart apps that need to be restarted and clear the "running" preference |
27 // from apps to prevent them being restarted in subsequent restarts. | 29 // from apps to prevent them being restarted in subsequent restarts. |
28 void HandleStartup(bool should_restore_apps); | 30 void HandleStartup(bool should_restore_apps); |
29 | 31 |
30 private: | 32 private: |
31 // content::NotificationObserver. | 33 // content::NotificationObserver. |
32 virtual void Observe(int type, | 34 virtual void Observe(int type, |
33 const content::NotificationSource& source, | 35 const content::NotificationSource& source, |
34 const content::NotificationDetails& details) OVERRIDE; | 36 const content::NotificationDetails& details) OVERRIDE; |
35 | 37 |
36 void RecordAppStart(const std::string& extension_id); | 38 void RecordAppStart(const std::string& extension_id); |
37 void RecordAppStop(const std::string& extension_id); | 39 void RecordAppStop(const std::string& extension_id); |
38 void RestoreApp(const Extension* extension); | 40 void RestoreApp(const extensions::Extension* extension); |
39 | 41 |
40 content::NotificationRegistrar registrar_; | 42 content::NotificationRegistrar registrar_; |
41 Profile* profile_; | 43 Profile* profile_; |
42 }; | 44 }; |
43 | 45 |
44 } // namespace extensions | 46 } // namespace apps |
45 | 47 |
46 #endif // CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ | 48 #endif // CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_ |
OLD | NEW |