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
3 // found in the LICENSE file.
5 #ifndef APPS_APP_RESTORE_SERVICE_H_
6 #define APPS_APP_RESTORE_SERVICE_H_
11 #include "chrome/browser/profiles/profile_keyed_service.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
15 namespace extensions
{
18 namespace app_file_handler_util
{
19 struct SavedFileEntry
;
26 using extensions::app_file_handler_util::SavedFileEntry
;
30 // Tracks what apps need to be restarted when the browser restarts.
31 class AppRestoreService
: public ProfileKeyedService
,
32 public content::NotificationObserver
{
34 explicit AppRestoreService(Profile
* profile
);
36 // Restart apps that need to be restarted and clear the "running" preference
37 // from apps to prevent them being restarted in subsequent restarts.
38 void HandleStartup(bool should_restore_apps
);
41 // content::NotificationObserver.
42 virtual void Observe(int type
,
43 const content::NotificationSource
& source
,
44 const content::NotificationDetails
& details
) OVERRIDE
;
46 void RecordAppStart(const std::string
& extension_id
);
47 void RecordAppStop(const std::string
& extension_id
);
49 const extensions::Extension
* extension
,
50 const std::vector
<SavedFileEntry
>& file_entries
);
52 content::NotificationRegistrar registrar_
;
55 DISALLOW_COPY_AND_ASSIGN(AppRestoreService
);
60 #endif // APPS_APP_RESTORE_SERVICE_H_