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-18 14:22:12 +0000
committerjackhou@chromium.org <jackhou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 14:22:12 +0000
commit4b7111f2c1f379da798835b9a7f7985138542d84 (patch)
tree38e6e22dad15dcf948a0eac1c83bac50998a97f4 /apps/app_restore_service.h
parent42265601854dfe527c6fd2522d4c9b6c15752273 (diff)
downloadchromium_src-4b7111f2c1f379da798835b9a7f7985138542d84.zip
chromium_src-4b7111f2c1f379da798835b9a7f7985138542d84.tar.gz
chromium_src-4b7111f2c1f379da798835b9a7f7985138542d84.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= Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=204487 Review URL: https://chromiumcodereview.appspot.com/16412002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps/app_restore_service.h')
-rw-r--r--apps/app_restore_service.h30
1 files changed, 13 insertions, 17 deletions
diff --git a/apps/app_restore_service.h b/apps/app_restore_service.h
index bf53829..5a66005 100644
--- a/apps/app_restore_service.h
+++ b/apps/app_restore_service.h
@@ -8,10 +8,9 @@
#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"
-#include "content/public/browser/notification_registrar.h"
namespace extensions {
class Extension;
@@ -23,8 +22,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.
@@ -43,29 +41,27 @@ class AppRestoreService : public BrowserContextKeyedService,
static AppRestoreService* Get(Profile* profile);
private:
- // content::NotificationObserver.
- virtual void Observe(int type,
- 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;
+ virtual void OnChromeTerminating() 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_;
DISALLOW_COPY_AND_ASSIGN(AppRestoreService);