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/extensions/shell_window_registry.h" | 11 #include "chrome/browser/extensions/shell_window_registry.h" |
12 #include "chrome/browser/profiles/profile_keyed_service.h" | 12 #include "chrome/browser/profiles/profile_keyed_service.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 class Extension; | 17 class Extension; |
18 | |
19 namespace app_file_handler_util { | |
20 struct SavedFileEntry; | |
21 } | |
22 | |
23 } | 18 } |
24 | 19 |
25 class Profile; | 20 class Profile; |
26 | 21 |
27 using extensions::app_file_handler_util::SavedFileEntry; | |
28 | |
29 namespace apps { | 22 namespace apps { |
30 | 23 |
31 // Tracks what apps need to be restarted when the browser restarts. | 24 // Tracks what apps need to be restarted when the browser restarts. |
32 class AppRestoreService : public ProfileKeyedService, | 25 class AppRestoreService : public ProfileKeyedService, |
33 public content::NotificationObserver, | 26 public content::NotificationObserver, |
34 public extensions::ShellWindowRegistry::Observer { | 27 public extensions::ShellWindowRegistry::Observer { |
35 public: | 28 public: |
36 // Returns true if apps should be restored on the current platform, given | 29 // Returns true if apps should be restored on the current platform, given |
37 // whether this new browser process launched due to a restart. | 30 // whether this new browser process launched due to a restart. |
38 static bool ShouldRestoreApps(bool is_browser_restart); | 31 static bool ShouldRestoreApps(bool is_browser_restart); |
(...skipping 15 matching lines...) Expand all Loading... |
54 virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE; | 47 virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE; |
55 virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE; | 48 virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE; |
56 | 49 |
57 // ProfileKeyedService. | 50 // ProfileKeyedService. |
58 virtual void Shutdown() OVERRIDE; | 51 virtual void Shutdown() OVERRIDE; |
59 | 52 |
60 void RecordAppStart(const std::string& extension_id); | 53 void RecordAppStart(const std::string& extension_id); |
61 void RecordAppStop(const std::string& extension_id); | 54 void RecordAppStop(const std::string& extension_id); |
62 void RecordIfAppHasWindows(const std::string& id); | 55 void RecordIfAppHasWindows(const std::string& id); |
63 | 56 |
64 void RestoreApp( | 57 void RestoreApp(const extensions::Extension* extension); |
65 const extensions::Extension* extension, | |
66 const std::vector<SavedFileEntry>& file_entries); | |
67 | 58 |
68 void StartObservingShellWindows(); | 59 void StartObservingShellWindows(); |
69 void StopObservingShellWindows(); | 60 void StopObservingShellWindows(); |
70 | 61 |
71 content::NotificationRegistrar registrar_; | 62 content::NotificationRegistrar registrar_; |
72 Profile* profile_; | 63 Profile* profile_; |
73 | 64 |
74 DISALLOW_COPY_AND_ASSIGN(AppRestoreService); | 65 DISALLOW_COPY_AND_ASSIGN(AppRestoreService); |
75 }; | 66 }; |
76 | 67 |
77 } // namespace apps | 68 } // namespace apps |
78 | 69 |
79 #endif // APPS_APP_RESTORE_SERVICE_H_ | 70 #endif // APPS_APP_RESTORE_SERVICE_H_ |
OLD | NEW |