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