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

Side by Side Diff: extensions/renderer/script_injection_manager.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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/script_injection_manager.h" 5 #include "extensions/renderer/script_injection_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 auto iter = 292 auto iter =
293 std::find_if(running_injections_.begin(), running_injections_.end(), 293 std::find_if(running_injections_.begin(), running_injections_.end(),
294 [injection](const std::unique_ptr<ScriptInjection>& mode) { 294 [injection](const std::unique_ptr<ScriptInjection>& mode) {
295 return injection == mode.get(); 295 return injection == mode.get();
296 }); 296 });
297 if (iter != running_injections_.end()) 297 if (iter != running_injections_.end())
298 running_injections_.erase(iter); 298 running_injections_.erase(iter);
299 } 299 }
300 300
301 void ScriptInjectionManager::OnUserScriptsUpdated( 301 void ScriptInjectionManager::OnUserScriptsUpdated(
302 const std::set<HostID>& changed_hosts, 302 const std::set<HostID>& changed_hosts) {
303 const std::vector<UserScript*>& scripts) {
304 for (auto iter = pending_injections_.begin(); 303 for (auto iter = pending_injections_.begin();
305 iter != pending_injections_.end();) { 304 iter != pending_injections_.end();) {
306 if (changed_hosts.count((*iter)->host_id()) > 0) 305 if (changed_hosts.count((*iter)->host_id()) > 0)
307 iter = pending_injections_.erase(iter); 306 iter = pending_injections_.erase(iter);
308 else 307 else
309 ++iter; 308 ++iter;
310 } 309 }
311 } 310 }
312 311
313 void ScriptInjectionManager::RemoveObserver(RFOHelper* helper) { 312 void ScriptInjectionManager::RemoveObserver(RFOHelper* helper) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 ScriptsRunInfo scripts_run_info(injection->render_frame(), 502 ScriptsRunInfo scripts_run_info(injection->render_frame(),
504 UserScript::RUN_DEFERRED); 503 UserScript::RUN_DEFERRED);
505 ScriptInjection::InjectionResult res = injection->OnPermissionGranted( 504 ScriptInjection::InjectionResult res = injection->OnPermissionGranted(
506 &scripts_run_info); 505 &scripts_run_info);
507 if (res == ScriptInjection::INJECTION_BLOCKED) 506 if (res == ScriptInjection::INJECTION_BLOCKED)
508 running_injections_.push_back(std::move(injection)); 507 running_injections_.push_back(std::move(injection));
509 scripts_run_info.LogRun(activity_logging_enabled_); 508 scripts_run_info.LogRun(activity_logging_enabled_);
510 } 509 }
511 510
512 } // namespace extensions 511 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_injection_manager.h ('k') | extensions/renderer/user_script_injector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698