Durable Storage: Refactor browser test and test the basic "deny" flow.
[chromium-blink-merge.git] / extensions / browser / declarative_user_script_manager_factory.cc
blobcc19c789bd5abfc3c4986097168db5dedc99ef36
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 "extensions/browser/declarative_user_script_manager_factory.h"
7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "extensions/browser/declarative_user_script_manager.h"
9 #include "extensions/browser/extension_registry_factory.h"
10 #include "extensions/browser/extensions_browser_client.h"
12 using content::BrowserContext;
14 namespace extensions {
16 // static
17 DeclarativeUserScriptManager*
18 DeclarativeUserScriptManagerFactory::GetForBrowserContext(
19 BrowserContext* context) {
20 return static_cast<DeclarativeUserScriptManager*>(
21 GetInstance()->GetServiceForBrowserContext(context, true));
24 // static
25 DeclarativeUserScriptManagerFactory*
26 DeclarativeUserScriptManagerFactory::GetInstance() {
27 return Singleton<DeclarativeUserScriptManagerFactory>::get();
30 DeclarativeUserScriptManagerFactory::DeclarativeUserScriptManagerFactory()
31 : BrowserContextKeyedServiceFactory(
32 "DeclarativeUserScriptManager",
33 BrowserContextDependencyManager::GetInstance()) {
34 DependsOn(ExtensionRegistryFactory::GetInstance());
37 DeclarativeUserScriptManagerFactory::~DeclarativeUserScriptManagerFactory() {
40 KeyedService* DeclarativeUserScriptManagerFactory::BuildServiceInstanceFor(
41 BrowserContext* context) const {
42 return new DeclarativeUserScriptManager(context);
45 BrowserContext* DeclarativeUserScriptManagerFactory::GetBrowserContextToUse(
46 BrowserContext* context) const {
47 // Redirected in incognito.
48 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
51 } // namespace extensions