| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/printing/printer_pref_manager_factory.h" | 5 #include "chrome/browser/chromeos/printing/printer_pref_manager_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 8 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 base::LazyInstance<PrinterPrefManagerFactory> g_printer_pref_manager = | 15 base::LazyInstance<PrinterPrefManagerFactory> g_printer_pref_manager = |
| 16 LAZY_INSTANCE_INITIALIZER; | 16 LAZY_INSTANCE_INITIALIZER; |
| 17 | 17 |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 PrinterPrefManager* PrinterPrefManagerFactory::GetForBrowserContext( | 21 PrinterPrefManager* PrinterPrefManagerFactory::GetForBrowserContext( |
| 22 content::BrowserContext* context) { | 22 content::BrowserContext* context) { |
| 23 DCHECK(!context->IsOffTheRecord()); |
| 23 return static_cast<PrinterPrefManager*>( | 24 return static_cast<PrinterPrefManager*>( |
| 24 GetInstance()->GetServiceForBrowserContext(context, true)); | 25 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 25 } | 26 } |
| 26 | 27 |
| 27 // static | 28 // static |
| 28 PrinterPrefManagerFactory* PrinterPrefManagerFactory::GetInstance() { | 29 PrinterPrefManagerFactory* PrinterPrefManagerFactory::GetInstance() { |
| 29 return g_printer_pref_manager.Pointer(); | 30 return g_printer_pref_manager.Pointer(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 PrinterPrefManagerFactory::PrinterPrefManagerFactory() | 33 PrinterPrefManagerFactory::PrinterPrefManagerFactory() |
| 33 : BrowserContextKeyedServiceFactory( | 34 : BrowserContextKeyedServiceFactory( |
| 34 "PrinterPrefManager", | 35 "PrinterPrefManager", |
| 35 BrowserContextDependencyManager::GetInstance()) {} | 36 BrowserContextDependencyManager::GetInstance()) {} |
| 36 | 37 |
| 37 PrinterPrefManagerFactory::~PrinterPrefManagerFactory() {} | 38 PrinterPrefManagerFactory::~PrinterPrefManagerFactory() {} |
| 38 | 39 |
| 39 PrinterPrefManager* PrinterPrefManagerFactory::BuildServiceInstanceFor( | 40 PrinterPrefManager* PrinterPrefManagerFactory::BuildServiceInstanceFor( |
| 40 content::BrowserContext* browser_context) const { | 41 content::BrowserContext* browser_context) const { |
| 41 Profile* profile = Profile::FromBrowserContext(browser_context); | 42 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 42 return new PrinterPrefManager(profile); | 43 return new PrinterPrefManager(profile); |
| 43 } | 44 } |
| 44 | 45 |
| 45 } // namespace chromeos | 46 } // namespace chromeos |
| OLD | NEW |