| 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 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1774 render_view_host_impl->FilterURL( | 1774 render_view_host_impl->FilterURL( |
| 1775 ChildProcessSecurityPolicyImpl::GetInstance(), | 1775 ChildProcessSecurityPolicyImpl::GetInstance(), |
| 1776 render_process_host->GetID(), | 1776 render_process_host->GetID(), |
| 1777 true, | 1777 true, |
| 1778 &validated_opener_url); | 1778 &validated_opener_url); |
| 1779 | 1779 |
| 1780 // Notify observers about the start of the provisional load. | 1780 // Notify observers about the start of the provisional load. |
| 1781 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1781 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1782 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 1782 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
| 1783 validated_url, is_error_page, render_view_host)); | 1783 validated_url, is_error_page, render_view_host)); |
| 1784 | |
| 1785 if (is_main_frame) { | |
| 1786 // Notify observers about the provisional change in the main frame URL. | |
| 1787 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1788 ProvisionalChangeToMainFrameUrl(validated_url, | |
| 1789 validated_opener_url, | |
| 1790 render_view_host)); | |
| 1791 } | |
| 1792 } | |
| 1793 | |
| 1794 void WebContentsImpl::DidRedirectProvisionalLoad( | |
| 1795 content::RenderViewHost* render_view_host, | |
| 1796 int32 page_id, | |
| 1797 const GURL& opener_url, | |
| 1798 const GURL& source_url, | |
| 1799 const GURL& target_url) { | |
| 1800 // TODO(creis): Remove this method and have the pre-rendering code listen to | |
| 1801 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | |
| 1802 // instead. See http://crbug.com/78512. | |
| 1803 GURL validated_source_url(source_url); | |
| 1804 GURL validated_target_url(target_url); | |
| 1805 GURL validated_opener_url(opener_url); | |
| 1806 RenderViewHostImpl* render_view_host_impl = | |
| 1807 static_cast<RenderViewHostImpl*>(render_view_host); | |
| 1808 content::RenderProcessHost* render_process_host = | |
| 1809 render_view_host->GetProcess(); | |
| 1810 render_view_host_impl->FilterURL( | |
| 1811 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1812 render_process_host->GetID(), | |
| 1813 false, | |
| 1814 &validated_source_url); | |
| 1815 render_view_host_impl->FilterURL( | |
| 1816 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1817 render_process_host->GetID(), | |
| 1818 false, | |
| 1819 &validated_target_url); | |
| 1820 render_view_host_impl->FilterURL( | |
| 1821 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1822 render_process_host->GetID(), | |
| 1823 true, | |
| 1824 &validated_opener_url); | |
| 1825 NavigationEntry* entry; | |
| 1826 if (page_id == -1) { | |
| 1827 entry = controller_.GetPendingEntry(); | |
| 1828 } else { | |
| 1829 entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(), | |
| 1830 page_id); | |
| 1831 } | |
| 1832 if (!entry || entry->GetURL() != validated_source_url) | |
| 1833 return; | |
| 1834 | |
| 1835 // Notify observers about the provisional change in the main frame URL. | |
| 1836 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1837 ProvisionalChangeToMainFrameUrl(validated_target_url, | |
| 1838 validated_opener_url, | |
| 1839 render_view_host)); | |
| 1840 } | 1784 } |
| 1841 | 1785 |
| 1842 void WebContentsImpl::DidFailProvisionalLoadWithError( | 1786 void WebContentsImpl::DidFailProvisionalLoadWithError( |
| 1843 content::RenderViewHost* render_view_host, | 1787 content::RenderViewHost* render_view_host, |
| 1844 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1788 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 1845 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1789 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 1846 << ", error_code: " << params.error_code | 1790 << ", error_code: " << params.error_code |
| 1847 << ", error_description: " << params.error_description | 1791 << ", error_description: " << params.error_description |
| 1848 << ", is_main_frame: " << params.is_main_frame | 1792 << ", is_main_frame: " << params.is_main_frame |
| 1849 << ", showing_repost_interstitial: " << | 1793 << ", showing_repost_interstitial: " << |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3076 browser_plugin_host()->embedder_render_process_host(); | 3020 browser_plugin_host()->embedder_render_process_host(); |
| 3077 *embedder_container_id = browser_plugin_host()->instance_id(); | 3021 *embedder_container_id = browser_plugin_host()->instance_id(); |
| 3078 int embedder_process_id = | 3022 int embedder_process_id = |
| 3079 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; | 3023 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; |
| 3080 if (embedder_process_id != -1) { | 3024 if (embedder_process_id != -1) { |
| 3081 *embedder_channel_name = | 3025 *embedder_channel_name = |
| 3082 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), | 3026 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), |
| 3083 embedder_process_id); | 3027 embedder_process_id); |
| 3084 } | 3028 } |
| 3085 } | 3029 } |
| OLD | NEW |