[Smart Lock] Record a detailed UMA metric for each unlock attempt by Smart Lock users.
[chromium-blink-merge.git] / apps / app_load_service_factory.cc
blob94eac78b68ede3ab86c6faac506e1017bf670ea5
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 "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/app_window/app_window_registry.h"
11 #include "extensions/browser/extension_prefs_factory.h"
12 #include "extensions/browser/extension_registry_factory.h"
13 #include "extensions/browser/extension_system_provider.h"
14 #include "extensions/browser/extensions_browser_client.h"
16 namespace apps {
18 // static
19 AppLoadService* AppLoadServiceFactory::GetForProfile(Profile* profile) {
20 return static_cast<AppLoadService*>(
21 GetInstance()->GetServiceForBrowserContext(profile, true));
24 AppLoadServiceFactory* AppLoadServiceFactory::GetInstance() {
25 return Singleton<AppLoadServiceFactory>::get();
28 AppLoadServiceFactory::AppLoadServiceFactory()
29 : BrowserContextKeyedServiceFactory(
30 "AppLoadService",
31 BrowserContextDependencyManager::GetInstance()) {
32 DependsOn(extensions::AppWindowRegistry::Factory::GetInstance());
33 DependsOn(extensions::ExtensionPrefsFactory::GetInstance());
34 DependsOn(extensions::ExtensionRegistryFactory::GetInstance());
35 DependsOn(
36 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
39 AppLoadServiceFactory::~AppLoadServiceFactory() {
42 KeyedService* AppLoadServiceFactory::BuildServiceInstanceFor(
43 content::BrowserContext* profile) const {
44 return new AppLoadService(static_cast<Profile*>(profile));
47 bool AppLoadServiceFactory::ServiceIsNULLWhileTesting() const {
48 return false;
51 bool AppLoadServiceFactory::ServiceIsCreatedWithBrowserContext() const {
52 return true;
55 content::BrowserContext* AppLoadServiceFactory::GetBrowserContextToUse(
56 content::BrowserContext* context) const {
57 // Redirected in incognito.
58 return extensions::ExtensionsBrowserClient::Get()->
59 GetOriginalContext(context);
62 } // namespace apps