browser_context_keyed_service_factories.cc 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2014 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/browser_context_keyed_service_factories.h"
  5. #include "apps/app_lifetime_monitor_factory.h"
  6. #include "apps/app_restore_service.h"
  7. #include "apps/app_restore_service_factory.h"
  8. #include "apps/saved_files_service.h"
  9. #include "apps/saved_files_service_factory.h"
  10. #include "content/public/browser/browser_context.h"
  11. namespace apps {
  12. void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
  13. AppLifetimeMonitorFactory::GetInstance();
  14. AppRestoreServiceFactory::GetInstance();
  15. }
  16. void NotifyApplicationTerminating(content::BrowserContext* browser_context) {
  17. AppRestoreService* restore_service =
  18. AppRestoreServiceFactory::GetForBrowserContext(browser_context);
  19. CHECK(restore_service);
  20. restore_service->OnApplicationTerminating();
  21. SavedFilesService* saved_files_service =
  22. SavedFilesServiceFactory::GetForBrowserContextIfExists(browser_context);
  23. if (saved_files_service)
  24. saved_files_service->OnApplicationTerminating();
  25. }
  26. } // namespace apps