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

Unified Diff: chrome/browser/extensions/shared_user_script_master.h

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: Fix nit and rebase from master 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/shared_user_script_master.h
diff --git a/chrome/browser/extensions/shared_user_script_master.h b/chrome/browser/extensions/shared_user_script_master.h
new file mode 100644
index 0000000000000000000000000000000000000000..3658525e011c6a4f719f92a85f1ac13be86e29e7
--- /dev/null
+++ b/chrome/browser/extensions/shared_user_script_master.h
@@ -0,0 +1,65 @@
+// Copyright 2014 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_
+#define CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_
+
+#include <set>
+
+#include "base/scoped_observer.h"
+#include "chrome/browser/extensions/user_script_loader.h"
+#include "extensions/browser/extension_registry_observer.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/user_script.h"
+
+namespace content {
+class BrowserContext;
+}
+
+class Profile;
+
+namespace extensions {
+
+class ExtensionRegistry;
+
+// Manages statically-defined user scripts for all extensions. Owns a
+// UserScriptLoader to which file loading and shared memory management
+// operations are delegated.
+class SharedUserScriptMaster : public ExtensionRegistryObserver {
+ public:
+ explicit SharedUserScriptMaster(Profile* profile);
+ virtual ~SharedUserScriptMaster();
+
+ // Provides access to loader state method: scripts_ready().
+ bool scripts_ready() const { return loader_.scripts_ready(); }
+
+ private:
+ // ExtensionRegistryObserver implementation.
+ virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
+ const Extension* extension) OVERRIDE;
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
+
+ // Gets an extension's scripts' metadata; i.e., gets a list of UserScript
+ // objects that contains script info, but not the contents of the scripts.
+ const std::set<UserScript> GetScriptsMetadata(const Extension* extension);
+
+ // Script loader that handles loading contents of scripts into shared memory
+ // and notifying renderers of scripts in shared memory.
+ UserScriptLoader loader_;
+
+ // The profile for which the scripts managed here are installed.
+ Profile* profile_;
+
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(SharedUserScriptMaster);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_SHARED_USER_SCRIPT_MASTER_H_
« no previous file with comments | « chrome/browser/extensions/extension_system_impl.cc ('k') | chrome/browser/extensions/shared_user_script_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698