blob: f919a7a7f754ebb7a7375d48b1798834c3be9ae6 [file] [log] [blame]
[email protected]28c3eeb2012-10-15 05:47:531// 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.
4
5#ifndef CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_
6#define CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_
7
[email protected]c2e2b6d2013-01-22 02:23:298#include <string>
9
[email protected]28c3eeb2012-10-15 05:47:5310#include "chrome/browser/profiles/profile_keyed_service.h"
11#include "content/public/browser/notification_observer.h"
12#include "content/public/browser/notification_registrar.h"
13
[email protected]28c3eeb2012-10-15 05:47:5314class Profile;
15
16namespace extensions {
[email protected]28c3eeb2012-10-15 05:47:5317class Extension;
[email protected]c2e2b6d2013-01-22 02:23:2918}
19
20namespace apps {
[email protected]28c3eeb2012-10-15 05:47:5321
22// Tracks what apps need to be restarted when the browser restarts.
23class AppRestoreService : public ProfileKeyedService,
24 public content::NotificationObserver {
25 public:
26 explicit AppRestoreService(Profile* profile);
27
[email protected]119454622012-10-18 09:48:3228 // Restart apps that need to be restarted and clear the "running" preference
29 // from apps to prevent them being restarted in subsequent restarts.
[email protected]300ba0c42012-12-06 06:57:1730 void HandleStartup(bool should_restore_apps);
[email protected]28c3eeb2012-10-15 05:47:5331
32 private:
33 // content::NotificationObserver.
34 virtual void Observe(int type,
35 const content::NotificationSource& source,
36 const content::NotificationDetails& details) OVERRIDE;
37
38 void RecordAppStart(const std::string& extension_id);
39 void RecordAppStop(const std::string& extension_id);
[email protected]c2e2b6d2013-01-22 02:23:2940 void RestoreApp(const extensions::Extension* extension);
[email protected]28c3eeb2012-10-15 05:47:5341
42 content::NotificationRegistrar registrar_;
43 Profile* profile_;
44};
45
[email protected]c2e2b6d2013-01-22 02:23:2946} // namespace apps
[email protected]28c3eeb2012-10-15 05:47:5347
48#endif // CHROME_BROWSER_EXTENSIONS_APP_RESTORE_SERVICE_H_