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

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

Issue 942533003: Enable <webview>.executeScript outside of Apps and Extensions [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_UserScriptSet_non_hostset_2
Patch Set: Created 5 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/web_ui_injection_host.h" 5 #include "extensions/renderer/web_ui_injection_host.h"
6 6
7 WebUIInjectionHost::WebUIInjectionHost(const HostID& host_id) 7 WebUIInjectionHost::WebUIInjectionHost(const HostID& host_id)
8 : InjectionHost(host_id), 8 : InjectionHost(host_id),
9 url_(host_id.id()) { 9 url_(host_id.id()) {
10 } 10 }
11 11
12 WebUIInjectionHost::~WebUIInjectionHost() { 12 WebUIInjectionHost::~WebUIInjectionHost() {
13 } 13 }
14 14
15 // static
16 scoped_ptr<const InjectionHost> WebUIInjectionHost::Create(
17 const HostID& host_id) {
18 return scoped_ptr<const InjectionHost>(new WebUIInjectionHost(host_id));
19 }
15 20
16 std::string WebUIInjectionHost::GetContentSecurityPolicy() const { 21 std::string WebUIInjectionHost::GetContentSecurityPolicy() const {
17 return std::string(); 22 return std::string();
18 } 23 }
19 24
20 const GURL& WebUIInjectionHost::url() const { 25 const GURL& WebUIInjectionHost::url() const {
21 return url_; 26 return url_;
22 } 27 }
23 28
24 const std::string& WebUIInjectionHost::name() const { 29 const std::string& WebUIInjectionHost::name() const {
25 return id().id(); 30 return id().id();
26 } 31 }
27 32
28 extensions::PermissionsData::AccessType WebUIInjectionHost::CanExecuteOnFrame( 33 extensions::PermissionsData::AccessType WebUIInjectionHost::CanExecuteOnFrame(
29 const GURL& document_url, 34 const GURL& document_url,
30 const GURL& top_frame_url, 35 const GURL& top_frame_url,
31 int tab_id, 36 int tab_id,
32 bool is_declarative) const { 37 bool is_declarative) const {
33 // Content scripts are allowed to inject on webviews created by WebUI. 38 // Content scripts are allowed to inject on webviews created by WebUI.
34 return extensions::PermissionsData::AccessType::ACCESS_ALLOWED; 39 return extensions::PermissionsData::AccessType::ACCESS_ALLOWED;
35 } 40 }
36 41
37 bool WebUIInjectionHost::ShouldNotifyBrowserOfInjection() const { 42 bool WebUIInjectionHost::ShouldNotifyBrowserOfInjection() const {
38 // We don't notify browser of any injection made from WebUI, since the 43 // We don't notify browser of any injection made from WebUI, since the
39 // decision for injection is made in the render. 44 // decision for injection is made in the render.
40 return false; 45 return false;
41 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698