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 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 blink::WebDataSource::ExtraData* extra_data, | 1400 blink::WebDataSource::ExtraData* extra_data, |
1401 const blink::WebURLRequest& request, | 1401 const blink::WebURLRequest& request, |
1402 blink::WebNavigationType type, | 1402 blink::WebNavigationType type, |
1403 blink::WebNavigationPolicy default_policy, | 1403 blink::WebNavigationPolicy default_policy, |
1404 bool is_redirect) { | 1404 bool is_redirect) { |
1405 DCHECK(!frame_ || frame_ == frame); | 1405 DCHECK(!frame_ || frame_ == frame); |
1406 return DecidePolicyForNavigation( | 1406 return DecidePolicyForNavigation( |
1407 this, frame, extra_data, request, type, default_policy, is_redirect); | 1407 this, frame, extra_data, request, type, default_policy, is_redirect); |
1408 } | 1408 } |
1409 | 1409 |
| 1410 blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame( |
| 1411 blink::WebFrame* frame) { |
| 1412 return render_view_->webview()->itemForNewChildFrame(frame); |
| 1413 } |
| 1414 |
1410 void RenderFrameImpl::willSendSubmitEvent(blink::WebFrame* frame, | 1415 void RenderFrameImpl::willSendSubmitEvent(blink::WebFrame* frame, |
1411 const blink::WebFormElement& form) { | 1416 const blink::WebFormElement& form) { |
1412 DCHECK(!frame_ || frame_ == frame); | 1417 DCHECK(!frame_ || frame_ == frame); |
1413 // Call back to RenderViewImpl for observers to be notified. | 1418 // Call back to RenderViewImpl for observers to be notified. |
1414 // TODO(nasko): Remove once we have RenderFrameObserver. | 1419 // TODO(nasko): Remove once we have RenderFrameObserver. |
1415 render_view_->willSendSubmitEvent(frame, form); | 1420 render_view_->willSendSubmitEvent(frame, form); |
1416 } | 1421 } |
1417 | 1422 |
1418 void RenderFrameImpl::willSubmitForm(blink::WebFrame* frame, | 1423 void RenderFrameImpl::willSubmitForm(blink::WebFrame* frame, |
1419 const blink::WebFormElement& form) { | 1424 const blink::WebFormElement& form) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 | 1515 |
1511 int parent_routing_id = frame->parent() ? | 1516 int parent_routing_id = frame->parent() ? |
1512 FromWebFrame(frame->parent())->GetRoutingID() : -1; | 1517 FromWebFrame(frame->parent())->GetRoutingID() : -1; |
1513 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( | 1518 Send(new FrameHostMsg_DidStartProvisionalLoadForFrame( |
1514 routing_id_, parent_routing_id, ds->request().url())); | 1519 routing_id_, parent_routing_id, ds->request().url())); |
1515 } | 1520 } |
1516 | 1521 |
1517 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 1522 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( |
1518 blink::WebFrame* frame) { | 1523 blink::WebFrame* frame) { |
1519 DCHECK(!frame_ || frame_ == frame); | 1524 DCHECK(!frame_ || frame_ == frame); |
| 1525 render_view_->webview()->removeChildrenForRedirect(frame); |
1520 if (frame->parent()) | 1526 if (frame->parent()) |
1521 return; | 1527 return; |
1522 // Received a redirect on the main frame. | 1528 // Received a redirect on the main frame. |
1523 WebDataSource* data_source = frame->provisionalDataSource(); | 1529 WebDataSource* data_source = frame->provisionalDataSource(); |
1524 if (!data_source) { | 1530 if (!data_source) { |
1525 // Should only be invoked when we have a data source. | 1531 // Should only be invoked when we have a data source. |
1526 NOTREACHED(); | 1532 NOTREACHED(); |
1527 return; | 1533 return; |
1528 } | 1534 } |
1529 std::vector<GURL> redirects; | 1535 std::vector<GURL> redirects; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 document_state->request_time(); | 1637 document_state->request_time(); |
1632 render_view_->pending_navigation_params_->should_replace_current_entry = | 1638 render_view_->pending_navigation_params_->should_replace_current_entry = |
1633 replace; | 1639 replace; |
1634 } | 1640 } |
1635 | 1641 |
1636 // Load an error page. | 1642 // Load an error page. |
1637 render_view_->LoadNavigationErrorPage( | 1643 render_view_->LoadNavigationErrorPage( |
1638 frame, failed_request, error, replace); | 1644 frame, failed_request, error, replace); |
1639 } | 1645 } |
1640 | 1646 |
| 1647 void RenderFrameImpl::didCommitProvisionalLoad( |
| 1648 blink::WebFrame* frame, |
| 1649 const blink::WebHistoryItem& item, |
| 1650 blink::WebHistoryCommitType commit_type) { |
| 1651 DocumentState* document_state = |
| 1652 DocumentState::FromDataSource(frame->dataSource()); |
| 1653 render_view_->webview()->updateForCommit(frame, item, commit_type, |
| 1654 document_state->navigation_state()->was_within_same_page()); |
| 1655 |
| 1656 didCommitProvisionalLoad(frame, commit_type == blink::WebStandardCommit); |
| 1657 } |
| 1658 |
1641 void RenderFrameImpl::didCommitProvisionalLoad(blink::WebFrame* frame, | 1659 void RenderFrameImpl::didCommitProvisionalLoad(blink::WebFrame* frame, |
1642 bool is_new_navigation) { | 1660 bool is_new_navigation) { |
1643 DCHECK(!frame_ || frame_ == frame); | 1661 DCHECK(!frame_ || frame_ == frame); |
1644 DocumentState* document_state = | 1662 DocumentState* document_state = |
1645 DocumentState::FromDataSource(frame->dataSource()); | 1663 DocumentState::FromDataSource(frame->dataSource()); |
1646 NavigationState* navigation_state = document_state->navigation_state(); | 1664 NavigationState* navigation_state = document_state->navigation_state(); |
1647 InternalDocumentStateData* internal_data = | 1665 InternalDocumentStateData* internal_data = |
1648 InternalDocumentStateData::FromDocumentState(document_state); | 1666 InternalDocumentStateData::FromDocumentState(document_state); |
1649 | 1667 |
1650 if (document_state->commit_load_time().is_null()) | 1668 if (document_state->commit_load_time().is_null()) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 | 1870 |
1853 // Don't send this message while the frame is swapped out. | 1871 // Don't send this message while the frame is swapped out. |
1854 if (is_swapped_out()) | 1872 if (is_swapped_out()) |
1855 return; | 1873 return; |
1856 | 1874 |
1857 Send(new FrameHostMsg_DidFinishLoad(routing_id_, | 1875 Send(new FrameHostMsg_DidFinishLoad(routing_id_, |
1858 ds->request().url())); | 1876 ds->request().url())); |
1859 } | 1877 } |
1860 | 1878 |
1861 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, | 1879 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, |
| 1880 const blink::WebHistoryItem& item, |
| 1881 blink::WebHistoryCommitType commit_type) { |
| 1882 DCHECK(!frame_ || frame_ == frame); |
| 1883 // If this was a reference fragment navigation that we initiated, then we |
| 1884 // could end up having a non-null pending navigation params. We just need to |
| 1885 // update the ExtraData on the datasource so that others who read the |
| 1886 // ExtraData will get the new NavigationState. Similarly, if we did not |
| 1887 // initiate this navigation, then we need to take care to reset any pre- |
| 1888 // existing navigation state to a content-initiated navigation state. |
| 1889 // DidCreateDataSource conveniently takes care of this for us. |
| 1890 didCreateDataSource(frame, frame->dataSource()); |
| 1891 |
| 1892 DocumentState* document_state = |
| 1893 DocumentState::FromDataSource(frame->dataSource()); |
| 1894 NavigationState* new_state = document_state->navigation_state(); |
| 1895 new_state->set_was_within_same_page(true); |
| 1896 |
| 1897 didCommitProvisionalLoad(frame, item, commit_type); |
| 1898 } |
| 1899 |
| 1900 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, |
1862 bool is_new_navigation) { | 1901 bool is_new_navigation) { |
1863 DCHECK(!frame_ || frame_ == frame); | 1902 DCHECK(!frame_ || frame_ == frame); |
1864 // If this was a reference fragment navigation that we initiated, then we | 1903 // If this was a reference fragment navigation that we initiated, then we |
1865 // could end up having a non-null pending navigation params. We just need to | 1904 // could end up having a non-null pending navigation params. We just need to |
1866 // update the ExtraData on the datasource so that others who read the | 1905 // update the ExtraData on the datasource so that others who read the |
1867 // ExtraData will get the new NavigationState. Similarly, if we did not | 1906 // ExtraData will get the new NavigationState. Similarly, if we did not |
1868 // initiate this navigation, then we need to take care to reset any pre- | 1907 // initiate this navigation, then we need to take care to reset any pre- |
1869 // existing navigation state to a content-initiated navigation state. | 1908 // existing navigation state to a content-initiated navigation state. |
1870 // DidCreateDataSource conveniently takes care of this for us. | 1909 // DidCreateDataSource conveniently takes care of this for us. |
1871 didCreateDataSource(frame, frame->dataSource()); | 1910 didCreateDataSource(frame, frame->dataSource()); |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2965 selection_text_offset_ = offset; | 3004 selection_text_offset_ = offset; |
2966 selection_range_ = range; | 3005 selection_range_ = range; |
2967 // This IPC is dispatched by RenderWidetHost, so use its routing ID. | 3006 // This IPC is dispatched by RenderWidetHost, so use its routing ID. |
2968 Send(new ViewHostMsg_SelectionChanged( | 3007 Send(new ViewHostMsg_SelectionChanged( |
2969 GetRenderWidget()->routing_id(), text, offset, range)); | 3008 GetRenderWidget()->routing_id(), text, offset, range)); |
2970 } | 3009 } |
2971 GetRenderWidget()->UpdateSelectionBounds(); | 3010 GetRenderWidget()->UpdateSelectionBounds(); |
2972 } | 3011 } |
2973 | 3012 |
2974 } // namespace content | 3013 } // namespace content |
OLD | NEW |