| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/printer_detector/printer_detector_factory.h" | 5 #include "chrome/browser/chromeos/printer_detector/printer_detector_factory.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/chromeos/printer_detector/printer_detector.h" | 8 #include "chrome/browser/chromeos/printer_detector/printer_detector.h" |
| 9 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" | 9 #include "chrome/browser/chromeos/printing/printers_manager_factory.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); | 39 extensions::ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); |
| 40 DependsOn(PrintersManagerFactory::GetInstance()); | 40 DependsOn(PrintersManagerFactory::GetInstance()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 PrinterDetectorFactory::~PrinterDetectorFactory() { | 43 PrinterDetectorFactory::~PrinterDetectorFactory() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 KeyedService* PrinterDetectorFactory::BuildServiceInstanceFor( | 46 KeyedService* PrinterDetectorFactory::BuildServiceInstanceFor( |
| 47 content::BrowserContext* context) const { | 47 content::BrowserContext* context) const { |
| 48 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 48 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 49 ::switches::kEnableNativeCups)) { | 49 ::switches::kDisableNativeCups)) { |
| 50 return PrinterDetector::CreateCups(Profile::FromBrowserContext(context)) | |
| 51 .release(); | |
| 52 } else { | |
| 53 return PrinterDetector::CreateLegacy(Profile::FromBrowserContext(context)) | 50 return PrinterDetector::CreateLegacy(Profile::FromBrowserContext(context)) |
| 54 .release(); | 51 .release(); |
| 55 } | 52 } |
| 53 |
| 54 return PrinterDetector::CreateCups(Profile::FromBrowserContext(context)) |
| 55 .release(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool PrinterDetectorFactory::ServiceIsCreatedWithBrowserContext() const { | 58 bool PrinterDetectorFactory::ServiceIsCreatedWithBrowserContext() const { |
| 59 return true; | 59 return true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool PrinterDetectorFactory::ServiceIsNULLWhileTesting() const { | 62 bool PrinterDetectorFactory::ServiceIsNULLWhileTesting() const { |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace chromeos | 66 } // namespace chromeos |
| OLD | NEW |