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"
16 static base::LazyInstance
<PrinterDetectorFactory
> g_factory
=
17 LAZY_INSTANCE_INITIALIZER
;
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()) {
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 {
51 bool PrinterDetectorFactory::ServiceIsNULLWhileTesting() const {
55 } // namespace chromeos