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

Unified Diff: extensions/browser/extension_user_script_loader.h

Issue 1056533002: Implement <webview>.addContentScript/removeContentScript API [2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview_addremove_contentscripts_2
Patch Set: nits. 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
Index: extensions/browser/extension_user_script_loader.h
diff --git a/extensions/browser/extension_user_script_loader.h b/extensions/browser/extension_user_script_loader.h
index 5ca40605a74a645bd69ef5e2fe8a3dada68be065..d18c4e40dbe6ae9d79d11a73132827d204224386 100644
--- a/extensions/browser/extension_user_script_loader.h
+++ b/extensions/browser/extension_user_script_loader.h
@@ -16,12 +16,16 @@ class BrowserContext;
namespace extensions {
+class ContentVerifier;
class ExtensionRegistry;
// UserScriptLoader for extensions.
class ExtensionUserScriptLoader : public UserScriptLoader,
public ExtensionRegistryObserver {
public:
+ using PathAndDefaultLocale = std::pair<base::FilePath, std::string>;
+ using HostsInfo = std::map<HostID, PathAndDefaultLocale>;
+
// The listen_for_extension_system_loaded is only set true when initilizing
// the Extension System, e.g, when constructs SharedUserScriptMaster in
// ExtensionSystemImpl.
@@ -30,10 +34,20 @@ class ExtensionUserScriptLoader : public UserScriptLoader,
bool listen_for_extension_system_loaded);
~ExtensionUserScriptLoader() override;
+ // A wrapper around the method to load user scripts, which is normally run on
+ // the file thread. Exposed only for tests.
+ void LoadScriptsForTest(UserScriptList* user_scripts);
+
private:
// UserScriptLoader:
- void UpdateHostsInfo(const std::set<HostID>& changed_hosts) override;
- LoadUserScriptsContentFunction GetLoadUserScriptsFunction() override;
+ void LoadScripts(scoped_ptr<UserScriptList> user_scripts,
+ const std::set<HostID>& changed_hosts,
+ const std::set<int>& added_script_ids,
+ LoadScriptsCallback callback) override;
+
+ // Updates |hosts_info_| to contain info for each element of
+ // |changed_hosts_|.
+ void UpdateHostsInfo(const std::set<HostID>& changed_hosts);
// ExtensionRegistryObserver:
void OnExtensionUnloaded(content::BrowserContext* browser_context,
@@ -44,6 +58,12 @@ class ExtensionUserScriptLoader : public UserScriptLoader,
// to be ready.
void OnExtensionSystemReady();
+ // Maps host info needed for localization to a host ID.
+ HostsInfo hosts_info_;
+
+ // Manages content verification of the loaded user scripts.
+ scoped_refptr<ContentVerifier> content_verifier_;
+
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
« no previous file with comments | « extensions/browser/declarative_user_script_master.cc ('k') | extensions/browser/extension_user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698