OLD | NEW |
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/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 : ProfileKeyedServiceFactory("ProtocolHandlerRegistry", | 26 : ProfileKeyedServiceFactory("ProtocolHandlerRegistry", |
27 ProfileDependencyManager::GetInstance()) { | 27 ProfileDependencyManager::GetInstance()) { |
28 } | 28 } |
29 | 29 |
30 ProtocolHandlerRegistryFactory::~ProtocolHandlerRegistryFactory() { | 30 ProtocolHandlerRegistryFactory::~ProtocolHandlerRegistryFactory() { |
31 } | 31 } |
32 | 32 |
33 // Will be created when initializing profile_io_data, so we might | 33 // Will be created when initializing profile_io_data, so we might |
34 // as well have the framework create this along with other | 34 // as well have the framework create this along with other |
35 // PKSs to preserve orderly civic conduct :) | 35 // PKSs to preserve orderly civic conduct :) |
36 bool ProtocolHandlerRegistryFactory::ServiceIsCreatedWithProfile() { | 36 bool ProtocolHandlerRegistryFactory::ServiceIsCreatedWithProfile() const { |
37 return true; | 37 return true; |
38 } | 38 } |
39 | 39 |
40 // Allows the produced registry to be used in incognito mode. | 40 // Allows the produced registry to be used in incognito mode. |
41 bool ProtocolHandlerRegistryFactory::ServiceRedirectedInIncognito() { | 41 bool ProtocolHandlerRegistryFactory::ServiceRedirectedInIncognito() const { |
42 return true; | 42 return true; |
43 } | 43 } |
44 | 44 |
45 // Do not create this service for tests. MANY tests will fail | 45 // Do not create this service for tests. MANY tests will fail |
46 // due to the threading requirements of this service. ALSO, | 46 // due to the threading requirements of this service. ALSO, |
47 // not creating this increases test isolation (which is GOOD!) | 47 // not creating this increases test isolation (which is GOOD!) |
48 bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() { | 48 bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() const { |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 ProfileKeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor( | 52 ProfileKeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor( |
53 Profile* profile) const { | 53 Profile* profile) const { |
54 ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry( | 54 ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry( |
55 profile, new ProtocolHandlerRegistry::Delegate()); | 55 profile, new ProtocolHandlerRegistry::Delegate()); |
56 | 56 |
57 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
58 // If installing defaults, they must be installed prior calling | 58 // If installing defaults, they must be installed prior calling |
59 // InitProtocolSettings | 59 // InitProtocolSettings |
60 registry->InstallDefaultsForChromeOS(); | 60 registry->InstallDefaultsForChromeOS(); |
61 #endif | 61 #endif |
62 | 62 |
63 // Must be called as a part of the creation process. | 63 // Must be called as a part of the creation process. |
64 registry->InitProtocolSettings(); | 64 registry->InitProtocolSettings(); |
65 | 65 |
66 return registry; | 66 return registry; |
67 } | 67 } |
OLD | NEW |