Roll src/third_party/WebKit 63beae6:7fa8deb (svn 201790:201791)
[chromium-blink-merge.git] / extensions / browser / lazy_background_task_queue_factory.cc
blobbe9d8c70366ecca712af68667d6b80a48f7b2d25
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/lazy_background_task_queue_factory.h"
7 //#include "chrome/browser/profiles/profile.h"
8 #include "components/keyed_service/content/browser_context_dependency_manager.h"
9 #include "extensions/browser/extension_registry_factory.h"
10 #include "extensions/browser/extensions_browser_client.h"
11 #include "extensions/browser/lazy_background_task_queue.h"
13 using content::BrowserContext;
15 namespace extensions {
17 // static
18 LazyBackgroundTaskQueue* LazyBackgroundTaskQueueFactory::GetForBrowserContext(
19 BrowserContext* context) {
20 return static_cast<LazyBackgroundTaskQueue*>(
21 GetInstance()->GetServiceForBrowserContext(context, true));
24 // static
25 LazyBackgroundTaskQueueFactory* LazyBackgroundTaskQueueFactory::GetInstance() {
26 return Singleton<LazyBackgroundTaskQueueFactory>::get();
29 LazyBackgroundTaskQueueFactory::LazyBackgroundTaskQueueFactory()
30 : BrowserContextKeyedServiceFactory(
31 "LazyBackgroundTaskQueue",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(ExtensionRegistryFactory::GetInstance());
36 LazyBackgroundTaskQueueFactory::~LazyBackgroundTaskQueueFactory() {
39 KeyedService* LazyBackgroundTaskQueueFactory::BuildServiceInstanceFor(
40 BrowserContext* context) const {
41 return new LazyBackgroundTaskQueue(context);
44 BrowserContext* LazyBackgroundTaskQueueFactory::GetBrowserContextToUse(
45 BrowserContext* context) const {
46 // Redirected in incognito.
47 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
50 } // namespace extensions