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

Unified Diff: chrome/browser/extensions/extension_system_factory.cc

Issue 9369013: Take extensions out of Profile into a profile-keyed service, ExtensionSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no crashy Created 8 years, 10 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/extensions/extension_system_factory.cc
diff --git a/chrome/browser/extensions/extension_system_factory.cc b/chrome/browser/extensions/extension_system_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5e5cf53c7dfa05dcdbe1ddab1be4fd721f874a75
--- /dev/null
+++ b/chrome/browser/extensions/extension_system_factory.cc
@@ -0,0 +1,88 @@
+// 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/extensions/extension_system_factory.h"
+
+#include "chrome/browser/extensions/extension_message_service.h"
+#include "chrome/browser/extensions/extension_prefs.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+
Aaron Boodman 2012/02/28 00:21:21 Unneeded linebreak.
Yoyo Zhou 2012/02/28 22:58:26 Axed.
+#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "chrome/browser/themes/theme_service_factory.h"
+#include "chrome/browser/ui/global_error_service_factory.h"
+
+// ExtensionSystemDelegateFactory
+
+// static
+ExtensionSystemImpl::Delegate* ExtensionSystemDelegateFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<ExtensionSystemImpl::Delegate*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+// static
+ExtensionSystemDelegateFactory* ExtensionSystemDelegateFactory::GetInstance() {
+ return Singleton<ExtensionSystemDelegateFactory>::get();
+}
+
+ExtensionSystemDelegateFactory::ExtensionSystemDelegateFactory()
+ : ProfileKeyedServiceFactory(
+ "ExtensionSystemDelegate",
+ ProfileDependencyManager::GetInstance()) {
+ DependsOn(GlobalErrorServiceFactory::GetInstance());
+ DependsOn(TemplateURLServiceFactory::GetInstance());
+ DependsOn(ThemeServiceFactory::GetInstance());
+}
+
+ExtensionSystemDelegateFactory::~ExtensionSystemDelegateFactory() {
+}
+
+ProfileKeyedService* ExtensionSystemDelegateFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ return new ExtensionSystemImpl::Delegate(profile);
+}
+
+bool ExtensionSystemDelegateFactory::ServiceRedirectedInIncognito() {
+ return true;
+}
+
+// ExtensionSystemFactory
+
+// static
+ExtensionSystem* ExtensionSystemFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<ExtensionSystem*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+// static
+ExtensionSystemFactory* ExtensionSystemFactory::GetInstance() {
+ return Singleton<ExtensionSystemFactory>::get();
+}
+
+ExtensionSystemFactory::ExtensionSystemFactory()
+ : ProfileKeyedServiceFactory(
+ "ExtensionSystem",
+ ProfileDependencyManager::GetInstance()) {
+ DependsOn(ExtensionSystemDelegateFactory::GetInstance());
+}
+
+ExtensionSystemFactory::~ExtensionSystemFactory() {
+}
+
+ProfileKeyedService* ExtensionSystemFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ return new ExtensionSystemImpl(profile);
+}
+
+bool ExtensionSystemFactory::ServiceHasOwnInstanceInIncognito() {
+ return true;
+}
+
+bool ExtensionSystemFactory::ServiceIsCreatedWithProfile() {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698