| 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 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 render_view_host_impl->FilterURL( | 1512 render_view_host_impl->FilterURL( |
| 1513 ChildProcessSecurityPolicyImpl::GetInstance(), | 1513 ChildProcessSecurityPolicyImpl::GetInstance(), |
| 1514 render_process_host->GetID(), | 1514 render_process_host->GetID(), |
| 1515 true, | 1515 true, |
| 1516 &validated_opener_url); | 1516 &validated_opener_url); |
| 1517 | 1517 |
| 1518 // Notify observers about the start of the provisional load. | 1518 // Notify observers about the start of the provisional load. |
| 1519 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1519 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1520 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 1520 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
| 1521 validated_url, is_error_page, render_view_host)); | 1521 validated_url, is_error_page, render_view_host)); |
| 1522 | |
| 1523 if (is_main_frame) { | |
| 1524 // Notify observers about the provisional change in the main frame URL. | |
| 1525 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1526 ProvisionalChangeToMainFrameUrl(validated_url, | |
| 1527 validated_opener_url)); | |
| 1528 } | |
| 1529 } | |
| 1530 | |
| 1531 void WebContentsImpl::DidRedirectProvisionalLoad( | |
| 1532 content::RenderViewHost* render_view_host, | |
| 1533 int32 page_id, | |
| 1534 const GURL& opener_url, | |
| 1535 const GURL& source_url, | |
| 1536 const GURL& target_url) { | |
| 1537 // TODO(creis): Remove this method and have the pre-rendering code listen to | |
| 1538 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | |
| 1539 // instead. See http://crbug.com/78512. | |
| 1540 GURL validated_source_url(source_url); | |
| 1541 GURL validated_target_url(target_url); | |
| 1542 GURL validated_opener_url(opener_url); | |
| 1543 RenderViewHostImpl* render_view_host_impl = | |
| 1544 static_cast<RenderViewHostImpl*>(render_view_host); | |
| 1545 content::RenderProcessHost* render_process_host = | |
| 1546 render_view_host->GetProcess(); | |
| 1547 render_view_host_impl->FilterURL( | |
| 1548 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1549 render_process_host->GetID(), | |
| 1550 false, | |
| 1551 &validated_source_url); | |
| 1552 render_view_host_impl->FilterURL( | |
| 1553 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1554 render_process_host->GetID(), | |
| 1555 false, | |
| 1556 &validated_target_url); | |
| 1557 render_view_host_impl->FilterURL( | |
| 1558 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1559 render_process_host->GetID(), | |
| 1560 true, | |
| 1561 &validated_opener_url); | |
| 1562 NavigationEntry* entry; | |
| 1563 if (page_id == -1) { | |
| 1564 entry = controller_.GetPendingEntry(); | |
| 1565 } else { | |
| 1566 entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(), | |
| 1567 page_id); | |
| 1568 } | |
| 1569 if (!entry || entry->GetURL() != validated_source_url) | |
| 1570 return; | |
| 1571 | |
| 1572 // Notify observers about the provisional change in the main frame URL. | |
| 1573 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1574 ProvisionalChangeToMainFrameUrl(validated_target_url, | |
| 1575 validated_opener_url)); | |
| 1576 } | 1522 } |
| 1577 | 1523 |
| 1578 void WebContentsImpl::DidFailProvisionalLoadWithError( | 1524 void WebContentsImpl::DidFailProvisionalLoadWithError( |
| 1579 content::RenderViewHost* render_view_host, | 1525 content::RenderViewHost* render_view_host, |
| 1580 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1526 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 1581 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1527 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 1582 << ", error_code: " << params.error_code | 1528 << ", error_code: " << params.error_code |
| 1583 << ", error_description: " << params.error_description | 1529 << ", error_description: " << params.error_description |
| 1584 << ", is_main_frame: " << params.is_main_frame | 1530 << ", is_main_frame: " << params.is_main_frame |
| 1585 << ", showing_repost_interstitial: " << | 1531 << ", showing_repost_interstitial: " << |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2738 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2684 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2739 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2685 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2740 // Can be NULL during tests. | 2686 // Can be NULL during tests. |
| 2741 if (rwh_view) | 2687 if (rwh_view) |
| 2742 rwh_view->SetSize(GetView()->GetContainerSize()); | 2688 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2743 } | 2689 } |
| 2744 | 2690 |
| 2745 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2691 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2746 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2692 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2747 } | 2693 } |
| OLD | NEW |