| 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)));
|
| }
|
|
|