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

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

Issue 10546083: Convert ProtocolHandlerRegistry to be a ProfileKeyedService. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Don't create PHR instances via TestProfile. Created 8 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
6
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
9 #include "chrome/browser/extensions/extension_system_factory.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_dependency_manager.h"
12
13 // static
14 ProtocolHandlerRegistryFactory* ProtocolHandlerRegistryFactory::GetInstance() {
15 return Singleton<ProtocolHandlerRegistryFactory>::get();
16 }
17
18 // static
19 ProtocolHandlerRegistry* ProtocolHandlerRegistryFactory::GetForProfile(
20 Profile* profile) {
21
Elliot Glaysher 2012/06/22 17:32:48 Please don't do this. One line of whitespace betwe
Steve McKay 2012/06/22 18:01:58 Done.
22 return static_cast<ProtocolHandlerRegistry*>(
23 GetInstance()->GetServiceForProfile(profile, true));
24 }
25
26 ProtocolHandlerRegistryFactory::ProtocolHandlerRegistryFactory()
27 : ProfileKeyedServiceFactory("ProtocolHandlerRegistry",
28 ProfileDependencyManager::GetInstance()) {
29 }
30
31 ProtocolHandlerRegistryFactory::~ProtocolHandlerRegistryFactory() {
32 }
33
34 // Will be created when initializing profile_io_data, so we might
35 // as well have the framework create this along with other
36 // PKSs to preserve orderly civic conduct :)
37 bool ProtocolHandlerRegistryFactory::ServiceIsCreatedWithProfile() {
38 return true;
39 }
40
41 // Allows the produced registry to be used in incognito mode.
42 bool ProtocolHandlerRegistryFactory::ServiceRedirectedInIncognito() {
43 return true;
44 }
45
46 // Do not create this service for tests. MANY tests will fail
47 // due to the threading requirements of this service. ALSO,
48 // not creating this increases test isolation (which is GOOD!)
49 bool ProtocolHandlerRegistryFactory::ServiceIsNULLWhileTesting() {
50 return true;
51 }
52
53 ProfileKeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(
54 Profile* profile) const {
55
Elliot Glaysher 2012/06/22 17:32:48 -whitespace
Steve McKay 2012/06/22 18:01:58 Done.
56 ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry(
57 profile, new ProtocolHandlerRegistry::Delegate());
58
59 registry->InitProtocolSettings();
60
61 return registry;
62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698