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

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

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce HostID for DeclarativeUserScriptMaser assignment, remove ConsumerID. Created 5 years, 11 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_user_script_loader.h
diff --git a/chrome/browser/extensions/extension_user_script_loader.h b/chrome/browser/extensions/extension_user_script_loader.h
new file mode 100644
index 0000000000000000000000000000000000000000..e884b5831b39f879cf78211a2f57a82bf803aac1
--- /dev/null
+++ b/chrome/browser/extensions/extension_user_script_loader.h
@@ -0,0 +1,60 @@
+// 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.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_
+
+#include "base/memory/shared_memory.h"
+#include "chrome/browser/extensions/user_script_loader.h"
+#include "extensions/browser/extension_registry_observer.h"
+#include "extensions/common/extension.h"
+
+namespace content {
+class BrowserContext;
+}
+
+class Profile;
+
+namespace extensions {
+
+class ContentVerifier;
Devlin 2015/01/26 20:12:08 Delete.
Xi Han 2015/01/26 23:27:53 Done.
+class ExtensionRegistry;
+
+// UserScriptLoader for extensions.
+class ExtensionUserScriptLoader : public UserScriptLoader,
+ public ExtensionRegistryObserver {
+ public:
+ // The listen_for_extension_system_loaded is only set true when initilizing
+ // the Exttension System, e.g, when constructs SharedUserScriptMaster in
+ // ExtensionSystemImpl.
+ ExtensionUserScriptLoader(Profile* profile,
+ const HostID& host_id,
+ bool listen_for_extension_system_loaded);
+ ~ExtensionUserScriptLoader() override;
+
+ private:
+ // UserScriptLoader:
+ void UpdateHostsInfo(const std::set<HostID>& changed_hosts) override;
+ LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override;
+
+ // ExtensionRegistryObserver:
+ void OnExtensionUnloaded(content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) override;
+
+ // Initiates script load when we have been waiting for the extension system
+ // to be ready.
+ void OnExtensionSystemReady();
+
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
+
+ base::WeakPtrFactory<ExtensionUserScriptLoader> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionUserScriptLoader);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_USER_SCRIPT_LOADER_H_

Powered by Google App Engine
This is Rietveld 408576698