Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / chrome / browser / extensions / install_verifier_factory.cc
blobd267445cdfb59a3357a39f5eb904b7a88c0f9aad
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 base::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