| 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 // of the renderer's messages. Check for this in debug builds, but don't | 1827 // of the renderer's messages. Check for this in debug builds, but don't |
| 1828 // let it crash a release browser. | 1828 // let it crash a release browser. |
| 1829 DCHECK(GURL(kSwappedOutURL) != *url); | 1829 DCHECK(GURL(kSwappedOutURL) != *url); |
| 1830 | 1830 |
| 1831 if (!url->is_valid()) { | 1831 if (!url->is_valid()) { |
| 1832 // Have to use about:blank for the denied case, instead of an empty GURL. | 1832 // Have to use about:blank for the denied case, instead of an empty GURL. |
| 1833 // This is because the browser treats navigation to an empty GURL as a | 1833 // This is because the browser treats navigation to an empty GURL as a |
| 1834 // navigation to the home page. This is often a privileged page | 1834 // navigation to the home page. This is often a privileged page |
| 1835 // (chrome://newtab/) which is exactly what we don't want. | 1835 // (chrome://newtab/) which is exactly what we don't want. |
| 1836 *url = GURL(url::kAboutBlankURL); | 1836 *url = GURL(url::kAboutBlankURL); |
| 1837 RecordAction(base::UserMetricsAction("FilterURLTermiate_Invalid")); | |
| 1838 return; | 1837 return; |
| 1839 } | 1838 } |
| 1840 | 1839 |
| 1841 if (url->SchemeIs(url::kAboutScheme)) { | 1840 if (url->SchemeIs(url::kAboutScheme)) { |
| 1842 // The renderer treats all URLs in the about: scheme as being about:blank. | 1841 // The renderer treats all URLs in the about: scheme as being about:blank. |
| 1843 // Canonicalize about: URLs to about:blank. | 1842 // Canonicalize about: URLs to about:blank. |
| 1844 *url = GURL(url::kAboutBlankURL); | 1843 *url = GURL(url::kAboutBlankURL); |
| 1845 RecordAction(base::UserMetricsAction("FilterURLTermiate_About")); | |
| 1846 } | 1844 } |
| 1847 | 1845 |
| 1848 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 1846 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
| 1849 // cannot swap processes or grant bindings. | 1847 // cannot swap processes or grant bindings. |
| 1850 bool non_web_url_in_guest = rph->IsIsolatedGuest() && | 1848 bool non_web_url_in_guest = rph->IsIsolatedGuest() && |
| 1851 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); | 1849 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); |
| 1852 | 1850 |
| 1853 if (non_web_url_in_guest || !policy->CanRequestURL(rph->GetID(), *url)) { | 1851 if (non_web_url_in_guest || !policy->CanRequestURL(rph->GetID(), *url)) { |
| 1854 // If this renderer is not permitted to request this URL, we invalidate the | 1852 // If this renderer is not permitted to request this URL, we invalidate the |
| 1855 // URL. This prevents us from storing the blocked URL and becoming confused | 1853 // URL. This prevents us from storing the blocked URL and becoming confused |
| 1856 // later. | 1854 // later. |
| 1857 VLOG(1) << "Blocked URL " << url->spec(); | 1855 VLOG(1) << "Blocked URL " << url->spec(); |
| 1858 *url = GURL(url::kAboutBlankURL); | 1856 *url = GURL(url::kAboutBlankURL); |
| 1859 RecordAction(base::UserMetricsAction("FilterURLTermiate_Blocked")); | |
| 1860 } | 1857 } |
| 1861 } | 1858 } |
| 1862 | 1859 |
| 1863 // static | 1860 // static |
| 1864 bool RenderProcessHostImpl::IsSuitableHost( | 1861 bool RenderProcessHostImpl::IsSuitableHost( |
| 1865 RenderProcessHost* host, | 1862 RenderProcessHost* host, |
| 1866 BrowserContext* browser_context, | 1863 BrowserContext* browser_context, |
| 1867 const GURL& site_url) { | 1864 const GURL& site_url) { |
| 1868 if (run_renderer_in_process()) | 1865 if (run_renderer_in_process()) |
| 1869 return true; | 1866 return true; |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 if (worker_ref_count_ == 0) | 2482 if (worker_ref_count_ == 0) |
| 2486 Cleanup(); | 2483 Cleanup(); |
| 2487 } | 2484 } |
| 2488 | 2485 |
| 2489 void RenderProcessHostImpl::GetAudioOutputControllers( | 2486 void RenderProcessHostImpl::GetAudioOutputControllers( |
| 2490 const GetAudioOutputControllersCallback& callback) const { | 2487 const GetAudioOutputControllersCallback& callback) const { |
| 2491 audio_renderer_host()->GetOutputControllers(callback); | 2488 audio_renderer_host()->GetOutputControllers(callback); |
| 2492 } | 2489 } |
| 2493 | 2490 |
| 2494 } // namespace content | 2491 } // namespace content |
| OLD | NEW |