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 3421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3432 void RenderFrameImpl::didStartProvisionalLoad( | 3432 void RenderFrameImpl::didStartProvisionalLoad( |
3433 blink::WebDataSource* data_source) { | 3433 blink::WebDataSource* data_source) { |
3434 // In fast/loader/stop-provisional-loads.html, we abort the load before this | 3434 // In fast/loader/stop-provisional-loads.html, we abort the load before this |
3435 // callback is invoked. | 3435 // callback is invoked. |
3436 if (!data_source) | 3436 if (!data_source) |
3437 return; | 3437 return; |
3438 | 3438 |
3439 TRACE_EVENT2("navigation,benchmark,rail", | 3439 TRACE_EVENT2("navigation,benchmark,rail", |
3440 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, | 3440 "RenderFrameImpl::didStartProvisionalLoad", "id", routing_id_, |
3441 "url", data_source->getRequest().url().string().utf8()); | 3441 "url", data_source->getRequest().url().string().utf8()); |
| 3442 |
| 3443 // PlzNavigate: |
| 3444 // If we have pending navigation to be sent to the browser, do it here. |
| 3445 if (pending_navigation_info_.get()) { |
| 3446 DCHECK(IsBrowserSideNavigationEnabled()); |
| 3447 NavigationPolicyInfo info(data_source->getRequestWritable()); |
| 3448 info.navigationType = pending_navigation_info_->navigation_type; |
| 3449 info.defaultPolicy = pending_navigation_info_->policy; |
| 3450 info.replacesCurrentHistoryItem = |
| 3451 pending_navigation_info_->replaces_current_history_item; |
| 3452 info.isHistoryNavigationInNewChildFrame = |
| 3453 pending_navigation_info_->history_navigation_in_new_child_frame; |
| 3454 info.isClientRedirect = pending_navigation_info_->client_redirect; |
| 3455 info.isCacheDisabled = pending_navigation_info_->cache_disabled; |
| 3456 info.form = pending_navigation_info_->form; |
| 3457 |
| 3458 pending_navigation_info_.reset(nullptr); |
| 3459 |
| 3460 BeginNavigation(info); |
| 3461 } |
| 3462 |
3442 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3463 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
3443 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( | 3464 NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( |
3444 document_state->navigation_state()); | 3465 document_state->navigation_state()); |
3445 bool is_top_most = !frame_->parent(); | 3466 bool is_top_most = !frame_->parent(); |
3446 if (is_top_most) { | 3467 if (is_top_most) { |
3447 render_view_->set_navigation_gesture( | 3468 render_view_->set_navigation_gesture( |
3448 WebUserGestureIndicator::isProcessingUserGesture() ? | 3469 WebUserGestureIndicator::isProcessingUserGesture() ? |
3449 NavigationGestureUser : NavigationGestureAuto); | 3470 NavigationGestureUser : NavigationGestureAuto); |
3450 } else if (data_source->replacesCurrentHistoryItem()) { | 3471 } else if (data_source->replacesCurrentHistoryItem()) { |
3451 // Subframe navigations that don't add session history items must be | 3472 // Subframe navigations that don't add session history items must be |
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5462 base::TimeTicks::Now(); | 5483 base::TimeTicks::Now(); |
5463 } | 5484 } |
5464 } | 5485 } |
5465 | 5486 |
5466 // PlzNavigate: if the navigation is not synchronous, send it to the browser. | 5487 // PlzNavigate: if the navigation is not synchronous, send it to the browser. |
5467 // This includes navigations with no request being sent to the network stack. | 5488 // This includes navigations with no request being sent to the network stack. |
5468 if (IsBrowserSideNavigationEnabled() && | 5489 if (IsBrowserSideNavigationEnabled() && |
5469 info.urlRequest.checkForBrowserSideNavigation() && | 5490 info.urlRequest.checkForBrowserSideNavigation() && |
5470 ShouldMakeNetworkRequestForURL(url)) { | 5491 ShouldMakeNetworkRequestForURL(url)) { |
5471 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) { | 5492 if (info.defaultPolicy == blink::WebNavigationPolicyCurrentTab) { |
5472 BeginNavigation(info); | 5493 // The BeginNavigation() call happens in didStartProvisionalLoad(). We |
| 5494 // need to save information about the navigation here. |
| 5495 pending_navigation_info_.reset(new PendingNavigationInfo(info)); |
5473 return blink::WebNavigationPolicyHandledByClient; | 5496 return blink::WebNavigationPolicyHandledByClient; |
5474 } else { | 5497 } else { |
5475 LoadURLExternally(info.urlRequest, info.defaultPolicy); | 5498 LoadURLExternally(info.urlRequest, info.defaultPolicy); |
5476 return blink::WebNavigationPolicyIgnore; | 5499 return blink::WebNavigationPolicyIgnore; |
5477 } | 5500 } |
5478 } | 5501 } |
5479 | 5502 |
5480 return info.defaultPolicy; | 5503 return info.defaultPolicy; |
5481 } | 5504 } |
5482 | 5505 |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6862 // event target. Potentially a Pepper plugin will receive the event. | 6885 // event target. Potentially a Pepper plugin will receive the event. |
6863 // In order to tell whether a plugin gets the last mouse event and which it | 6886 // In order to tell whether a plugin gets the last mouse event and which it |
6864 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6887 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6865 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6888 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6866 // |pepper_last_mouse_event_target_|. | 6889 // |pepper_last_mouse_event_target_|. |
6867 pepper_last_mouse_event_target_ = nullptr; | 6890 pepper_last_mouse_event_target_ = nullptr; |
6868 #endif | 6891 #endif |
6869 } | 6892 } |
6870 | 6893 |
6871 } // namespace content | 6894 } // namespace content |
OLD | NEW |