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

Side by Side Diff: apps/app_restore_service.h

Issue 14607023: Add support for persistent file access in apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | apps/app_restore_service.cc » ('j') | apps/saved_files_service.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
18 namespace app_file_handler_util {
19 struct SavedFileEntry;
20 }
21
22 } 17 }
23 18
24 class Profile; 19 class Profile;
25 20
26 using extensions::app_file_handler_util::SavedFileEntry;
27
28 namespace apps { 21 namespace apps {
29 22
30 // Tracks what apps need to be restarted when the browser restarts. 23 // Tracks what apps need to be restarted when the browser restarts.
31 class AppRestoreService : public ProfileKeyedService, 24 class AppRestoreService : public ProfileKeyedService,
32 public content::NotificationObserver { 25 public content::NotificationObserver {
33 public: 26 public:
34 // Returns true if apps should be restored on the current platform, given 27 // Returns true if apps should be restored on the current platform, given
35 // whether this new browser process launched due to a restart. 28 // whether this new browser process launched due to a restart.
36 static bool ShouldRestoreApps(bool is_browser_restart); 29 static bool ShouldRestoreApps(bool is_browser_restart);
37 30
38 explicit AppRestoreService(Profile* profile); 31 explicit AppRestoreService(Profile* profile);
39 32
40 // Restart apps that need to be restarted and clear the "running" preference 33 // Restart apps that need to be restarted and clear the "running" preference
41 // from apps to prevent them being restarted in subsequent restarts. 34 // from apps to prevent them being restarted in subsequent restarts.
42 void HandleStartup(bool should_restore_apps); 35 void HandleStartup(bool should_restore_apps);
43 36
44 private: 37 private:
45 // content::NotificationObserver. 38 // content::NotificationObserver.
46 virtual void Observe(int type, 39 virtual void Observe(int type,
47 const content::NotificationSource& source, 40 const content::NotificationSource& source,
48 const content::NotificationDetails& details) OVERRIDE; 41 const content::NotificationDetails& details) OVERRIDE;
49 42
50 void RecordAppStart(const std::string& extension_id); 43 void RecordAppStart(const std::string& extension_id);
51 void RecordAppStop(const std::string& extension_id); 44 void RecordAppStop(const std::string& extension_id);
52 void RestoreApp( 45 void RestoreApp(const extensions::Extension* extension);
53 const extensions::Extension* extension,
54 const std::vector<SavedFileEntry>& file_entries);
55 46
56 content::NotificationRegistrar registrar_; 47 content::NotificationRegistrar registrar_;
57 Profile* profile_; 48 Profile* profile_;
58 49
59 DISALLOW_COPY_AND_ASSIGN(AppRestoreService); 50 DISALLOW_COPY_AND_ASSIGN(AppRestoreService);
60 }; 51 };
61 52
62 } // namespace apps 53 } // namespace apps
63 54
64 #endif // APPS_APP_RESTORE_SERVICE_H_ 55 #endif // APPS_APP_RESTORE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | apps/app_restore_service.cc » ('j') | apps/saved_files_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698