app_restore_service_factory.cc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include "apps/app_restore_service_factory.h"
  5. #include "apps/app_lifetime_monitor_factory.h"
  6. #include "apps/app_restore_service.h"
  7. #include "components/keyed_service/content/browser_context_dependency_manager.h"
  8. #include "content/public/browser/browser_context.h"
  9. namespace apps {
  10. // static
  11. AppRestoreService* AppRestoreServiceFactory::GetForBrowserContext(
  12. content::BrowserContext* context) {
  13. return static_cast<AppRestoreService*>(
  14. GetInstance()->GetServiceForBrowserContext(context, true));
  15. }
  16. AppRestoreServiceFactory* AppRestoreServiceFactory::GetInstance() {
  17. return base::Singleton<AppRestoreServiceFactory>::get();
  18. }
  19. AppRestoreServiceFactory::AppRestoreServiceFactory()
  20. : BrowserContextKeyedServiceFactory(
  21. "AppRestoreService",
  22. BrowserContextDependencyManager::GetInstance()) {
  23. DependsOn(AppLifetimeMonitorFactory::GetInstance());
  24. }
  25. AppRestoreServiceFactory::~AppRestoreServiceFactory() = default;
  26. KeyedService* AppRestoreServiceFactory::BuildServiceInstanceFor(
  27. content::BrowserContext* context) const {
  28. return new AppRestoreService(context);
  29. }
  30. bool AppRestoreServiceFactory::ServiceIsCreatedWithBrowserContext() const {
  31. return true;
  32. }
  33. } // namespace apps