| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 5236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5247 // script, drag-n-drop operation, etc. | 5247 // script, drag-n-drop operation, etc. |
| 5248 // info.extraData is only non-null if this is a redirect. Use the extraData | 5248 // info.extraData is only non-null if this is a redirect. Use the extraData |
| 5249 // initiation information for redirects, and check pending_navigation_params_ | 5249 // initiation information for redirects, and check pending_navigation_params_ |
| 5250 // otherwise. | 5250 // otherwise. |
| 5251 bool is_content_initiated = | 5251 bool is_content_initiated = |
| 5252 info.extraData | 5252 info.extraData |
| 5253 ? static_cast<DocumentState*>(info.extraData) | 5253 ? static_cast<DocumentState*>(info.extraData) |
| 5254 ->navigation_state() | 5254 ->navigation_state() |
| 5255 ->IsContentInitiated() | 5255 ->IsContentInitiated() |
| 5256 : !IsBrowserInitiated(pending_navigation_params_.get()); | 5256 : !IsBrowserInitiated(pending_navigation_params_.get()); |
| 5257 |
| 5258 // Webkit is asking whether to navigate to a new URL. |
| 5259 // This is fine normally, except if we're showing UI from one security |
| 5260 // context and they're trying to navigate to a different context. |
| 5261 const GURL& url = info.urlRequest.url(); |
| 5262 |
| 5263 // With PlzNavigate, the redirect list is available for the first url. So |
| 5264 // maintain the old behavior of not classifying the first URL in the chain as |
| 5265 // a redirect. |
| 5257 bool is_redirect = | 5266 bool is_redirect = |
| 5258 info.extraData || | 5267 info.extraData || |
| 5259 (pending_navigation_params_ && | 5268 (pending_navigation_params_ && |
| 5260 !pending_navigation_params_->request_params.redirects.empty()); | 5269 !pending_navigation_params_->request_params.redirects.empty() && |
| 5270 (!IsBrowserSideNavigationEnabled() || |
| 5271 url != pending_navigation_params_->request_params.redirects[0])); |
| 5261 | 5272 |
| 5262 #ifdef OS_ANDROID | 5273 #ifdef OS_ANDROID |
| 5263 bool render_view_was_created_by_renderer = | 5274 bool render_view_was_created_by_renderer = |
| 5264 render_view_->was_created_by_renderer_; | 5275 render_view_->was_created_by_renderer_; |
| 5265 // The handlenavigation API is deprecated and will be removed once | 5276 // The handlenavigation API is deprecated and will be removed once |
| 5266 // crbug.com/325351 is resolved. | 5277 // crbug.com/325351 is resolved. |
| 5267 if (GetContentClient()->renderer()->HandleNavigation( | 5278 if (GetContentClient()->renderer()->HandleNavigation( |
| 5268 this, is_content_initiated, render_view_was_created_by_renderer, | 5279 this, is_content_initiated, render_view_was_created_by_renderer, |
| 5269 frame_, info.urlRequest, info.navigationType, info.defaultPolicy, | 5280 frame_, info.urlRequest, info.navigationType, info.defaultPolicy, |
| 5270 is_redirect)) { | 5281 is_redirect)) { |
| 5271 return blink::WebNavigationPolicyIgnore; | 5282 return blink::WebNavigationPolicyIgnore; |
| 5272 } | 5283 } |
| 5273 #endif | 5284 #endif |
| 5274 | 5285 |
| 5275 Referrer referrer( | 5286 Referrer referrer( |
| 5276 RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest)); | 5287 RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest)); |
| 5277 | 5288 |
| 5278 // Webkit is asking whether to navigate to a new URL. | |
| 5279 // This is fine normally, except if we're showing UI from one security | |
| 5280 // context and they're trying to navigate to a different context. | |
| 5281 const GURL& url = info.urlRequest.url(); | |
| 5282 | |
| 5283 // If the browser is interested, then give it a chance to look at the request. | 5289 // If the browser is interested, then give it a chance to look at the request. |
| 5284 if (is_content_initiated && IsTopLevelNavigation(frame_) && | 5290 if (is_content_initiated && IsTopLevelNavigation(frame_) && |
| 5285 render_view_->renderer_preferences_ | 5291 render_view_->renderer_preferences_ |
| 5286 .browser_handles_all_top_level_requests) { | 5292 .browser_handles_all_top_level_requests) { |
| 5287 OpenURL(url, IsHttpPost(info.urlRequest), | 5293 OpenURL(url, IsHttpPost(info.urlRequest), |
| 5288 GetRequestBodyForWebURLRequest(info.urlRequest), | 5294 GetRequestBodyForWebURLRequest(info.urlRequest), |
| 5289 GetWebURLRequestHeaders(info.urlRequest), referrer, | 5295 GetWebURLRequestHeaders(info.urlRequest), referrer, |
| 5290 info.defaultPolicy, info.replacesCurrentHistoryItem, false); | 5296 info.defaultPolicy, info.replacesCurrentHistoryItem, false); |
| 5291 return blink::WebNavigationPolicyIgnore; // Suppress the load here. | 5297 return blink::WebNavigationPolicyIgnore; // Suppress the load here. |
| 5292 } | 5298 } |
| (...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6856 // event target. Potentially a Pepper plugin will receive the event. | 6862 // event target. Potentially a Pepper plugin will receive the event. |
| 6857 // In order to tell whether a plugin gets the last mouse event and which it | 6863 // In order to tell whether a plugin gets the last mouse event and which it |
| 6858 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6864 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6859 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6865 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6860 // |pepper_last_mouse_event_target_|. | 6866 // |pepper_last_mouse_event_target_|. |
| 6861 pepper_last_mouse_event_target_ = nullptr; | 6867 pepper_last_mouse_event_target_ = nullptr; |
| 6862 #endif | 6868 #endif |
| 6863 } | 6869 } |
| 6864 | 6870 |
| 6865 } // namespace content | 6871 } // namespace content |
| OLD | NEW |