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

Unified Diff: content/browser/frame_host/data_url_navigation_throttle.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/data_url_navigation_throttle.cc
diff --git a/content/browser/frame_host/data_url_navigation_throttle.cc b/content/browser/frame_host/data_url_navigation_throttle.cc
index 60526be7d2d221a9fe92826721c3b39453dbd55a..c29d29c29de04ae78c3a166f6eb20b4f787ab88f 100644
--- a/content/browser/frame_host/data_url_navigation_throttle.cc
+++ b/content/browser/frame_host/data_url_navigation_throttle.cc
@@ -7,11 +7,13 @@
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
+#include "build/build_config.h"
#include "content/browser/frame_host/frame_tree.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
+#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/console_message_level.h"
#include "content/public/common/content_features.h"
#include "url/url_constants.h"
@@ -31,6 +33,18 @@ DataUrlNavigationThrottle::~DataUrlNavigationThrottle() {}
NavigationThrottle::ThrottleCheckResult
DataUrlNavigationThrottle::WillProcessResponse() {
+#if defined(OS_ANDROID)
+ // This should ideally be done in CreateThrottleForNavigation(), but
+ // NavigationHandleImpl::GetRenderFrameHost() expects to not be run before
+ // WillProcessResponse().
+ // TODO(meacer): Remove this special case when PlzNavigate is enabled.
+ if (!IsBrowserSideNavigationEnabled() &&
+ navigation_handle()
+ ->GetRenderFrameHost()
+ ->IsDataUrlNavigationAllowedForAndroidWebView()) {
+ return PROCEED;
+ }
+#endif
NavigationHandleImpl* handle =
static_cast<NavigationHandleImpl*>(navigation_handle());
if (handle->is_download())

Powered by Google App Engine
This is Rietveld 408576698