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

Unified Diff: chrome/browser/extensions/platform_app_service.h

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/platform_app_service.h
diff --git a/chrome/browser/extensions/platform_app_service.h b/chrome/browser/extensions/platform_app_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..1e9937e36562650f6980286a3de2a69adcc580f3
--- /dev/null
+++ b/chrome/browser/extensions/platform_app_service.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
Aaron Boodman 2012/10/31 07:31:22 Might as well put this in c/b/apps, eh?
benwells 2012/10/31 08:08:22 I was hoping to do that in another CL, to allow fu
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_SERVICE_H_
+#define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_SERVICE_H_
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/profiles/profile_keyed_service.h"
+#include "chrome/browser/profiles/profile_keyed_service_factory.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+
+namespace extensions {
+
+// The PlatformAppService provides services for platform apps, such as
+// keeping the browser process alive while they are running.
+// TODO(benwells): Merge functionality of ShellWindowRegistry into this class.
+class PlatformAppService : public ProfileKeyedService,
+ public content::NotificationObserver {
+ public:
+ explicit PlatformAppService(Profile* profile);
+ virtual ~PlatformAppService();
+
+ // Called to make sure the service is running.
+ static void CreateInstance(Profile* profile);
+
+ protected:
+ // content::NotificationObserver:
Aaron Boodman 2012/10/31 07:31:22 No reason to make this protected. It can be privat
benwells 2012/10/31 08:08:22 Done.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
+ private:
+ class Factory : public ProfileKeyedServiceFactory {
+ public:
+ static PlatformAppService* GetForProfile(Profile* profile);
+
+ static Factory* GetInstance();
+ private:
+ friend struct DefaultSingletonTraits<Factory>;
+
+ Factory();
+ virtual ~Factory();
+
+ // ProfileKeyedServiceFactory
+ virtual ProfileKeyedService* BuildServiceInstanceFor(
+ Profile* profile) const OVERRIDE;
+ virtual bool ServiceHasOwnInstanceInIncognito() const OVERRIDE;
+ virtual bool ServiceIsCreatedWithProfile() const OVERRIDE;
+ virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
+ };
+
+ content::NotificationRegistrar registrar_;
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698