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

Side by Side Diff: chrome/browser/custom_handlers/protocol_handler_registry_factory.cc

Issue 13865012: Change GetProfileToUse method from Profile to content::BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: trybots Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/custom_handlers/protocol_handler_registry_factory.h" 5 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
9 #include "chrome/browser/extensions/extension_system_factory.h" 9 #include "chrome/browser/extensions/extension_system_factory.h"
10 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_dependency_manager.h" 12 #include "chrome/browser/profiles/profile_dependency_manager.h"
12 13
13 // static 14 // static
14 ProtocolHandlerRegistryFactory* ProtocolHandlerRegistryFactory::GetInstance() { 15 ProtocolHandlerRegistryFactory* ProtocolHandlerRegistryFactory::GetInstance() {
15 return Singleton<ProtocolHandlerRegistryFactory>::get(); 16 return Singleton<ProtocolHandlerRegistryFactory>::get();
16 } 17 }
17 18
18 // static 19 // static
19 ProtocolHandlerRegistry* ProtocolHandlerRegistryFactory::GetForProfile( 20 ProtocolHandlerRegistry* ProtocolHandlerRegistryFactory::GetForProfile(
(...skipping 11 matching lines...) Expand all
31 } 32 }
32 33
33 // Will be created when initializing profile_io_data, so we might 34 // Will be created when initializing profile_io_data, so we might
34 // as well have the framework create this along with other 35 // as well have the framework create this along with other
35 // PKSs to preserve orderly civic conduct :) 36 // PKSs to preserve orderly civic conduct :)
36 bool ProtocolHandlerRegistryFactory::ServiceIsCreatedWithProfile() const { 37 bool ProtocolHandlerRegistryFactory::ServiceIsCreatedWithProfile() const {
37 return true; 38 return true;
38 } 39 }
39 40
40 // Allows the produced registry to be used in incognito mode. 41 // Allows the produced registry to be used in incognito mode.
41 bool ProtocolHandlerRegistryFactory::ServiceRedirectedInIncognito() const { 42 content::BrowserContext* ProtocolHandlerRegistryFactory::GetBrowserContextToUse(
42 return true; 43 content::BrowserContext* context) const {
44 return chrome::GetBrowserContextRedirectedInIncognito(context);
43 } 45 }
44 46
45 // Do not create this service for tests. MANY tests will fail 47 // Do not create this service for tests. MANY tests will fail
46 // due to the threading requirements of this service. ALSO, 48 // due to the threading requirements of this service. ALSO,
47 // not creating this increases test isolation (which is GOOD!) 49 // not creating this increases test isolation (which is GOOD!)
48 bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const { 50 bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const {
49 return true; 51 return true;
50 } 52 }
51 53
52 ProfileKeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor( 54 ProfileKeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(
53 content::BrowserContext* profile) const { 55 content::BrowserContext* profile) const {
54 ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry( 56 ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry(
55 static_cast<Profile*>(profile), new ProtocolHandlerRegistry::Delegate()); 57 static_cast<Profile*>(profile), new ProtocolHandlerRegistry::Delegate());
56 58
57 #if defined(OS_CHROMEOS) 59 #if defined(OS_CHROMEOS)
58 // If installing defaults, they must be installed prior calling 60 // If installing defaults, they must be installed prior calling
59 // InitProtocolSettings 61 // InitProtocolSettings
60 registry->InstallDefaultsForChromeOS(); 62 registry->InstallDefaultsForChromeOS();
61 #endif 63 #endif
62 64
63 // Must be called as a part of the creation process. 65 // Must be called as a part of the creation process.
64 registry->InitProtocolSettings(); 66 registry->InitProtocolSettings();
65 67
66 return registry; 68 return registry;
67 } 69 }
OLDNEW
« no previous file with comments | « chrome/browser/custom_handlers/protocol_handler_registry_factory.h ('k') | chrome/browser/download/download_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698