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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 1519 |
1520 if (is_main_frame) { | 1520 if (is_main_frame) { |
1521 // Notify observers about the provisional change in the main frame URL. | 1521 // Notify observers about the provisional change in the main frame URL. |
1522 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1522 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1523 ProvisionalChangeToMainFrameUrl(validated_url, | 1523 ProvisionalChangeToMainFrameUrl(validated_url, |
1524 validated_opener_url)); | 1524 validated_opener_url, |
| 1525 render_view_host)); |
1525 } | 1526 } |
1526 } | 1527 } |
1527 | 1528 |
1528 void WebContentsImpl::DidRedirectProvisionalLoad( | 1529 void WebContentsImpl::DidRedirectProvisionalLoad( |
1529 content::RenderViewHost* render_view_host, | 1530 content::RenderViewHost* render_view_host, |
1530 int32 page_id, | 1531 int32 page_id, |
1531 const GURL& opener_url, | 1532 const GURL& opener_url, |
1532 const GURL& source_url, | 1533 const GURL& source_url, |
1533 const GURL& target_url) { | 1534 const GURL& target_url) { |
1534 // TODO(creis): Remove this method and have the pre-rendering code listen to | 1535 // TODO(creis): Remove this method and have the pre-rendering code listen to |
(...skipping 27 matching lines...) Expand all Loading... |
1562 } else { | 1563 } else { |
1563 entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(), | 1564 entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(), |
1564 page_id); | 1565 page_id); |
1565 } | 1566 } |
1566 if (!entry || entry->GetURL() != validated_source_url) | 1567 if (!entry || entry->GetURL() != validated_source_url) |
1567 return; | 1568 return; |
1568 | 1569 |
1569 // Notify observers about the provisional change in the main frame URL. | 1570 // Notify observers about the provisional change in the main frame URL. |
1570 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1571 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1571 ProvisionalChangeToMainFrameUrl(validated_target_url, | 1572 ProvisionalChangeToMainFrameUrl(validated_target_url, |
1572 validated_opener_url)); | 1573 validated_opener_url, |
| 1574 render_view_host)); |
1573 } | 1575 } |
1574 | 1576 |
1575 void WebContentsImpl::DidFailProvisionalLoadWithError( | 1577 void WebContentsImpl::DidFailProvisionalLoadWithError( |
1576 content::RenderViewHost* render_view_host, | 1578 content::RenderViewHost* render_view_host, |
1577 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1579 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
1578 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1580 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
1579 << ", error_code: " << params.error_code | 1581 << ", error_code: " << params.error_code |
1580 << ", error_description: " << params.error_description | 1582 << ", error_description: " << params.error_description |
1581 << ", is_main_frame: " << params.is_main_frame | 1583 << ", is_main_frame: " << params.is_main_frame |
1582 << ", showing_repost_interstitial: " << | 1584 << ", showing_repost_interstitial: " << |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 | 1632 |
1631 render_manager_.RendererAbortedProvisionalLoad(render_view_host); | 1633 render_manager_.RendererAbortedProvisionalLoad(render_view_host); |
1632 } | 1634 } |
1633 | 1635 |
1634 FOR_EACH_OBSERVER(WebContentsObserver, | 1636 FOR_EACH_OBSERVER(WebContentsObserver, |
1635 observers_, | 1637 observers_, |
1636 DidFailProvisionalLoad(params.frame_id, | 1638 DidFailProvisionalLoad(params.frame_id, |
1637 params.is_main_frame, | 1639 params.is_main_frame, |
1638 validated_url, | 1640 validated_url, |
1639 params.error_code, | 1641 params.error_code, |
1640 params.error_description)); | 1642 params.error_description, |
| 1643 render_view_host)); |
1641 } | 1644 } |
1642 | 1645 |
1643 void WebContentsImpl::OnDidLoadResourceFromMemoryCache( | 1646 void WebContentsImpl::OnDidLoadResourceFromMemoryCache( |
1644 const GURL& url, | 1647 const GURL& url, |
1645 const std::string& security_info, | 1648 const std::string& security_info, |
1646 const std::string& http_method, | 1649 const std::string& http_method, |
1647 ResourceType::Type resource_type) { | 1650 ResourceType::Type resource_type) { |
1648 base::StatsCounter cache("WebKit.CacheHit"); | 1651 base::StatsCounter cache("WebKit.CacheHit"); |
1649 cache.Increment(); | 1652 cache.Increment(); |
1650 | 1653 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 // entry list. | 2171 // entry list. |
2169 if (did_navigate && | 2172 if (did_navigate && |
2170 (controller_.GetActiveEntry()->GetTransitionType() & | 2173 (controller_.GetActiveEntry()->GetTransitionType() & |
2171 content::PAGE_TRANSITION_FORWARD_BACK)) { | 2174 content::PAGE_TRANSITION_FORWARD_BACK)) { |
2172 transition_type = content::PageTransitionFromInt( | 2175 transition_type = content::PageTransitionFromInt( |
2173 params.transition | content::PAGE_TRANSITION_FORWARD_BACK); | 2176 params.transition | content::PAGE_TRANSITION_FORWARD_BACK); |
2174 } | 2177 } |
2175 // Notify observers about the commit of the provisional load. | 2178 // Notify observers about the commit of the provisional load. |
2176 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2179 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2177 DidCommitProvisionalLoadForFrame(params.frame_id, | 2180 DidCommitProvisionalLoadForFrame(params.frame_id, |
2178 is_main_frame, params.url, transition_type)); | 2181 is_main_frame, params.url, transition_type, rvh)); |
2179 } | 2182 } |
2180 | 2183 |
2181 if (!did_navigate) | 2184 if (!did_navigate) |
2182 return; // No navigation happened. | 2185 return; // No navigation happened. |
2183 | 2186 |
2184 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 2187 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
2185 // for the appropriate notification (best) or you can add it to | 2188 // for the appropriate notification (best) or you can add it to |
2186 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 2189 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
2187 // necessary, please). | 2190 // necessary, please). |
2188 | 2191 |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2782 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2780 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2783 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2781 // Can be NULL during tests. | 2784 // Can be NULL during tests. |
2782 if (rwh_view) | 2785 if (rwh_view) |
2783 rwh_view->SetSize(GetView()->GetContainerSize()); | 2786 rwh_view->SetSize(GetView()->GetContainerSize()); |
2784 } | 2787 } |
2785 | 2788 |
2786 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2789 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2787 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2790 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2788 } | 2791 } |
OLD | NEW |