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

Unified Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 572633003: Enable webview tag in webui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix object-src Created 6 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/web_view/web_view_guest.cc
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index 0215e6fdcb7e19dde590433c7b6613e9774893a7..cda0da0d4b5082f8682a8279163259b18672e037 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -184,6 +184,7 @@ int WebViewGuest::GetTaskPrefix() const {
void WebViewGuest::CreateWebContents(
const std::string& embedder_extension_id,
int embedder_render_process_id,
+ const GURL& embedder_site_url,
const base::DictionaryValue& create_params,
const WebContentsCreatedCallback& callback) {
content::RenderProcessHost* embedder_render_process_host =
@@ -208,12 +209,20 @@ void WebViewGuest::CreateWebContents(
std::string url_encoded_partition = net::EscapeQueryParamValue(
storage_partition_id, false);
// The SiteInstance of a given webview tag is based on the fact that it's
- // a guest process in addition to which platform application the tag
- // belongs to and what storage partition is in use, rather than the URL
- // that the tag is being navigated to.
+ // a guest process in addition to which platform application or which WebUI
+ // page the tag belongs to and what storage partition is in use, rather than
+ // the URL that the tag is being navigated to.
+ std::string partition_domain;
+ if (embedder_extension_id.empty()) {
+ DCHECK(content::ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
+ embedder_render_process_id));
+ partition_domain = embedder_site_url.host();
+ } else {
+ partition_domain = embedder_extension_id;
+ }
GURL guest_site(base::StringPrintf("%s://%s/%s?%s",
content::kGuestScheme,
- embedder_extension_id.c_str(),
+ partition_domain.c_str(),
persist_storage ? "persist" : "",
url_encoded_partition.c_str()));
@@ -741,7 +750,6 @@ void WebViewGuest::PushWebViewStateToIOThread() {
NOTREACHED();
return;
}
- DCHECK(embedder_extension_id() == partition_domain);
WebViewRendererState::WebViewInfo web_view_info;
web_view_info.embedder_process_id = embedder_render_process_id();
@@ -1076,7 +1084,6 @@ void WebViewGuest::DestroyUnattachedWindows() {
GURL WebViewGuest::ResolveURL(const std::string& src) {
if (!in_extension()) {
- NOTREACHED();
return GURL(src);
}

Powered by Google App Engine
This is Rietveld 408576698