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

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

Issue 420543002: Declarative content scripts: Browser-side: per-extension shared memory regions (lazily loaded) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor UserScriptMaster into UserScriptLoader, managed by SharedUserScriptMaster and DeclarativeU… Created 6 years, 4 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/user_script_master_manager.cc
diff --git a/chrome/browser/extensions/user_script_master_manager.cc b/chrome/browser/extensions/user_script_master_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e0c392cc65c4f569c5f7b2412fb4a1a0fbbe2b01
--- /dev/null
+++ b/chrome/browser/extensions/user_script_master_manager.cc
@@ -0,0 +1,37 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
Devlin 2014/08/04 18:33:26 no (c)
Mark Dittmer 2014/08/05 20:33:20 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/user_script_master_manager.h"
+
+#include "chrome/browser/extensions/shared_user_script_master.h"
+#include "chrome/browser/profiles/profile.h"
+
+namespace extensions {
+
+UserScriptMasterManager::UserScriptMasterManager(Profile* profile)
+ : profile_(profile),
+ shared_master_(new SharedUserScriptMaster(profile)),
+ extension_registry_observer_(this) {
+ extension_registry_observer_.Add(ExtensionRegistry::Get(profile));
+}
+
+UserScriptMasterManager::~UserScriptMasterManager() {
+}
+
+void UserScriptMasterManager::OnExtensionLoaded(
+ content::BrowserContext* browser_context,
Devlin 2014/08/04 18:33:26 Why?
Mark Dittmer 2014/08/05 20:33:20 Good question. I erroneously presumed that OnExten
+ const Extension* extension) {
+}
+
+void UserScriptMasterManager::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ const ExtensionId& id = extension->id();
+ if (declarative_masters_.find(id) != declarative_masters_.end()) {
Devlin 2014/08/04 18:33:26 We could just have the DeclUSM listen for this.
Mark Dittmer 2014/08/05 20:33:20 Done.
+ declarative_masters_.get(id)->ClearScripts();
+ }
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698