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

Unified Diff: extensions/browser/guest_view/web_view/web_view_content_script_manager.cc

Issue 2227193002: Make UserScript non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove browser/renderer specific file impl as it is not helping much 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/guest_view/web_view/web_view_content_script_manager.cc
diff --git a/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc b/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc
index d08769f6534c7caba1974b17a9d8cda91a0d6602..10d5ff56b5a5f165e597ad36dfd786dc731ff0d1 100644
--- a/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc
+++ b/extensions/browser/guest_view/web_view/web_view_content_script_manager.cc
@@ -46,7 +46,7 @@ void WebViewContentScriptManager::AddContentScripts(
content::RenderFrameHost* render_frame_host,
int view_instance_id,
const HostID& host_id,
- const UserScriptList& scripts) {
+ UserScriptList& scripts) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DeclarativeUserScriptMaster* master =
@@ -72,8 +72,8 @@ void WebViewContentScriptManager::AddContentScripts(
// Step 2: updates the guest_content_script_map_.
ContentScriptMap& map = iter->second;
std::set<UserScriptIDPair> to_delete;
- for (const UserScript& script : scripts) {
- auto map_iter = map.find(script.name());
+ for (const std::unique_ptr<UserScript>& script : scripts) {
+ auto map_iter = map.find(script->name());
// If a content script has the same name as the new one, remove the old
// script first, and insert the new one.
if (map_iter != map.end()) {
@@ -81,9 +81,10 @@ void WebViewContentScriptManager::AddContentScripts(
map.erase(map_iter);
}
map.insert(std::pair<std::string, UserScriptIDPair>(
- script.name(), UserScriptIDPair(script.id(), script.host_id())));
- ids_to_add.insert(script.id());
+ script->name(), UserScriptIDPair(script->id(), script->host_id())));
+ ids_to_add.insert(script->id());
}
+
if (!to_delete.empty())
master->RemoveScripts(to_delete);

Powered by Google App Engine
This is Rietveld 408576698