app_restore_service_factory.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #ifndef APPS_APP_RESTORE_SERVICE_FACTORY_H_
  5. #define APPS_APP_RESTORE_SERVICE_FACTORY_H_
  6. #include "base/memory/singleton.h"
  7. #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
  8. namespace content {
  9. class BrowserContext;
  10. }
  11. namespace apps {
  12. class AppRestoreService;
  13. // Singleton that owns all AppRestoreServices and associates them with
  14. // BrowserContexts. Listens for the BrowserContext's destruction notification
  15. // and cleans up
  16. // the associated AppRestoreService.
  17. class AppRestoreServiceFactory : public BrowserContextKeyedServiceFactory {
  18. public:
  19. static AppRestoreService* GetForBrowserContext(
  20. content::BrowserContext* context);
  21. static AppRestoreServiceFactory* GetInstance();
  22. private:
  23. friend struct base::DefaultSingletonTraits<AppRestoreServiceFactory>;
  24. AppRestoreServiceFactory();
  25. ~AppRestoreServiceFactory() override;
  26. // BrowserContextKeyedServiceFactory:
  27. KeyedService* BuildServiceInstanceFor(
  28. content::BrowserContext* context) const override;
  29. bool ServiceIsCreatedWithBrowserContext() const override;
  30. };
  31. } // namespace apps
  32. #endif // APPS_APP_RESTORE_SERVICE_FACTORY_H_