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

Side by Side Diff: extensions/renderer/script_injection_manager.cc

Issue 988633003: Refactoring: de-couple Extensions from "script injection System" [render side]:4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 9 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 "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 ScriptInjection* injection) { 259 ScriptInjection* injection) {
260 ScopedVector<ScriptInjection>::iterator iter = 260 ScopedVector<ScriptInjection>::iterator iter =
261 std::find(running_injections_.begin(), 261 std::find(running_injections_.begin(),
262 running_injections_.end(), 262 running_injections_.end(),
263 injection); 263 injection);
264 if (iter != running_injections_.end()) 264 if (iter != running_injections_.end())
265 running_injections_.erase(iter); 265 running_injections_.erase(iter);
266 } 266 }
267 267
268 void ScriptInjectionManager::OnUserScriptsUpdated( 268 void ScriptInjectionManager::OnUserScriptsUpdated(
269 const std::set<std::string>& changed_extensions, 269 const std::set<HostID>& changed_hosts,
270 const std::vector<UserScript*>& scripts) { 270 const std::vector<UserScript*>& scripts) {
271 for (ScopedVector<ScriptInjection>::iterator iter = 271 for (ScopedVector<ScriptInjection>::iterator iter =
272 pending_injections_.begin(); 272 pending_injections_.begin();
273 iter != pending_injections_.end();) { 273 iter != pending_injections_.end();) {
274 if (changed_extensions.count((*iter)->host_id().id()) > 0) 274 if (changed_hosts.count((*iter)->host_id()) > 0)
275 iter = pending_injections_.erase(iter); 275 iter = pending_injections_.erase(iter);
276 else 276 else
277 ++iter; 277 ++iter;
278 } 278 }
279 } 279 }
280 280
281 void ScriptInjectionManager::RemoveObserver(RVOHelper* helper) { 281 void ScriptInjectionManager::RemoveObserver(RVOHelper* helper) {
282 for (ScopedVector<RVOHelper>::iterator iter = rvo_helpers_.begin(); 282 for (ScopedVector<RVOHelper>::iterator iter = rvo_helpers_.begin();
283 iter != rvo_helpers_.end(); 283 iter != rvo_helpers_.end();
284 ++iter) { 284 ++iter) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 ScriptsRunInfo scripts_run_info; 484 ScriptsRunInfo scripts_run_info;
485 ScriptInjection::InjectionResult res = injection->OnPermissionGranted( 485 ScriptInjection::InjectionResult res = injection->OnPermissionGranted(
486 &scripts_run_info); 486 &scripts_run_info);
487 if (res == ScriptInjection::INJECTION_BLOCKED) 487 if (res == ScriptInjection::INJECTION_BLOCKED)
488 running_injections_.push_back(injection.Pass()); 488 running_injections_.push_back(injection.Pass());
489 scripts_run_info.LogRun(injection->web_frame(), UserScript::RUN_DEFERRED); 489 scripts_run_info.LogRun(injection->web_frame(), UserScript::RUN_DEFERRED);
490 } 490 }
491 491
492 } // namespace extensions 492 } // 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