diff options
author | hanxi <hanxi@chromium.org> | 2015-03-04 06:36:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-04 14:37:10 +0000 |
commit | 9b8416668b08fc2261773c4e713a95175e029649 (patch) | |
tree | 801d02149909386fad4adb71de3347ddb47a31de /extensions/renderer/web_ui_injection_host.cc | |
parent | 13cf260ac3550317329c4cfab41b8c973f634162 (diff) | |
download | chromium_src-9b8416668b08fc2261773c4e713a95175e029649.zip chromium_src-9b8416668b08fc2261773c4e713a95175e029649.tar.gz chromium_src-9b8416668b08fc2261773c4e713a95175e029649.tar.bz2 |
Refactoring: de-couple Extensions from "script injection System" [render side]:3
- Introduce WebUIInjectionHost class and plumb InjectionHost interface
to replace Extension in script injection system in the render.
- Store InjectionHost in ScriptInjection to avoid constructing InjectionHost
objects everywhere.
BUG=459234
Review URL: https://codereview.chromium.org/934763003
Cr-Commit-Position: refs/heads/master@{#319067}
Diffstat (limited to 'extensions/renderer/web_ui_injection_host.cc')
-rw-r--r-- | extensions/renderer/web_ui_injection_host.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/extensions/renderer/web_ui_injection_host.cc b/extensions/renderer/web_ui_injection_host.cc new file mode 100644 index 0000000..334358a --- /dev/null +++ b/extensions/renderer/web_ui_injection_host.cc @@ -0,0 +1,41 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/renderer/web_ui_injection_host.h" + +WebUIInjectionHost::WebUIInjectionHost(const HostID& host_id) + : InjectionHost(host_id), + url_(host_id.id()) { +} + +WebUIInjectionHost::~WebUIInjectionHost() { +} + + +std::string WebUIInjectionHost::GetContentSecurityPolicy() const { + return std::string(); +} + +const GURL& WebUIInjectionHost::url() const { + return url_; +} + +const std::string& WebUIInjectionHost::name() const { + return id().id(); +} + +extensions::PermissionsData::AccessType WebUIInjectionHost::CanExecuteOnFrame( + const GURL& document_url, + const GURL& top_frame_url, + int tab_id, + bool is_declarative) const { + // Content scripts are allowed to inject on webviews created by WebUI. + return extensions::PermissionsData::AccessType::ACCESS_ALLOWED; +} + +bool WebUIInjectionHost::ShouldNotifyBrowserOfInjection() const { + // We don't notify browser of any injection made from WebUI, since the + // decision for injection is made in the render. + return false; +} |