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

Unified Diff: extensions/browser/user_script_loader.h

Issue 2228743002: Rework some UserScriptLoader logic in preparation to removing UserScript copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync @tott Created 4 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: extensions/browser/user_script_loader.h
diff --git a/extensions/browser/user_script_loader.h b/extensions/browser/user_script_loader.h
index 5d110a3a0e9c729a6b203668d17b8b6b03567665..1d7aaf010ff6019957cd09de8ba81c1e2a35f86e 100644
--- a/extensions/browser/user_script_loader.h
+++ b/extensions/browser/user_script_loader.h
@@ -58,7 +58,7 @@ class UserScriptLoader : public content::NotificationObserver {
~UserScriptLoader() override;
// Add |scripts| to the set of scripts managed by this loader.
- void AddScripts(const std::set<UserScript>& scripts);
+ void AddScripts(const UserScriptList& scripts);
// Add |scripts| to the set of scripts managed by this loader.
// The fetch of the content of the script starts URL request
@@ -66,12 +66,15 @@ class UserScriptLoader : public content::NotificationObserver {
// |render_process_id, render_frame_id|.
// TODO(hanxi): The renderer information doesn't really belong in this base
// class, but it's not an easy fix.
- virtual void AddScripts(const std::set<UserScript>& scripts,
+ virtual void AddScripts(const UserScriptList& scripts,
int render_process_id,
int render_frame_id);
- // Remove |scripts| from the set of scripts managed by this loader.
- void RemoveScripts(const std::set<UserScript>& scripts);
+ // Removes scripts with ids specified in |scripts| from the set of scripts
+ // managed by this loader.
+ // TODO(lazyboy): Likely we can make |scripts| a std::vector, but
+ // WebViewContentScriptManager makes this non-trivial.
+ void RemoveScripts(const std::set<UserScriptIDPair>& scripts);
// Clears the set of scripts managed by this loader.
void ClearScripts();
@@ -132,7 +135,7 @@ class UserScriptLoader : public content::NotificationObserver {
bool is_loading() const {
// Ownership of |user_scripts_| is passed to the file thread when loading.
- return user_scripts_.get() == NULL;
+ return user_scripts_.get() == nullptr;
}
// Manages our notification registrations.
@@ -144,10 +147,11 @@ class UserScriptLoader : public content::NotificationObserver {
// List of scripts from currently-installed extensions we should load.
std::unique_ptr<UserScriptList> user_scripts_;
- // The mutually-exclusive sets of scripts that were added or removed since the
- // last script load.
- std::set<UserScript> added_scripts_;
- std::set<UserScript> removed_scripts_;
+ // The mutually-exclusive information about sets of scripts that were added or
+ // removed since the last script load. These maps are keyed by script ids.
+ // Note that we only need HostID information for removal.
+ std::map<int, UserScript> added_scripts_map_;
+ std::set<UserScriptIDPair> removed_script_hosts_;
// Indicates whether the the collection of scripts should be cleared before
// additions and removals on the next script load.
« no previous file with comments | « extensions/browser/guest_view/web_view/web_view_content_script_manager.cc ('k') | extensions/browser/user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698