Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/browser/chromeos/printing/printer_pref_manager_factory.cc

Issue 2610373003: Let the incognito window print. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/printing/printer_pref_manager_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/incognito_helpers.h"
7 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" 9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
9 #include "content/public/browser/browser_context.h" 10 #include "content/public/browser/browser_context.h"
10 11
11 namespace chromeos { 12 namespace chromeos {
12 13
13 namespace { 14 namespace {
14 15
15 base::LazyInstance<PrinterPrefManagerFactory> g_printer_pref_manager = 16 base::LazyInstance<PrinterPrefManagerFactory> g_printer_pref_manager =
16 LAZY_INSTANCE_INITIALIZER; 17 LAZY_INSTANCE_INITIALIZER;
17 18
18 } // namespace 19 } // namespace
19 20
20 // static 21 // static
21 PrinterPrefManager* PrinterPrefManagerFactory::GetForBrowserContext( 22 PrinterPrefManager* PrinterPrefManagerFactory::GetForBrowserContext(
22 content::BrowserContext* context) { 23 content::BrowserContext* context) {
23 DCHECK(!context->IsOffTheRecord()); 24 DCHECK(!context->IsOffTheRecord());
24 return static_cast<PrinterPrefManager*>( 25 return static_cast<PrinterPrefManager*>(
25 GetInstance()->GetServiceForBrowserContext(context, true)); 26 GetInstance()->GetServiceForBrowserContext(context, true));
26 } 27 }
27 28
28 // static 29 // static
29 PrinterPrefManagerFactory* PrinterPrefManagerFactory::GetInstance() { 30 PrinterPrefManagerFactory* PrinterPrefManagerFactory::GetInstance() {
30 return g_printer_pref_manager.Pointer(); 31 return g_printer_pref_manager.Pointer();
31 } 32 }
32 33
34 content::BrowserContext* PrinterPrefManagerFactory::GetBrowserContextToUse(
35 content::BrowserContext* context) const {
36 return chrome::GetBrowserContextRedirectedInIncognito(context);
37 }
38
33 PrinterPrefManagerFactory::PrinterPrefManagerFactory() 39 PrinterPrefManagerFactory::PrinterPrefManagerFactory()
34 : BrowserContextKeyedServiceFactory( 40 : BrowserContextKeyedServiceFactory(
35 "PrinterPrefManager", 41 "PrinterPrefManager",
36 BrowserContextDependencyManager::GetInstance()) {} 42 BrowserContextDependencyManager::GetInstance()) {}
37 43
38 PrinterPrefManagerFactory::~PrinterPrefManagerFactory() {} 44 PrinterPrefManagerFactory::~PrinterPrefManagerFactory() {}
39 45
40 PrinterPrefManager* PrinterPrefManagerFactory::BuildServiceInstanceFor( 46 PrinterPrefManager* PrinterPrefManagerFactory::BuildServiceInstanceFor(
41 content::BrowserContext* browser_context) const { 47 content::BrowserContext* browser_context) const {
42 Profile* profile = Profile::FromBrowserContext(browser_context); 48 Profile* profile = Profile::FromBrowserContext(browser_context);
43 return new PrinterPrefManager(profile); 49 return new PrinterPrefManager(profile);
44 } 50 }
45 51
46 } // namespace chromeos 52 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/printing/printer_pref_manager_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698