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

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

Issue 2765213003: PlzNavigate: treat intent:// as external scheme (Closed)
Patch Set: Created 3 years, 9 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: content/browser/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 6ba54ceff8dbae7e6297620e53ec0825cca1fb4d..c1546c0c05130165191373df9c3c217e1aa9e979 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -183,6 +183,15 @@ void AddAdditionalRequestHeaders(net::HttpRequestHeaders* headers,
headers->SetHeader(net::HttpRequestHeaders::kOrigin, origin.Serialize());
}
+bool IsExternalProtocol(const std::string& scheme) {
+ // The following alternative rule also passes all tests, but checking for
+ // "intent://" is simpler.
+ // !ProfileIOData::IsHandledProtocol(scheme) &&
+ // !(scheme == "chrome-native")
+ const char kIntentScheme[] = "intent";
+ return base::LowerCaseEqualsASCII(scheme, kIntentScheme);
+}
+
} // namespace
// static
@@ -356,15 +365,16 @@ void NavigationRequest::BeginNavigation() {
!navigation_handle_->IsSameDocument()) {
// It's safe to use base::Unretained because this NavigationRequest owns
// the NavigationHandle where the callback will be stored.
- // TODO(clamy): pass the real value for |is_external_protocol| if needed.
// TODO(clamy): pass the method to the NavigationHandle instead of a
// boolean.
+ bool is_external_protocol = IsExternalProtocol(common_params_.url.scheme());
+
navigation_handle_->WillStartRequest(
common_params_.method, common_params_.post_data,
Referrer::SanitizeForRequest(common_params_.url,
common_params_.referrer),
- begin_params_.has_user_gesture, common_params_.transition, false,
- begin_params_.request_context_type,
+ begin_params_.has_user_gesture, common_params_.transition,
+ is_external_protocol, begin_params_.request_context_type,
begin_params_.mixed_content_context_type,
base::Bind(&NavigationRequest::OnStartChecksComplete,
base::Unretained(this)));
@@ -465,13 +475,14 @@ void NavigationRequest::OnRequestRedirected(
return;
}
}
+ bool is_external_protocol = IsExternalProtocol(common_params_.url.scheme());
// It's safe to use base::Unretained because this NavigationRequest owns the
// NavigationHandle where the callback will be stored.
- // TODO(clamy): pass the real value for |is_external_protocol| if needed.
navigation_handle_->WillRedirectRequest(
common_params_.url, common_params_.method, common_params_.referrer.url,
- false, response->head.headers, response->head.connection_info,
+ is_external_protocol, response->head.headers,
+ response->head.connection_info,
base::Bind(&NavigationRequest::OnRedirectChecksComplete,
base::Unretained(this)));
}
« 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