Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / printer_detector / printer_detector_factory.cc
blob080ba168b8c2180c9ee4b8ff04fb1d897ffa3c3f
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/chromeos/printer_detector/printer_detector_factory.h"
7 #include "chrome/browser/chromeos/printer_detector/printer_detector.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extensions_browser_client.h"
12 namespace chromeos {
14 namespace {
16 static base::LazyInstance<PrinterDetectorFactory> g_factory =
17 LAZY_INSTANCE_INITIALIZER;
19 } // namespace
21 // static
22 PrinterDetectorFactory* PrinterDetectorFactory::GetInstance() {
23 return g_factory.Pointer();
26 PrinterDetector* PrinterDetectorFactory::Get(content::BrowserContext* context) {
27 return static_cast<PrinterDetector*>(
28 GetServiceForBrowserContext(context, false));
31 PrinterDetectorFactory::PrinterDetectorFactory()
32 : BrowserContextKeyedServiceFactory(
33 "PrinterDetectorFactory",
34 BrowserContextDependencyManager::GetInstance()) {
35 DependsOn(
36 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
39 PrinterDetectorFactory::~PrinterDetectorFactory() {
42 KeyedService* PrinterDetectorFactory::BuildServiceInstanceFor(
43 content::BrowserContext* context) const {
44 return new PrinterDetector(Profile::FromBrowserContext(context));
47 bool PrinterDetectorFactory::ServiceIsCreatedWithBrowserContext() const {
48 return true;
51 bool PrinterDetectorFactory::ServiceIsNULLWhileTesting() const {
52 return true;
55 } // namespace chromeos