summaryrefslogtreecommitdiffstats
path: root/apps/app_restore_service.h
diff options
context:
space:
mode:
authorjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-06 13:38:37 +0000
committerjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-06 13:38:37 +0000
commitd54b3f490de80c708e335714872e44eba322342b (patch)
tree08b3bb2e4312da05091229947ca82b1e1655c94f /apps/app_restore_service.h
parente34d51130d3026bf2fb6501264b1c761cfa48a18 (diff)
downloadchromium_src-d54b3f490de80c708e335714872e44eba322342b.zip
chromium_src-d54b3f490de80c708e335714872e44eba322342b.tar.gz
chromium_src-d54b3f490de80c708e335714872e44eba322342b.tar.bz2
Factor out AppLifetimeMonitor.
AppLifetimeMonitor listens to extension host notifications and observes ShellWindowRegistry. It sends out notifications when: - an app starts - the first shell window opens - the last shell window closes - the app stops BUG= Review URL: https://chromiumcodereview.appspot.com/16412002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/app_restore_service.h')
-rw-r--r--apps/app_restore_service.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/apps/app_restore_service.h b/apps/app_restore_service.h
index 65d3de2..d4e605f 100644
--- a/apps/app_restore_service.h
+++ b/apps/app_restore_service.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "apps/app_lifetime_monitor.h"
#include "chrome/browser/extensions/shell_window_registry.h"
#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
#include "content/public/browser/notification_observer.h"
@@ -24,7 +25,7 @@ namespace apps {
// Tracks what apps need to be restarted when the browser restarts.
class AppRestoreService : public BrowserContextKeyedService,
public content::NotificationObserver,
- public extensions::ShellWindowRegistry::Observer {
+ public AppLifetimeMonitor::Observer {
public:
// Returns true if apps should be restored on the current platform, given
// whether this new browser process launched due to a restart.
@@ -42,22 +43,25 @@ class AppRestoreService : public BrowserContextKeyedService,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
- // extensions::ShellWindowRegistry::Observer.
- virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE;
- virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE;
+ // AppLifetimeMonitor::Observer.
+ virtual void OnAppStart(Profile* profile, const std::string& app_id) OVERRIDE;
+ virtual void OnAppActivated(Profile* profile,
+ const std::string& app_id) OVERRIDE;
+ virtual void OnAppDeactivated(Profile* profile,
+ const std::string& app_id) OVERRIDE;
+ virtual void OnAppStop(Profile* profile, const std::string& app_id) OVERRIDE;
// BrowserContextKeyedService.
virtual void Shutdown() OVERRIDE;
void RecordAppStart(const std::string& extension_id);
void RecordAppStop(const std::string& extension_id);
- void RecordIfAppHasWindows(const std::string& id);
+ void RecordAppActiveState(const std::string& id, bool is_active);
void RestoreApp(const extensions::Extension* extension);
- void StartObservingShellWindows();
- void StopObservingShellWindows();
+ void StartObservingAppLifetime();
+ void StopObservingAppLifetime();
content::NotificationRegistrar registrar_;
Profile* profile_;