OLD | NEW |
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 UserScript::RunLocation run_location, | 372 UserScript::RunLocation run_location, |
373 ScriptsRunInfo* scripts_run_info) { | 373 ScriptsRunInfo* scripts_run_info) { |
374 // Try to inject the script. If the injection is waiting (i.e., for | 374 // Try to inject the script. If the injection is waiting (i.e., for |
375 // permission), add it to the list of pending injections. If the injection | 375 // permission), add it to the list of pending injections. If the injection |
376 // has blocked, add it to the list of running injections. | 376 // has blocked, add it to the list of running injections. |
377 switch (injection->TryToInject( | 377 switch (injection->TryToInject( |
378 run_location, | 378 run_location, |
379 scripts_run_info, | 379 scripts_run_info, |
380 this)) { | 380 this)) { |
381 case ScriptInjection::INJECTION_WAITING: | 381 case ScriptInjection::INJECTION_WAITING: |
382 pending_injections_.push_back(injection.release()); | 382 pending_injections_.push_back(injection.Pass()); |
383 break; | 383 break; |
384 case ScriptInjection::INJECTION_BLOCKED: | 384 case ScriptInjection::INJECTION_BLOCKED: |
385 running_injections_.push_back(injection.release()); | 385 running_injections_.push_back(injection.Pass()); |
386 break; | 386 break; |
387 case ScriptInjection::INJECTION_FINISHED: | 387 case ScriptInjection::INJECTION_FINISHED: |
388 break; | 388 break; |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 void ScriptInjectionManager::HandleExecuteCode( | 392 void ScriptInjectionManager::HandleExecuteCode( |
393 const ExtensionMsg_ExecuteCode_Params& params, | 393 const ExtensionMsg_ExecuteCode_Params& params, |
394 content::RenderView* render_view) { | 394 content::RenderView* render_view) { |
395 // TODO(dcheng): Not sure how this can happen today. In an OOPI world, it | 395 // TODO(dcheng): Not sure how this can happen today. In an OOPI world, it |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |