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

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: Clean up. 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..bd938185562ff91240999a6296bb5c148751d154 100644
--- a/extensions/browser/extension_user_script_loader.h
+++ b/extensions/browser/extension_user_script_loader.h
@@ -22,6 +22,11 @@ class ExtensionRegistry;
class ExtensionUserScriptLoader : public UserScriptLoader,
public ExtensionRegistryObserver {
public:
+ using PathAndDefaultLocale = std::pair<base::FilePath, std::string>;
Devlin 2015/04/24 17:50:59 Why do these need to be public? And can't Substit
Xi Han 2015/04/24 18:28:54 There are several functions in the anonymous names
+ using HostsInfo = std::map<HostID, PathAndDefaultLocale>;
+
+ using SubstitutionMap = std::map<std::string, std::string>;
+
// The listen_for_extension_system_loaded is only set true when initilizing
// the Extension System, e.g, when constructs SharedUserScriptMaster in
// ExtensionSystemImpl.
@@ -30,10 +35,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 +59,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_;

Powered by Google App Engine
This is Rietveld 408576698