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

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 2703963002: Update in-process Devtools permission to be for each specific extension origin (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_ui_bindings.cc
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc
index 2e4b82821715837a788af2289d2e51bc294e4516..eef9d44224e384c4686bc224454c09d041e014be 100644
--- a/chrome/browser/devtools/devtools_ui_bindings.cc
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc
@@ -1262,6 +1262,14 @@ void DevToolsUIBindings::AddDevToolsExtensionsToClient() {
if (extensions::chrome_manifest_urls::GetDevToolsPage(extension.get())
.is_empty())
continue;
+
+ // Each devtools extension will need to be able to run in the devtools
+ // process. Grant each specific extension's origin permission to load
+ // documents.
+ content::ChildProcessSecurityPolicy::GetInstance()->GrantOrigin(
+ web_contents_->GetMainFrame()->GetProcess()->GetID(),
+ url::Origin(extension.get()->url()));
ncarter (slow) 2017/02/22 19:20:06 extension.get()->url() can be simplified to exte
davidsac (gone - try alexmos) 2017/02/22 21:34:54 Done.
+
std::unique_ptr<base::DictionaryValue> extension_info(
new base::DictionaryValue());
extension_info->Set(
@@ -1275,14 +1283,6 @@ void DevToolsUIBindings::AddDevToolsExtensionsToClient() {
extensions::APIPermission::kExperimental)));
results.Append(std::move(extension_info));
}
- if (!results.empty()) {
- // At least one devtools extension exists; it will need to run in the
- // devtools process. Grant it permission to load documents with
- // chrome-extension:// origins.
- content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(
- web_contents_->GetMainFrame()->GetProcess()->GetID(),
- extensions::kExtensionScheme);
- }
CallClientFunction("DevToolsAPI.addExtensions",
&results, NULL, NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698