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

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

Issue 1335083004: [Extensions] Don't allow extensions to inject scripts into extension pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | extensions/renderer/user_script_injector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } else if (params.host_id.type() == HostID::WEBUI) { 406 } else if (params.host_id.type() == HostID::WEBUI) {
407 injection_host.reset( 407 injection_host.reset(
408 new WebUIInjectionHost(params.host_id)); 408 new WebUIInjectionHost(params.host_id));
409 } 409 }
410 410
411 scoped_ptr<ScriptInjection> injection(new ScriptInjection( 411 scoped_ptr<ScriptInjection> injection(new ScriptInjection(
412 scoped_ptr<ScriptInjector>( 412 scoped_ptr<ScriptInjector>(
413 new ProgrammaticScriptInjector(params, render_frame)), 413 new ProgrammaticScriptInjector(params, render_frame)),
414 render_frame, 414 render_frame,
415 injection_host.Pass(), 415 injection_host.Pass(),
416 static_cast<UserScript::RunLocation>(params.run_at), 416 static_cast<UserScript::RunLocation>(params.run_at)));
417 ExtensionFrameHelper::Get(render_frame)->tab_id()));
418 417
419 FrameStatusMap::const_iterator iter = frame_statuses_.find(render_frame); 418 FrameStatusMap::const_iterator iter = frame_statuses_.find(render_frame);
420 UserScript::RunLocation run_location = 419 UserScript::RunLocation run_location =
421 iter == frame_statuses_.end() ? UserScript::UNDEFINED : iter->second; 420 iter == frame_statuses_.end() ? UserScript::UNDEFINED : iter->second;
422 421
423 ScriptsRunInfo scripts_run_info(render_frame, run_location); 422 ScriptsRunInfo scripts_run_info(render_frame, run_location);
424 TryToInject(injection.Pass(), run_location, &scripts_run_info); 423 TryToInject(injection.Pass(), run_location, &scripts_run_info);
425 } 424 }
426 425
427 void ScriptInjectionManager::HandleExecuteDeclarativeScript( 426 void ScriptInjectionManager::HandleExecuteDeclarativeScript(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 ScriptsRunInfo scripts_run_info(injection->render_frame(), 470 ScriptsRunInfo scripts_run_info(injection->render_frame(),
472 UserScript::RUN_DEFERRED); 471 UserScript::RUN_DEFERRED);
473 ScriptInjection::InjectionResult res = injection->OnPermissionGranted( 472 ScriptInjection::InjectionResult res = injection->OnPermissionGranted(
474 &scripts_run_info); 473 &scripts_run_info);
475 if (res == ScriptInjection::INJECTION_BLOCKED) 474 if (res == ScriptInjection::INJECTION_BLOCKED)
476 running_injections_.push_back(injection.Pass()); 475 running_injections_.push_back(injection.Pass());
477 scripts_run_info.LogRun(); 476 scripts_run_info.LogRun();
478 } 477 }
479 478
480 } // namespace extensions 479 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/script_injection.cc ('k') | extensions/renderer/user_script_injector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698