| 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 3485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3496 // local state here to fix https://crbug.com/671276. | 3496 // local state here to fix https://crbug.com/671276. |
| 3497 } | 3497 } |
| 3498 | 3498 |
| 3499 void RenderFrameImpl::didFailProvisionalLoad( | 3499 void RenderFrameImpl::didFailProvisionalLoad( |
| 3500 blink::WebLocalFrame* frame, | 3500 blink::WebLocalFrame* frame, |
| 3501 const blink::WebURLError& error, | 3501 const blink::WebURLError& error, |
| 3502 blink::WebHistoryCommitType commit_type) { | 3502 blink::WebHistoryCommitType commit_type) { |
| 3503 TRACE_EVENT1("navigation,benchmark,rail", | 3503 TRACE_EVENT1("navigation,benchmark,rail", |
| 3504 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); | 3504 "RenderFrameImpl::didFailProvisionalLoad", "id", routing_id_); |
| 3505 DCHECK_EQ(frame_, frame); | 3505 DCHECK_EQ(frame_, frame); |
| 3506 WebDataSource* ds = frame->provisionalDataSource(); | |
| 3507 DCHECK(ds); | |
| 3508 | |
| 3509 const WebURLRequest& failed_request = ds->getRequest(); | |
| 3510 | |
| 3511 // Notify the browser that we failed a provisional load with an error. | |
| 3512 // | |
| 3513 // Note: It is important this notification occur before DidStopLoading so the | 3506 // Note: It is important this notification occur before DidStopLoading so the |
| 3514 // SSL manager can react to the provisional load failure before being | 3507 // SSL manager can react to the provisional load failure before being |
| 3515 // notified the load stopped. | 3508 // notified the load stopped. |
| 3516 // | 3509 // |
| 3517 for (auto& observer : render_view_->observers()) | 3510 for (auto& observer : render_view_->observers()) |
| 3518 observer.DidFailProvisionalLoad(frame, error); | 3511 observer.DidFailProvisionalLoad(frame, error); |
| 3519 for (auto& observer : observers_) | 3512 for (auto& observer : observers_) |
| 3520 observer.DidFailProvisionalLoad(error); | 3513 observer.DidFailProvisionalLoad(error); |
| 3521 | 3514 |
| 3515 WebDataSource* ds = frame->provisionalDataSource(); |
| 3516 if (!ds) |
| 3517 return; |
| 3518 |
| 3519 const WebURLRequest& failed_request = ds->getRequest(); |
| 3520 |
| 3521 // Notify the browser that we failed a provisional load with an error. |
| 3522 SendFailedProvisionalLoad(failed_request, error, frame); | 3522 SendFailedProvisionalLoad(failed_request, error, frame); |
| 3523 | 3523 |
| 3524 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) | 3524 if (!ShouldDisplayErrorPageForFailedLoad(error.reason, error.unreachableURL)) |
| 3525 return; | 3525 return; |
| 3526 | 3526 |
| 3527 // Make sure we never show errors in view source mode. | 3527 // Make sure we never show errors in view source mode. |
| 3528 frame->enableViewSourceMode(false); | 3528 frame->enableViewSourceMode(false); |
| 3529 | 3529 |
| 3530 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3530 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3531 NavigationStateImpl* navigation_state = | 3531 NavigationStateImpl* navigation_state = |
| (...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5217 // This corresponds to Blink's notion of a standard commit. | 5217 // This corresponds to Blink's notion of a standard commit. |
| 5218 // Also replace the current history entry if the browser asked for it | 5218 // Also replace the current history entry if the browser asked for it |
| 5219 // specifically. | 5219 // specifically. |
| 5220 // TODO(clamy): see if initial commits in subframes should be handled | 5220 // TODO(clamy): see if initial commits in subframes should be handled |
| 5221 // separately. | 5221 // separately. |
| 5222 bool replace = is_reload || common_params.url == GetLoadingUrl() || | 5222 bool replace = is_reload || common_params.url == GetLoadingUrl() || |
| 5223 common_params.should_replace_current_entry; | 5223 common_params.should_replace_current_entry; |
| 5224 std::unique_ptr<HistoryEntry> history_entry; | 5224 std::unique_ptr<HistoryEntry> history_entry; |
| 5225 if (request_params.page_state.IsValid()) | 5225 if (request_params.page_state.IsValid()) |
| 5226 history_entry = PageStateToHistoryEntry(request_params.page_state); | 5226 history_entry = PageStateToHistoryEntry(request_params.page_state); |
| 5227 |
| 5228 // For renderer initiated navigations, we send out a didFailProvisionalLoad() |
| 5229 // notification. |
| 5230 if (request_params.nav_entry_id == 0) |
| 5231 didFailProvisionalLoad(frame_, error, blink::WebStandardCommit); |
| 5227 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); | 5232 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); |
| 5228 browser_side_navigation_pending_ = false; | 5233 browser_side_navigation_pending_ = false; |
| 5229 } | 5234 } |
| 5230 | 5235 |
| 5231 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( | 5236 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( |
| 5232 const NavigationPolicyInfo& info) { | 5237 const NavigationPolicyInfo& info) { |
| 5233 // A content initiated navigation may have originated from a link-click, | 5238 // A content initiated navigation may have originated from a link-click, |
| 5234 // script, drag-n-drop operation, etc. | 5239 // script, drag-n-drop operation, etc. |
| 5235 // info.extraData is only non-null if this is a redirect. Use the extraData | 5240 // info.extraData is only non-null if this is a redirect. Use the extraData |
| 5236 // initiation information for redirects, and check pending_navigation_params_ | 5241 // initiation information for redirects, and check pending_navigation_params_ |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6838 // event target. Potentially a Pepper plugin will receive the event. | 6843 // event target. Potentially a Pepper plugin will receive the event. |
| 6839 // In order to tell whether a plugin gets the last mouse event and which it | 6844 // In order to tell whether a plugin gets the last mouse event and which it |
| 6840 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6845 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6841 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6846 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6842 // |pepper_last_mouse_event_target_|. | 6847 // |pepper_last_mouse_event_target_|. |
| 6843 pepper_last_mouse_event_target_ = nullptr; | 6848 pepper_last_mouse_event_target_ = nullptr; |
| 6844 #endif | 6849 #endif |
| 6845 } | 6850 } |
| 6846 | 6851 |
| 6847 } // namespace content | 6852 } // namespace content |
| OLD | NEW |