| 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 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 // The browser process should never hear the swappedout:// URL from any | 1647 // The browser process should never hear the swappedout:// URL from any |
| 1648 // of the renderer's messages. Check for this in debug builds, but don't | 1648 // of the renderer's messages. Check for this in debug builds, but don't |
| 1649 // let it crash a release browser. | 1649 // let it crash a release browser. |
| 1650 DCHECK(GURL(kSwappedOutURL) != *url); | 1650 DCHECK(GURL(kSwappedOutURL) != *url); |
| 1651 | 1651 |
| 1652 if (!url->is_valid()) { | 1652 if (!url->is_valid()) { |
| 1653 // Have to use about:blank for the denied case, instead of an empty GURL. | 1653 // Have to use about:blank for the denied case, instead of an empty GURL. |
| 1654 // This is because the browser treats navigation to an empty GURL as a | 1654 // This is because the browser treats navigation to an empty GURL as a |
| 1655 // navigation to the home page. This is often a privileged page | 1655 // navigation to the home page. This is often a privileged page |
| 1656 // (chrome://newtab/) which is exactly what we don't want. | 1656 // (chrome://newtab/) which is exactly what we don't want. |
| 1657 *url = GURL(kAboutBlankURL); | 1657 *url = GURL(url::kAboutBlankURL); |
| 1658 RecordAction(base::UserMetricsAction("FilterURLTermiate_Invalid")); | 1658 RecordAction(base::UserMetricsAction("FilterURLTermiate_Invalid")); |
| 1659 return; | 1659 return; |
| 1660 } | 1660 } |
| 1661 | 1661 |
| 1662 if (url->SchemeIs(kAboutScheme)) { | 1662 if (url->SchemeIs(url::kAboutScheme)) { |
| 1663 // The renderer treats all URLs in the about: scheme as being about:blank. | 1663 // The renderer treats all URLs in the about: scheme as being about:blank. |
| 1664 // Canonicalize about: URLs to about:blank. | 1664 // Canonicalize about: URLs to about:blank. |
| 1665 *url = GURL(kAboutBlankURL); | 1665 *url = GURL(url::kAboutBlankURL); |
| 1666 RecordAction(base::UserMetricsAction("FilterURLTermiate_About")); | 1666 RecordAction(base::UserMetricsAction("FilterURLTermiate_About")); |
| 1667 } | 1667 } |
| 1668 | 1668 |
| 1669 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 1669 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
| 1670 // cannot swap processes or grant bindings. | 1670 // cannot swap processes or grant bindings. |
| 1671 bool non_web_url_in_guest = rph->IsIsolatedGuest() && | 1671 bool non_web_url_in_guest = rph->IsIsolatedGuest() && |
| 1672 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); | 1672 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); |
| 1673 | 1673 |
| 1674 if (non_web_url_in_guest || !policy->CanRequestURL(rph->GetID(), *url)) { | 1674 if (non_web_url_in_guest || !policy->CanRequestURL(rph->GetID(), *url)) { |
| 1675 // If this renderer is not permitted to request this URL, we invalidate the | 1675 // If this renderer is not permitted to request this URL, we invalidate the |
| 1676 // URL. This prevents us from storing the blocked URL and becoming confused | 1676 // URL. This prevents us from storing the blocked URL and becoming confused |
| 1677 // later. | 1677 // later. |
| 1678 VLOG(1) << "Blocked URL " << url->spec(); | 1678 VLOG(1) << "Blocked URL " << url->spec(); |
| 1679 *url = GURL(kAboutBlankURL); | 1679 *url = GURL(url::kAboutBlankURL); |
| 1680 RecordAction(base::UserMetricsAction("FilterURLTermiate_Blocked")); | 1680 RecordAction(base::UserMetricsAction("FilterURLTermiate_Blocked")); |
| 1681 } | 1681 } |
| 1682 } | 1682 } |
| 1683 | 1683 |
| 1684 // static | 1684 // static |
| 1685 bool RenderProcessHostImpl::IsSuitableHost( | 1685 bool RenderProcessHostImpl::IsSuitableHost( |
| 1686 RenderProcessHost* host, | 1686 RenderProcessHost* host, |
| 1687 BrowserContext* browser_context, | 1687 BrowserContext* browser_context, |
| 1688 const GURL& site_url) { | 1688 const GURL& site_url) { |
| 1689 if (run_renderer_in_process()) | 1689 if (run_renderer_in_process()) |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 void RenderProcessHostImpl::GpuMemoryBufferAllocated( | 2301 void RenderProcessHostImpl::GpuMemoryBufferAllocated( |
| 2302 IPC::Message* reply, | 2302 IPC::Message* reply, |
| 2303 const gfx::GpuMemoryBufferHandle& handle) { | 2303 const gfx::GpuMemoryBufferHandle& handle) { |
| 2304 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2304 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 2305 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, | 2305 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, |
| 2306 handle); | 2306 handle); |
| 2307 Send(reply); | 2307 Send(reply); |
| 2308 } | 2308 } |
| 2309 | 2309 |
| 2310 } // namespace content | 2310 } // namespace content |
| OLD | NEW |