Home | History | Annotate | Download | only in tab_capture
      1 // Copyright (c) 2012 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.
      4 
      5 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory.h"
      6 
      7 #include "chrome/browser/extensions/api/discovery/suggested_links_registry.h"
      8 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
      9 #include "chrome/browser/extensions/extension_system_factory.h"
     10 #include "chrome/browser/profiles/incognito_helpers.h"
     11 #include "chrome/browser/profiles/profile.h"
     12 #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
     13 
     14 namespace extensions {
     15 
     16 // static
     17 TabCaptureRegistry* TabCaptureRegistryFactory::GetForProfile(Profile* profile) {
     18   return static_cast<TabCaptureRegistry*>(
     19       GetInstance()->GetServiceForBrowserContext(profile, true));
     20 }
     21 
     22 // static
     23 TabCaptureRegistryFactory* TabCaptureRegistryFactory::GetInstance() {
     24   return Singleton<TabCaptureRegistryFactory>::get();
     25 }
     26 
     27 bool TabCaptureRegistryFactory::ServiceIsCreatedWithBrowserContext() const {
     28   return false;
     29 }
     30 
     31 TabCaptureRegistryFactory::TabCaptureRegistryFactory()
     32     : BrowserContextKeyedServiceFactory(
     33         "TabCaptureRegistry",
     34         BrowserContextDependencyManager::GetInstance()) {
     35   DependsOn(ExtensionSystemFactory::GetInstance());
     36 }
     37 
     38 TabCaptureRegistryFactory::~TabCaptureRegistryFactory() {
     39 }
     40 
     41 BrowserContextKeyedService* TabCaptureRegistryFactory::BuildServiceInstanceFor(
     42     content::BrowserContext* profile) const {
     43   return new TabCaptureRegistry(static_cast<Profile*>(profile));
     44 }
     45 
     46 content::BrowserContext* TabCaptureRegistryFactory::GetBrowserContextToUse(
     47     content::BrowserContext* context) const {
     48   return chrome::GetBrowserContextRedirectedInIncognito(context);
     49 }
     50 
     51 }  // namespace extensions
     52