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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2969473003: Allow data URL navigations for Android WebView until PlzNavigate ships (Closed)
Patch Set: clamy comments Created 3 years, 5 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: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index d15b46580d7ac3baa908bd5adccf85107da9c274..c29cb6a383c0c658881ed9b610e40ab8b2598e0e 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -169,10 +169,16 @@ int g_next_accessibility_reset_token = 1;
// The next value to use for the javascript callback id.
int g_next_javascript_callback_id = 1;
+#if defined(OS_ANDROID)
// Whether to allow injecting javascript into any kind of frame (for Android
// WebView).
bool g_allow_injecting_javascript = false;
+// Whether to allow data URL navigations for Android WebView.
+// TODO(meacer): Remove after PlzNavigate ships.
+bool g_allow_data_url_navigation = false;
+#endif
+
// The (process id, routing id) pair that identifies one RenderFrame.
typedef std::pair<int32_t, int32_t> RenderFrameHostID;
typedef base::hash_map<RenderFrameHostID, RenderFrameHostImpl*>
@@ -378,6 +384,16 @@ void RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView() {
g_allow_injecting_javascript = true;
}
+// static
+void RenderFrameHost::AllowDataUrlNavigationForAndroidWebView() {
+ g_allow_data_url_navigation = true;
+}
+
+// static
+bool RenderFrameHost::IsDataUrlNavigationAllowedForAndroidWebView() {
+ return g_allow_data_url_navigation;
+}
+
void CreateMediaPlayerRenderer(
content::RenderFrameHost* render_frame_host,
const service_manager::BindSourceInfo& source_info,
@@ -3778,8 +3794,11 @@ void RenderFrameHostImpl::UpdatePermissionsForNavigation(
}
bool RenderFrameHostImpl::CanExecuteJavaScript() {
- return g_allow_injecting_javascript ||
- !frame_tree_node_->current_url().is_valid() ||
+#if defined(OS_ANDROID)
+ if (g_allow_injecting_javascript)
+ return true;
+#endif
+ return !frame_tree_node_->current_url().is_valid() ||
frame_tree_node_->current_url().SchemeIs(kChromeDevToolsScheme) ||
ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
GetProcess()->GetID()) ||
« no previous file with comments | « content/browser/frame_host/data_url_navigation_throttle.cc ('k') | content/public/browser/render_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698