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 APPS_APP_RESTORE_SERVICE_H_ | 5 #ifndef APPS_APP_RESTORE_SERVICE_H_ |
6 #define APPS_APP_RESTORE_SERVICE_H_ | 6 #define APPS_APP_RESTORE_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/browser/profiles/profile_keyed_service.h" | 11 #include "chrome/browser/profiles/profile_keyed_service.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 class Extension; | 16 class Extension; |
17 | 17 |
18 namespace app_file_handler_util { | 18 namespace app_file_handler_util { |
19 struct SavedFileEntry; | 19 struct SavedFileEntry; |
20 } | 20 } |
21 | 21 |
22 } | 22 } |
23 | 23 |
| 24 class ExtensionService; |
24 class Profile; | 25 class Profile; |
25 | 26 |
26 using extensions::app_file_handler_util::SavedFileEntry; | 27 using extensions::app_file_handler_util::SavedFileEntry; |
27 | 28 |
28 namespace apps { | 29 namespace apps { |
29 | 30 |
30 // Tracks what apps need to be restarted when the browser restarts. | 31 // Tracks what apps need to be restarted when the browser restarts. |
31 class AppRestoreService : public ProfileKeyedService, | 32 class AppRestoreService : public ProfileKeyedService, |
32 public content::NotificationObserver { | 33 public content::NotificationObserver { |
33 public: | 34 public: |
34 explicit AppRestoreService(Profile* profile); | 35 explicit AppRestoreService(Profile* profile); |
35 | 36 |
36 // Restart apps that need to be restarted and clear the "running" preference | 37 // Restart apps that need to be restarted and clear the "running" preference |
37 // from apps to prevent them being restarted in subsequent restarts. | 38 // from apps to prevent them being restarted in subsequent restarts. |
38 void HandleStartup(bool should_restore_apps); | 39 void HandleStartup(bool should_restore_apps); |
39 | 40 |
40 private: | 41 private: |
41 // content::NotificationObserver. | 42 // content::NotificationObserver. |
42 virtual void Observe(int type, | 43 virtual void Observe(int type, |
43 const content::NotificationSource& source, | 44 const content::NotificationSource& source, |
44 const content::NotificationDetails& details) OVERRIDE; | 45 const content::NotificationDetails& details) OVERRIDE; |
45 | 46 |
46 void RecordAppStart(const std::string& extension_id); | 47 void RecordAppStart(const std::string& extension_id); |
47 void RecordAppStop(const std::string& extension_id); | 48 void RecordAppStop(const std::string& extension_id); |
48 void RestoreApp( | 49 void RestoreApp( |
49 const extensions::Extension* extension, | 50 const extensions::Extension* extension, |
50 const std::vector<SavedFileEntry>& file_entries); | 51 const std::vector<SavedFileEntry>& file_entries); |
51 | 52 |
| 53 void LaunchAppWithId(const std::string& extension_id); |
| 54 void MaybeHandleMetroRelaunch(ExtensionService* extension_service); |
| 55 |
52 content::NotificationRegistrar registrar_; | 56 content::NotificationRegistrar registrar_; |
53 Profile* profile_; | 57 Profile* profile_; |
54 | 58 |
55 DISALLOW_COPY_AND_ASSIGN(AppRestoreService); | 59 DISALLOW_COPY_AND_ASSIGN(AppRestoreService); |
56 }; | 60 }; |
57 | 61 |
58 } // namespace apps | 62 } // namespace apps |
59 | 63 |
60 #endif // APPS_APP_RESTORE_SERVICE_H_ | 64 #endif // APPS_APP_RESTORE_SERVICE_H_ |
OLD | NEW |