| 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 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 RenderViewHostImpl::FilterURL( | 1786 RenderViewHostImpl::FilterURL( |
| 1787 ChildProcessSecurityPolicyImpl::GetInstance(), | 1787 ChildProcessSecurityPolicyImpl::GetInstance(), |
| 1788 render_process_host->GetID(), | 1788 render_process_host->GetID(), |
| 1789 true, | 1789 true, |
| 1790 &validated_opener_url); | 1790 &validated_opener_url); |
| 1791 | 1791 |
| 1792 // Notify observers about the start of the provisional load. | 1792 // Notify observers about the start of the provisional load. |
| 1793 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1793 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 1794 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, | 1794 DidStartProvisionalLoadForFrame(frame_id, is_main_frame, |
| 1795 validated_url, is_error_page, render_view_host)); | 1795 validated_url, is_error_page, render_view_host)); |
| 1796 | |
| 1797 if (is_main_frame) { | |
| 1798 // Notify observers about the provisional change in the main frame URL. | |
| 1799 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1800 ProvisionalChangeToMainFrameUrl(validated_url, | |
| 1801 validated_opener_url, | |
| 1802 render_view_host)); | |
| 1803 } | |
| 1804 } | |
| 1805 | |
| 1806 void WebContentsImpl::DidRedirectProvisionalLoad( | |
| 1807 content::RenderViewHost* render_view_host, | |
| 1808 int32 page_id, | |
| 1809 const GURL& opener_url, | |
| 1810 const GURL& source_url, | |
| 1811 const GURL& target_url) { | |
| 1812 // TODO(creis): Remove this method and have the pre-rendering code listen to | |
| 1813 // the ResourceDispatcherHost's RESOURCE_RECEIVED_REDIRECT notification | |
| 1814 // instead. See http://crbug.com/78512. | |
| 1815 GURL validated_source_url(source_url); | |
| 1816 GURL validated_target_url(target_url); | |
| 1817 GURL validated_opener_url(opener_url); | |
| 1818 content::RenderProcessHost* render_process_host = | |
| 1819 render_view_host->GetProcess(); | |
| 1820 RenderViewHostImpl::FilterURL( | |
| 1821 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1822 render_process_host->GetID(), | |
| 1823 false, | |
| 1824 &validated_source_url); | |
| 1825 RenderViewHostImpl::FilterURL( | |
| 1826 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1827 render_process_host->GetID(), | |
| 1828 false, | |
| 1829 &validated_target_url); | |
| 1830 RenderViewHostImpl::FilterURL( | |
| 1831 ChildProcessSecurityPolicyImpl::GetInstance(), | |
| 1832 render_process_host->GetID(), | |
| 1833 true, | |
| 1834 &validated_opener_url); | |
| 1835 NavigationEntry* entry; | |
| 1836 if (page_id == -1) { | |
| 1837 entry = controller_.GetPendingEntry(); | |
| 1838 } else { | |
| 1839 entry = controller_.GetEntryWithPageID(render_view_host->GetSiteInstance(), | |
| 1840 page_id); | |
| 1841 } | |
| 1842 if (!entry || entry->GetURL() != validated_source_url) | |
| 1843 return; | |
| 1844 | |
| 1845 // Notify observers about the provisional change in the main frame URL. | |
| 1846 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | |
| 1847 ProvisionalChangeToMainFrameUrl(validated_target_url, | |
| 1848 validated_opener_url, | |
| 1849 render_view_host)); | |
| 1850 } | 1796 } |
| 1851 | 1797 |
| 1852 void WebContentsImpl::DidFailProvisionalLoadWithError( | 1798 void WebContentsImpl::DidFailProvisionalLoadWithError( |
| 1853 content::RenderViewHost* render_view_host, | 1799 content::RenderViewHost* render_view_host, |
| 1854 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 1800 const ViewHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
| 1855 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 1801 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
| 1856 << ", error_code: " << params.error_code | 1802 << ", error_code: " << params.error_code |
| 1857 << ", error_description: " << params.error_description | 1803 << ", error_description: " << params.error_description |
| 1858 << ", is_main_frame: " << params.is_main_frame | 1804 << ", is_main_frame: " << params.is_main_frame |
| 1859 << ", showing_repost_interstitial: " << | 1805 << ", showing_repost_interstitial: " << |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 browser_plugin_host()->embedder_render_process_host(); | 3032 browser_plugin_host()->embedder_render_process_host(); |
| 3087 *embedder_container_id = browser_plugin_host()->instance_id(); | 3033 *embedder_container_id = browser_plugin_host()->instance_id(); |
| 3088 int embedder_process_id = | 3034 int embedder_process_id = |
| 3089 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; | 3035 embedder_render_process_host ? embedder_render_process_host->GetID() : -1; |
| 3090 if (embedder_process_id != -1) { | 3036 if (embedder_process_id != -1) { |
| 3091 *embedder_channel_name = | 3037 *embedder_channel_name = |
| 3092 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), | 3038 StringPrintf("%d.r%d", render_view_host->GetProcess()->GetID(), |
| 3093 embedder_process_id); | 3039 embedder_process_id); |
| 3094 } | 3040 } |
| 3095 } | 3041 } |
| OLD | NEW |