Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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
| |
| 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_PLATFORM_APP_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_SERVICE_H_ | |
| 7 | |
| 8 #include "base/memory/singleton.h" | |
| 9 #include "chrome/browser/profiles/profile_keyed_service.h" | |
| 10 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | |
| 11 #include "content/public/browser/notification_observer.h" | |
| 12 #include "content/public/browser/notification_registrar.h" | |
| 13 | |
| 14 namespace extensions { | |
| 15 | |
| 16 // The PlatformAppService provides services for platform apps, such as | |
| 17 // keeping the browser process alive while they are running. | |
| 18 // TODO(benwells): Merge functionality of ShellWindowRegistry into this class. | |
| 19 class PlatformAppService : public ProfileKeyedService, | |
| 20 public content::NotificationObserver { | |
| 21 public: | |
| 22 explicit PlatformAppService(Profile* profile); | |
| 23 virtual ~PlatformAppService(); | |
| 24 | |
| 25 // Called to make sure the service is running. | |
| 26 static void CreateInstance(Profile* profile); | |
| 27 | |
| 28 protected: | |
| 29 // 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.
| |
| 30 virtual void Observe(int type, | |
| 31 const content::NotificationSource& source, | |
| 32 const content::NotificationDetails& details) OVERRIDE; | |
| 33 | |
| 34 private: | |
| 35 class Factory : public ProfileKeyedServiceFactory { | |
| 36 public: | |
| 37 static PlatformAppService* GetForProfile(Profile* profile); | |
| 38 | |
| 39 static Factory* GetInstance(); | |
| 40 private: | |
| 41 friend struct DefaultSingletonTraits<Factory>; | |
| 42 | |
| 43 Factory(); | |
| 44 virtual ~Factory(); | |
| 45 | |
| 46 // ProfileKeyedServiceFactory | |
| 47 virtual ProfileKeyedService* BuildServiceInstanceFor( | |
| 48 Profile* profile) const OVERRIDE; | |
| 49 virtual bool ServiceHasOwnInstanceInIncognito() const OVERRIDE; | |
| 50 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; | |
| 51 virtual bool ServiceIsNULLWhileTesting() const OVERRIDE; | |
| 52 }; | |
| 53 | |
| 54 content::NotificationRegistrar registrar_; | |
| 55 }; | |
| 56 | |
| 57 } // namespace extensions | |
| 58 | |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_PLATFORM_APP_SERVICE_H_ | |
| OLD | NEW |