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

Unified Diff: extensions/browser/declarative_user_script_master.cc

Issue 2227193002: Make UserScript non-copyable. (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/declarative_user_script_master.cc
diff --git a/extensions/browser/declarative_user_script_master.cc b/extensions/browser/declarative_user_script_master.cc
index 9ea77e865ed8461c19ba970add592d9efc819b2d..5230ed629f76a6135b53416aa1e0a9c5fd22d118 100644
--- a/extensions/browser/declarative_user_script_master.cc
+++ b/extensions/browser/declarative_user_script_master.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/declarative_user_script_master.h"
+#include "base/memory/ptr_util.h"
#include "content/public/browser/browser_context.h"
#include "extensions/browser/extension_user_script_loader.h"
#include "extensions/browser/user_script_loader.h"
@@ -31,20 +32,24 @@ DeclarativeUserScriptMaster::DeclarativeUserScriptMaster(
DeclarativeUserScriptMaster::~DeclarativeUserScriptMaster() {
}
-void DeclarativeUserScriptMaster::AddScript(const UserScript& script) {
- loader_->AddScripts(UserScriptList(1, script));
+void DeclarativeUserScriptMaster::AddScript(
+ std::unique_ptr<UserScript> script) {
+ std::unique_ptr<UserScriptList> scripts(new UserScriptList());
+ scripts->push_back(std::move(script));
+ loader_->AddScripts(std::move(scripts));
}
-void DeclarativeUserScriptMaster::AddScripts(const UserScriptList& scripts,
- int render_process_id,
- int render_view_id) {
- loader_->AddScripts(scripts, render_process_id, render_view_id);
+void DeclarativeUserScriptMaster::AddScripts(
+ std::unique_ptr<UserScriptList> scripts,
+ int render_process_id,
+ int render_view_id) {
+ loader_->AddScripts(std::move(scripts), render_process_id, render_view_id);
}
-void DeclarativeUserScriptMaster::RemoveScript(const UserScript& script) {
- std::set<UserScriptIDPair> set;
- set.insert(UserScriptIDPair(script.id(), script.host_id()));
- loader_->RemoveScripts(set);
+void DeclarativeUserScriptMaster::RemoveScript(const UserScriptIDPair& script) {
+ std::set<UserScriptIDPair> scripts;
+ scripts.insert(script);
+ RemoveScripts(scripts);
}
void DeclarativeUserScriptMaster::RemoveScripts(
« no previous file with comments | « extensions/browser/declarative_user_script_master.h ('k') | extensions/browser/extension_user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698