Revert of Don't install OEM default apps for enterprise users (patchset #1 id:1 of...
[chromium-blink-merge.git] / chrome / browser / extensions / install_verifier_factory.cc
blob9ff18773c0872e23efd17420c69b787b9662470e
1 // Copyright 2015 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 "chrome/browser/extensions/install_verifier_factory.h"
7 #include "chrome/browser/extensions/install_verifier.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_prefs.h"
11 #include "extensions/browser/extension_prefs_factory.h"
12 #include "extensions/browser/extension_registry_factory.h"
13 #include "extensions/browser/extensions_browser_client.h"
15 using content::BrowserContext;
17 namespace extensions {
19 // static
20 InstallVerifier* InstallVerifierFactory::GetForBrowserContext(
21 BrowserContext* context) {
22 return static_cast<InstallVerifier*>(
23 GetInstance()->GetServiceForBrowserContext(context, true));
26 // static
27 InstallVerifierFactory* InstallVerifierFactory::GetInstance() {
28 return Singleton<InstallVerifierFactory>::get();
31 InstallVerifierFactory::InstallVerifierFactory()
32 : BrowserContextKeyedServiceFactory(
33 "InstallVerifier",
34 BrowserContextDependencyManager::GetInstance()) {
35 DependsOn(ExtensionPrefsFactory::GetInstance());
36 DependsOn(ExtensionRegistryFactory::GetInstance());
39 InstallVerifierFactory::~InstallVerifierFactory() {
42 KeyedService* InstallVerifierFactory::BuildServiceInstanceFor(
43 BrowserContext* context) const {
44 return new InstallVerifier(ExtensionPrefs::Get(context), context);
47 BrowserContext* InstallVerifierFactory::GetBrowserContextToUse(
48 BrowserContext* context) const {
49 // Redirected in incognito.
50 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
53 } // namespace extensions