Chromium Code Reviews| 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 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3416 DocumentState::FromDataSource(datasource))) | 3416 DocumentState::FromDataSource(datasource))) |
| 3417 return; | 3417 return; |
| 3418 | 3418 |
| 3419 ServiceWorkerNetworkProvider::AttachToDocumentState( | 3419 ServiceWorkerNetworkProvider::AttachToDocumentState( |
| 3420 DocumentState::FromDataSource(datasource), | 3420 DocumentState::FromDataSource(datasource), |
| 3421 ServiceWorkerNetworkProvider::CreateForNavigation( | 3421 ServiceWorkerNetworkProvider::CreateForNavigation( |
| 3422 routing_id_, navigation_state->request_params(), frame, | 3422 routing_id_, navigation_state->request_params(), frame, |
| 3423 content_initiated)); | 3423 content_initiated)); |
| 3424 } | 3424 } |
| 3425 | 3425 |
| 3426 void RenderFrameImpl::didStartProvisionalLoad( | 3426 void RenderFrameImpl::didStartProvisionalLoad(blink::WebDataSource* data_source, |
| 3427 blink::WebDataSource* data_source) { | 3427 blink::WebURLRequest& request) { |
| 3428 // In fast/loader/stop-provisional-loads.html, we abort the load before this | 3428 // In fast/loader/stop-provisional-loads.html, we abort the load before this |
| 3429 // callback is invoked. | 3429 // callback is invoked. |
| 3430 if (!data_source) | 3430 if (!data_source) |
| 3431 return; | 3431 return; |
| 3432 | 3432 |
| 3433 TRACE_EVENT2("navigation,benchmark,rail", | 3433 TRACE_EVENT2("navigation,benchmark,rail", |
| 3434 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, | 3434 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, |
| 3435 "url", data_source->getRequest().url().string().utf8()); | 3435 "url", data_source->getRequest().url().string().utf8()); |
| 3436 | |
| 3437 // PlzNavigate: | |
| 3438 // If we have pending navigation to be sent to the browser, do it here. | |
| 3439 if (pending_navigation_info_.get()) { | |
|
clamy
2017/03/09 14:12:09
Could we reset the pending_navigation_info_ at the
ananta
2017/03/09 21:54:36
Done.
| |
| 3440 DCHECK(IsBrowserSideNavigationEnabled()); | |
| 3441 NavigationPolicyInfo info(request); | |
| 3442 info.navigationType = pending_navigation_info_->navigation_type; | |
| 3443 info.defaultPolicy = pending_navigation_info_->policy; | |
| 3444 info.replacesCurrentHistoryItem = | |
| 3445 pending_navigation_info_->replaces_current_history_item; | |
| 3446 info.isHistoryNavigationInNewChildFrame = | |
| 3447 pending_navigation_info_->history_navigation_in_new_child_frame; | |
| 3448 info.isClientRedirect = pending_navigation_info_->client_redirect; | |
| 3449 info.isCacheDisabled = pending_navigation_info_->cache_disabled; | |
| 3450 info.form = pending_navigation_info_->form; | |
| 3451 | |
| 3452 pending_navigation_info_.reset(nullptr); | |
| 3453 | |
| 3454 BeginNavigation(info); | |
| 3455 } | |
| 3456 | |
| 3436 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3457 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 3437 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( | 3458 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( |
| 3438 document_state->navigation_state()); | 3459 document_state->navigation_state()); |
| 3439 bool is_top_most = !frame_->parent(); | 3460 bool is_top_most = !frame_->parent(); |
| 3440 if (is_top_most) { | 3461 if (is_top_most) { |
| 3441 render_view_->set_navigation_gesture( | 3462 render_view_->set_navigation_gesture( |
| 3442 WebUserGestureIndicator::isProcessingUserGesture() ? | 3463 WebUserGestureIndicator::isProcessingUserGesture() ? |
| 3443 NavigationGestureUser : NavigationGestureAuto); | 3464 NavigationGestureUser : NavigationGestureAuto); |
| 3444 } else if (data_source->replacesCurrentHistoryItem()) { | 3465 } else if (data_source->replacesCurrentHistoryItem()) { |
| 3445 // Subframe navigations that don't add session history items must be | 3466 // Subframe navigations that don't add session history items must be |
| (...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5470 base::TimeTicks::Now(); | 5491 base::TimeTicks::Now(); |
| 5471 } | 5492 } |
| 5472 } | 5493 } |
| 5473 | 5494 |
| 5474 // PlzNavigate: if the navigation is not synchronous, send it to the browser. | 5495 // PlzNavigate: if the navigation is not synchronous, send it to the browser. |
| 5475 // This includes navigations with no request being sent to the network stack. | 5496 // This includes navigations with no request being sent to the network stack. |
| 5476 if (IsBrowserSideNavigationEnabled() && | 5497 if (IsBrowserSideNavigationEnabled() && |
| 5477 info.urlRequest.checkForBrowserSideNavigation() && | 5498 info.urlRequest.checkForBrowserSideNavigation() && |
| 5478 ShouldMakeNetworkRequestForURL(url)) { | 5499 ShouldMakeNetworkRequestForURL(url)) { |
| 5479 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) { | 5500 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) { |
| 5480 BeginNavigation(info); | 5501 // The BeginNavigation() call happens in didStartProvisionalLoad(). We |
| 5502 // need to save information about the navigation here. | |
| 5503 pending_navigation_info_.reset(new PendingNavigationInfo(info)); | |
| 5481 return blink::WebNavigationPolicyHandledByClient; | 5504 return blink::WebNavigationPolicyHandledByClient; |
| 5482 } else { | 5505 } else { |
| 5483 LoadURLExternally(info.urlRequest, info.defaultPolicy); | 5506 LoadURLExternally(info.urlRequest, info.defaultPolicy); |
| 5484 return blink::WebNavigationPolicyIgnore; | 5507 return blink::WebNavigationPolicyIgnore; |
| 5485 } | 5508 } |
| 5486 } | 5509 } |
| 5487 | 5510 |
| 5488 return info.defaultPolicy; | 5511 return info.defaultPolicy; |
| 5489 } | 5512 } |
| 5490 | 5513 |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6870 // event target. Potentially a Pepper plugin will receive the event. | 6893 // event target. Potentially a Pepper plugin will receive the event. |
| 6871 // In order to tell whether a plugin gets the last mouse event and which it | 6894 // In order to tell whether a plugin gets the last mouse event and which it |
| 6872 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6895 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6873 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6896 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6874 // |pepper_last_mouse_event_target_|. | 6897 // |pepper_last_mouse_event_target_|. |
| 6875 pepper_last_mouse_event_target_ = nullptr; | 6898 pepper_last_mouse_event_target_ = nullptr; |
| 6876 #endif | 6899 #endif |
| 6877 } | 6900 } |
| 6878 | 6901 |
| 6879 } // namespace content | 6902 } // namespace content |
| OLD | NEW |