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

Unified 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: Update ProtocolHandlerRegistry to be a ProfileKeyedService in lieu of a refcounted pointer. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/custom_handlers/protocol_handler_registry_factory.cc
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_factory.cc b/chrome/browser/custom_handlers/protocol_handler_registry_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ea7df3bba9e6760f1f5106560b6568901dde6f0f
--- /dev/null
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_factory.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
+#include "chrome/browser/extensions/extension_system_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+
+// static
+ProtocolHandlerRegistryFactory* ProtocolHandlerRegistryFactory::GetInstance() {
+ return Singleton<ProtocolHandlerRegistryFactory>::get();
+}
+
+// static
+ProtocolHandlerRegistry* ProtocolHandlerRegistryFactory::GetForProfile(
+ Profile* profile) {
+
Peter Kasting 2012/06/11 00:41:26 Nit: Extra blank lines (3 places)
Steve McKay 2012/06/11 22:09:38 Done. Though allow me to proselytize for more whit
Peter Kasting 2012/06/12 00:31:37 I don't mind whitespace in general, but a blank li
Steve McKay 2012/06/14 22:06:23 Done.
+ return static_cast<ProtocolHandlerRegistry*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+ProtocolHandlerRegistryFactory::ProtocolHandlerRegistryFactory()
+ : ProfileKeyedServiceFactory("ProtocolHandlerRegistry",
+ ProfileDependencyManager::GetInstance()) {
+
+ // DependsOn(WebIntentsRegistryFactory::GetInstance());
Elliot Glaysher 2012/06/11 19:43:16 Is this supposed to be uncommented? I see that Web
Steve McKay 2012/06/11 22:09:38 Trying to segregate CLs to keep the switch to PKS
Peter Kasting 2012/06/12 00:31:37 Do you mean that right now the ProtocolHandlerRegi
Steve McKay 2012/06/14 22:06:23 Done.
+}
+
+ProtocolHandlerRegistryFactory::~ProtocolHandlerRegistryFactory() {
+}
+
+ProfileKeyedService* ProtocolHandlerRegistryFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+
+ ProtocolHandlerRegistry* registry = new ProtocolHandlerRegistry(
+ profile,
+ new ProtocolHandlerRegistry::Delegate());
Peter Kasting 2012/06/11 00:41:26 Nit: Could put on previous line
Steve McKay 2012/06/11 22:09:38 Done.
+
+ registry->InitProtocolSettings();
+
+ return registry;
+}
+
+bool ProtocolHandlerRegistryFactory::ServiceRedirectedInIncognito() {
+ return false;
Peter Kasting 2012/06/11 00:41:26 This is already the default behavior.
Steve McKay 2012/06/11 22:09:38 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698