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

Unified Diff: content/browser/webui/web_ui_impl.cc

Issue 2002633002: PlzNavigate: fix issue preventing navigations to WebUIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now checking when ready to commit Created 4 years, 7 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
« content/browser/webui/web_ui_impl.h ('K') | « content/browser/webui/web_ui_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/web_ui_impl.cc
diff --git a/content/browser/webui/web_ui_impl.cc b/content/browser/webui/web_ui_impl.cc
index 41fc037852c786645705881beed7ad9ca6d0e0fa..9f5c70c3a6d658132d210349f820fa31f1ac6de5 100644
--- a/content/browser/webui/web_ui_impl.cc
+++ b/content/browser/webui/web_ui_impl.cc
@@ -17,6 +17,7 @@
#include "content/browser/web_contents/web_contents_view.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
@@ -24,6 +25,7 @@
#include "content/public/browser/web_ui_message_handler.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/url_constants.h"
namespace content {
@@ -46,6 +48,29 @@ base::string16 WebUI::GetJavascriptCall(
base::char16('(') + parameters + base::char16(')') + base::char16(';');
}
+// static
+bool WebUIImpl::RenderProcessAllowedForURL(RenderProcessHost* process,
+ const GURL& url) {
+ bool is_web_ui_scheme =
+ url.SchemeIs(kChromeDevToolsScheme) || url.SchemeIs(kChromeUIScheme);
+ std::vector<std::string> additional_schemes;
+ GetContentClient()->browser()->GetAdditionalWebUISchemes(&additional_schemes);
+ if (std::find(additional_schemes.begin(), additional_schemes.end(),
+ url.scheme()) != additional_schemes.end()) {
+ is_web_ui_scheme = true;
+ }
+
+ if (!is_web_ui_scheme)
+ return true;
+
+ if (!process)
+ return false;
+
+ StoragePartition* partition = BrowserContext::GetStoragePartitionForSite(
+ process->GetBrowserContext(), url);
+ return partition == process->GetStoragePartition();
+}
+
WebUIImpl::WebUIImpl(WebContents* contents, const std::string& frame_name)
: link_transition_type_(ui::PAGE_TRANSITION_LINK),
bindings_(BINDINGS_POLICY_WEB_UI),
« content/browser/webui/web_ui_impl.h ('K') | « content/browser/webui/web_ui_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698