| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 render_view_host_impl->FilterURL( | 1509 render_view_host_impl->FilterURL( |
| 1510 ChildProcessSecurityPolicyImpl::GetInstance(), | 1510 ChildProcessSecurityPolicyImpl::GetInstance(), |
| 1511 render_process_host->GetID(), | 1511 render_process_host->GetID(), |
| 1512 true, | 1512 true, |
| 1513 &validated_opener_url); | 1513 &validated_opener_url); |
| 1514 | 1514 |
| 1515 // Notify observers about the start of the provisional load. | 1515 // Notify observers about the start of the provisional load. |
| 1516 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1516 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1517 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 1517 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
| 1518 validated_url, is_error_page, render_view_host)); | 1518 validated_url, is_error_page, render_view_host)); |
| 1519 | |
| 1520 if (is_main_frame) { | |
| 1521 // Notify observers about the provisional change in the main frame URL. | |
| 1522 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1523 ProvisionalChangeToMainFrameUrl(validated_url, | |
| 1524 validated_opener_url, | |
| 1525 render_view_host)); | |
| 1526 } | |
| 1527 } | |
| 1528 | |
| 1529 void WebContentsImpl::DidRedirectProvisionalLoad( | |
| 1530 content::RenderViewHost* render_view_host, | |
| 1531 int32 page_id, | |
| 1532 const GURL& opener_url, | |
| 1533 const GURL& source_url, | |
| 1534 const GURL& target_url) { | |
| 1535 // TODO(creis): Remove this method and have the pre-rendering code listen to | |
| 1536 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | |
| 1537 // instead. See http://crbug.com/78512. | |
| 1538 GURL validated_source_url(source_url); | |
| 1539 GURL validated_target_url(target_url); | |
| 1540 GURL validated_opener_url(opener_url); | |
| 1541 RenderViewHostImpl* render_view_host_impl = | |
| 1542 static_cast<RenderViewHostImpl*>(render_view_host); | |
| 1543 content::RenderProcessHost* render_process_host = | |
| 1544 render_view_host->GetProcess(); | |
| 1545 render_view_host_impl->FilterURL( | |
| 1546 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1547 render_process_host->GetID(), | |
| 1548 false, | |
| 1549 &validated_source_url); | |
| 1550 render_view_host_impl->FilterURL( | |
| 1551 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1552 render_process_host->GetID(), | |
| 1553 false, | |
| 1554 &validated_target_url); | |
| 1555 render_view_host_impl->FilterURL( | |
| 1556 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1557 render_process_host->GetID(), | |
| 1558 true, | |
| 1559 &validated_opener_url); | |
| 1560 NavigationEntry* entry; | |
| 1561 if (page_id == -1) { | |
| 1562 entry = controller_.GetPendingEntry(); | |
| 1563 } else { | |
| 1564 entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(), | |
| 1565 page_id); | |
| 1566 } | |
| 1567 if (!entry || entry->GetURL() != validated_source_url) | |
| 1568 return; | |
| 1569 | |
| 1570 // Notify observers about the provisional change in the main frame URL. | |
| 1571 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1572 ProvisionalChangeToMainFrameUrl(validated_target_url, | |
| 1573 validated_opener_url, | |
| 1574 render_view_host)); | |
| 1575 } | 1519 } |
| 1576 | 1520 |
| 1577 void WebContentsImpl::DidFailProvisionalLoadWithError( | 1521 void WebContentsImpl::DidFailProvisionalLoadWithError( |
| 1578 content::RenderViewHost* render_view_host, | 1522 content::RenderViewHost* render_view_host, |
| 1579 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1523 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 1580 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1524 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 1581 << ", error_code: " << params.error_code | 1525 << ", error_code: " << params.error_code |
| 1582 << ", error_description: " << params.error_description | 1526 << ", error_description: " << params.error_description |
| 1583 << ", is_main_frame: " << params.is_main_frame | 1527 << ", is_main_frame: " << params.is_main_frame |
| 1584 << ", showing_repost_interstitial: " << | 1528 << ", showing_repost_interstitial: " << |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2782 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2726 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2783 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2727 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2784 // Can be NULL during tests. | 2728 // Can be NULL during tests. |
| 2785 if (rwh_view) | 2729 if (rwh_view) |
| 2786 rwh_view->SetSize(GetView()->GetContainerSize()); | 2730 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2787 } | 2731 } |
| 2788 | 2732 |
| 2789 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2733 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2790 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2734 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2791 } | 2735 } |
| OLD | NEW |