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); | |
Charlie Reis
2014/04/02 17:52:59
Should this be on WebFrame rather than WebView?
| |
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); | |
Charlie Reis
2014/04/02 17:52:59
Just curious, why is this on the WebView rather th
| |
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 |
1641 void RenderFrameImpl::didCommitProvisionalLoad(blink::WebFrame* frame, | 1647 void RenderFrameImpl::didCommitProvisionalLoad(blink::WebFrame* frame, |
Charlie Reis
2014/04/02 17:52:59
nit: frame should be on its own line, aligned with
Nate Chapin
2014/04/02 17:58:35
Done.
| |
1648 const blink::WebHistoryItem& item, | |
1649 blink::WebHistoryCommitType commit_type) { | |
1650 DocumentState* document_state = | |
1651 DocumentState::FromDataSource(frame->dataSource()); | |
1652 render_view_->webview()->updateForCommit(frame, item, commit_type, | |
Charlie Reis
2014/04/02 17:52:59
updateForCommit should also be on WebFrame rather
| |
1653 document_state->navigation_state()->was_within_same_page()); | |
1654 | |
1655 didCommitProvisionalLoad(frame, commit_type == blink::WebStandardCommit); | |
1656 } | |
1657 | |
1658 void RenderFrameImpl::didCommitProvisionalLoad(blink::WebFrame* frame, | |
1642 bool is_new_navigation) { | 1659 bool is_new_navigation) { |
1643 DCHECK(!frame_ || frame_ == frame); | 1660 DCHECK(!frame_ || frame_ == frame); |
1644 DocumentState* document_state = | 1661 DocumentState* document_state = |
1645 DocumentState::FromDataSource(frame->dataSource()); | 1662 DocumentState::FromDataSource(frame->dataSource()); |
1646 NavigationState* navigation_state = document_state->navigation_state(); | 1663 NavigationState* navigation_state = document_state->navigation_state(); |
1647 InternalDocumentStateData* internal_data = | 1664 InternalDocumentStateData* internal_data = |
1648 InternalDocumentStateData::FromDocumentState(document_state); | 1665 InternalDocumentStateData::FromDocumentState(document_state); |
1649 | 1666 |
1650 if (document_state->commit_load_time().is_null()) | 1667 if (document_state->commit_load_time().is_null()) |
1651 document_state->set_commit_load_time(Time::Now()); | 1668 document_state->set_commit_load_time(Time::Now()); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1852 | 1869 |
1853 // Don't send this message while the frame is swapped out. | 1870 // Don't send this message while the frame is swapped out. |
1854 if (is_swapped_out()) | 1871 if (is_swapped_out()) |
1855 return; | 1872 return; |
1856 | 1873 |
1857 Send(new FrameHostMsg_DidFinishLoad(routing_id_, | 1874 Send(new FrameHostMsg_DidFinishLoad(routing_id_, |
1858 ds->request().url())); | 1875 ds->request().url())); |
1859 } | 1876 } |
1860 | 1877 |
1861 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, | 1878 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, |
1879 const blink::WebHistoryItem& item, | |
1880 blink::WebHistoryCommitType commit_type) { | |
1881 DCHECK(!frame_ || frame_ == frame); | |
1882 // If this was a reference fragment navigation that we initiated, then we | |
1883 // could end up having a non-null pending navigation params. We just need to | |
1884 // update the ExtraData on the datasource so that others who read the | |
1885 // ExtraData will get the new NavigationState. Similarly, if we did not | |
1886 // initiate this navigation, then we need to take care to reset any pre- | |
1887 // existing navigation state to a content-initiated navigation state. | |
1888 // DidCreateDataSource conveniently takes care of this for us. | |
1889 didCreateDataSource(frame, frame->dataSource()); | |
1890 | |
1891 DocumentState* document_state = | |
1892 DocumentState::FromDataSource(frame->dataSource()); | |
1893 NavigationState* new_state = document_state->navigation_state(); | |
1894 new_state->set_was_within_same_page(true); | |
1895 | |
1896 didCommitProvisionalLoad(frame, item, commit_type); | |
1897 } | |
1898 | |
1899 void RenderFrameImpl::didNavigateWithinPage(blink::WebFrame* frame, | |
1862 bool is_new_navigation) { | 1900 bool is_new_navigation) { |
1863 DCHECK(!frame_ || frame_ == frame); | 1901 DCHECK(!frame_ || frame_ == frame); |
1864 // If this was a reference fragment navigation that we initiated, then we | 1902 // 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 | 1903 // 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 | 1904 // update the ExtraData on the datasource so that others who read the |
1867 // ExtraData will get the new NavigationState. Similarly, if we did not | 1905 // 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- | 1906 // initiate this navigation, then we need to take care to reset any pre- |
1869 // existing navigation state to a content-initiated navigation state. | 1907 // existing navigation state to a content-initiated navigation state. |
1870 // DidCreateDataSource conveniently takes care of this for us. | 1908 // DidCreateDataSource conveniently takes care of this for us. |
1909 | |
Charlie Reis
2014/04/02 17:52:59
nit: No extra line here.
Nate Chapin
2014/04/02 17:58:35
Done.
| |
1871 didCreateDataSource(frame, frame->dataSource()); | 1910 didCreateDataSource(frame, frame->dataSource()); |
1872 | 1911 |
1873 DocumentState* document_state = | 1912 DocumentState* document_state = |
1874 DocumentState::FromDataSource(frame->dataSource()); | 1913 DocumentState::FromDataSource(frame->dataSource()); |
1875 NavigationState* new_state = document_state->navigation_state(); | 1914 NavigationState* new_state = document_state->navigation_state(); |
1876 new_state->set_was_within_same_page(true); | 1915 new_state->set_was_within_same_page(true); |
1877 | 1916 |
1878 didCommitProvisionalLoad(frame, is_new_navigation); | 1917 didCommitProvisionalLoad(frame, is_new_navigation); |
1879 } | 1918 } |
1880 | 1919 |
(...skipping 1084 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 |