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

Unified Diff: extensions/browser/declarative_user_script_manager_factory.cc

Issue 1066993002: Make DeclarativeUserScriptManager non-shared between profiles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make DeclarativeUserScriptManager be a KeyedService. Created 5 years, 8 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
« no previous file with comments | « extensions/browser/declarative_user_script_manager_factory.h ('k') | extensions/browser/extension_system.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/declarative_user_script_manager_factory.cc
diff --git a/extensions/browser/declarative_user_script_manager_factory.cc b/extensions/browser/declarative_user_script_manager_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7287f31dda91113e88323c62eb09a9ebb995995a
--- /dev/null
+++ b/extensions/browser/declarative_user_script_manager_factory.cc
@@ -0,0 +1,49 @@
+// Copyright 2015 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 "extensions/browser/declarative_user_script_manager_factory.h"
+
+#include "base/memory/singleton.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+#include "extensions/browser/declarative_user_script_manager.h"
+
+namespace extensions {
+
+// static
+DeclarativeUserScriptManager*
+DeclarativeUserScriptManagerFactory::GetForBrowserContext(
+ content::BrowserContext* browser_context) {
+ return static_cast<DeclarativeUserScriptManager*>(
+ GetInstance()->GetServiceForBrowserContext(browser_context,
+ false /* don't create */));
+}
+
+// static
+DeclarativeUserScriptManagerFactory*
+DeclarativeUserScriptManagerFactory::GetInstance() {
+ return Singleton<DeclarativeUserScriptManagerFactory>::get();
+}
+
+DeclarativeUserScriptManagerFactory::DeclarativeUserScriptManagerFactory()
+ : BrowserContextKeyedServiceFactory(
+ "DeclarativeUserScriptManagerFactory",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+
+DeclarativeUserScriptManagerFactory::~DeclarativeUserScriptManagerFactory() {
+}
+
+KeyedService* DeclarativeUserScriptManagerFactory::BuildServiceInstanceFor(
+ content::BrowserContext* browser_context) const {
+ return new DeclarativeUserScriptManager(
+ static_cast<content::BrowserContext*>(browser_context));
+}
+
+bool DeclarativeUserScriptManagerFactory::ServiceIsCreatedWithBrowserContext()
+ const {
+ return true;
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/browser/declarative_user_script_manager_factory.h ('k') | extensions/browser/extension_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698