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

Side by Side Diff: chrome/browser/sessions/app_restore_service.h

Issue 10875027: Restart running apps when chrome restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only restore apps on restart Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_SESSIONS_APP_RESTORE_SERVICE_H_
6 #define CHROME_BROWSER_SESSIONS_APP_RESTORE_SERVICE_H_
7
8 #include "chrome/browser/cancelable_request.h"
9 #include "chrome/browser/sessions/base_session_service.h"
10 #include "chrome/browser/sessions/session_command.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13
14 #include <list>
15 #include <vector>
16
17 class Profile;
18
19 namespace extensions {
20 class ExtensionHost;
21 }
22
23 // Tracks what apps need to be restarted when the browser restarts.
24 class AppRestoreService : public BaseSessionService,
sky 2012/08/28 16:56:12 The list of apps is going to be smallish, I think
25 public content::NotificationObserver {
26 public:
27 explicit AppRestoreService(Profile* profile);
28
29 // Dispatches the app.runtime.onRestarted event to apps that were running in
30 // the last session.
31 void RestoreApps();
32
33 // Calculates which apps were running when the last session ended.
34 void CalculateAppsRunningLastSession(const std::vector<SessionCommand*>& data,
35 std::list<std::string>& apps);
36
37 // Dispatches the app.runtime.onRestarted event to the apps identified by the
38 // extension ids in |apps|.
39 void RestartApps(std::list<std::string>& apps);
40
41 // content::NotificationObserver.
42 virtual void Observe(int type,
43 const content::NotificationSource& source,
44 const content::NotificationDetails& details);
45
46 private:
47 // Called when the commands for the last session have been retrieved from the
48 // backend.
49 void OnGotLastSessionCommands(Handle handle,
50 scoped_refptr<InternalGetCommandsRequest> request);
51
52 // Factory methods for SessionCommands that track running apps.
53 SessionCommand* CreateRunAppCommand(const std::string& extension_id);
54 SessionCommand* CreateStopAppCommand(const std::string& extension_id);
55
56 content::NotificationRegistrar registrar_;
57 CancelableRequestConsumer request_consumer_;
58 };
59
60 #endif // CHROME_BROWSER_SESSIONS_APP_RESTORE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_dependency_manager.cc ('k') | chrome/browser/sessions/app_restore_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698