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

Unified Diff: extensions/renderer/user_script_set.cc

Issue 2193093002: [UserScript cleanup] Remove use of ScopedVector from UserScriptSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « extensions/renderer/user_script_set.h ('k') | extensions/renderer/user_script_set_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/user_script_set.cc
diff --git a/extensions/renderer/user_script_set.cc b/extensions/renderer/user_script_set.cc
index 4e15901daf0e9781d43f3ddc1b3a177a83b611b7..9c6ca59731efde8774e714a6c9e40261d8347ba8 100644
--- a/extensions/renderer/user_script_set.cc
+++ b/extensions/renderer/user_script_set.cc
@@ -58,7 +58,7 @@ void UserScriptSet::RemoveObserver(Observer* observer) {
void UserScriptSet::GetActiveExtensionIds(
std::set<std::string>* ids) const {
- for (const UserScript* script : scripts_) {
+ for (const std::unique_ptr<UserScript>& script : scripts_) {
if (script->host_id().type() != HostID::EXTENSIONS)
continue;
DCHECK(!script->extension_id().empty());
@@ -73,9 +73,9 @@ void UserScriptSet::GetInjections(
UserScript::RunLocation run_location,
bool log_activity) {
GURL document_url = GetDocumentUrlForFrame(render_frame->GetWebFrame());
- for (const UserScript* script : scripts_) {
+ for (const std::unique_ptr<UserScript>& script : scripts_) {
std::unique_ptr<ScriptInjection> injection = GetInjectionForScript(
- script, render_frame, tab_id, run_location, document_url,
+ script.get(), render_frame, tab_id, run_location, document_url,
false /* is_declarative */, log_activity);
if (injection.get())
injections->push_back(std::move(injection));
@@ -150,9 +150,8 @@ bool UserScriptSet::UpdateUserScripts(base::SharedMemoryHandle shared_memory,
scripts_.push_back(std::move(script));
}
- FOR_EACH_OBSERVER(Observer,
- observers_,
- OnUserScriptsUpdated(changed_hosts, scripts_.get()));
+ FOR_EACH_OBSERVER(Observer, observers_,
+ OnUserScriptsUpdated(changed_hosts, scripts_));
return true;
}
@@ -163,11 +162,11 @@ std::unique_ptr<ScriptInjection> UserScriptSet::GetDeclarativeScriptInjection(
UserScript::RunLocation run_location,
const GURL& document_url,
bool log_activity) {
- for (const UserScript* script : scripts_) {
+ for (const std::unique_ptr<UserScript>& script : scripts_) {
if (script->id() == script_id) {
- return GetInjectionForScript(script, render_frame, tab_id, run_location,
- document_url, true /* is_declarative */,
- log_activity);
+ return GetInjectionForScript(script.get(), render_frame, tab_id,
+ run_location, document_url,
+ true /* is_declarative */, log_activity);
}
}
return std::unique_ptr<ScriptInjection>();
« no previous file with comments | « extensions/renderer/user_script_set.h ('k') | extensions/renderer/user_script_set_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698