Roll android_tools to the latest.
[chromium-blink-merge.git] / apps / app_load_service_factory.cc
blob23ffd1e70287dbb8667b2472284830a814279178
1 // Copyright 2013 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.
5 #include "apps/app_load_service_factory.h"
7 #include "apps/app_load_service.h"
8 #include "apps/app_window_registry.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "extensions/browser/extension_prefs_factory.h"
12 #include "extensions/browser/extension_system_provider.h"
13 #include "extensions/browser/extensions_browser_client.h"
15 namespace apps {
17 // static
18 AppLoadService* AppLoadServiceFactory::GetForProfile(Profile* profile) {
19 return static_cast<AppLoadService*>(
20 GetInstance()->GetServiceForBrowserContext(profile, true));
23 AppLoadServiceFactory* AppLoadServiceFactory::GetInstance() {
24 return Singleton<AppLoadServiceFactory>::get();
27 AppLoadServiceFactory::AppLoadServiceFactory()
28 : BrowserContextKeyedServiceFactory(
29 "AppLoadService",
30 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(
32 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
33 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
34 DependsOn(AppWindowRegistry::Factory::GetInstance());
37 AppLoadServiceFactory::~AppLoadServiceFactory() {
40 KeyedService* AppLoadServiceFactory::BuildServiceInstanceFor(
41 content::BrowserContext* profile) const {
42 return new AppLoadService(static_cast<Profile*>(profile));
45 bool AppLoadServiceFactory::ServiceIsNULLWhileTesting() const {
46 return false;
49 bool AppLoadServiceFactory::ServiceIsCreatedWithBrowserContext() const {
50 return true;
53 content::BrowserContext* AppLoadServiceFactory::GetBrowserContextToUse(
54 content::BrowserContext* context) const {
55 // Redirected in incognito.
56 return extensions::ExtensionsBrowserClient::Get()->
57 GetOriginalContext(context);
60 } // namespace apps