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

Side by Side Diff: extensions/renderer/extension_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/common/extension_set.h" 5 #include "extensions/common/extension_set.h"
6 #include "extensions/common/manifest_handlers/csp_info.h" 6 #include "extensions/common/manifest_handlers/csp_info.h"
7 #include "extensions/renderer/extension_injection_host.h" 7 #include "extensions/renderer/extension_injection_host.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 ExtensionInjectionHost::ExtensionInjectionHost( 11 ExtensionInjectionHost::ExtensionInjectionHost(
12 const Extension* extension) 12 const Extension* extension)
13 : InjectionHost(HostID(HostID::EXTENSIONS, extension->id())), 13 : InjectionHost(HostID(HostID::EXTENSIONS, extension->id())),
14 extension_(extension) { 14 extension_(extension) {
15 } 15 }
16 16
17 ExtensionInjectionHost::~ExtensionInjectionHost() { 17 ExtensionInjectionHost::~ExtensionInjectionHost() {
18 } 18 }
19 19
20 // static 20 // static
21 scoped_ptr<const ExtensionInjectionHost> ExtensionInjectionHost::Create( 21 scoped_ptr<const InjectionHost> ExtensionInjectionHost::Create(
22 const std::string& extension_id, const ExtensionSet* extensions) { 22 const std::string& extension_id,
23 const ExtensionSet* extensions) {
23 const Extension* extension = extensions->GetByID(extension_id); 24 const Extension* extension = extensions->GetByID(extension_id);
24 if (!extension) 25 if (!extension)
25 return scoped_ptr<const ExtensionInjectionHost>(); 26 return scoped_ptr<const ExtensionInjectionHost>();
26 return scoped_ptr<const ExtensionInjectionHost>( 27 return scoped_ptr<const ExtensionInjectionHost>(
27 new ExtensionInjectionHost(extension)); 28 new ExtensionInjectionHost(extension));
28 } 29 }
29 30
30 std::string ExtensionInjectionHost::GetContentSecurityPolicy() const { 31 std::string ExtensionInjectionHost::GetContentSecurityPolicy() const {
31 return CSPInfo::GetContentSecurityPolicy(extension_); 32 return CSPInfo::GetContentSecurityPolicy(extension_);
32 } 33 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // We notify the browser of any injection if the extension has no withheld 71 // We notify the browser of any injection if the extension has no withheld
71 // permissions (i.e., the permissions weren't restricted), but would have 72 // permissions (i.e., the permissions weren't restricted), but would have
72 // otherwise been affected by the scripts-require-action feature. 73 // otherwise been affected by the scripts-require-action feature.
73 return extension_->permissions_data()->withheld_permissions()->IsEmpty() && 74 return extension_->permissions_data()->withheld_permissions()->IsEmpty() &&
74 PermissionsData::ScriptsMayRequireActionForExtension( 75 PermissionsData::ScriptsMayRequireActionForExtension(
75 extension_, 76 extension_,
76 extension_->permissions_data()->active_permissions().get()); 77 extension_->permissions_data()->active_permissions().get());
77 } 78 }
78 79
79 } // namespace extensions 80 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698