Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 325443002: Move about://-related constants from //content to //url (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 // The browser process should never hear the swappedout:// URL from any 1619 // The browser process should never hear the swappedout:// URL from any
1620 // of the renderer's messages. Check for this in debug builds, but don't 1620 // of the renderer's messages. Check for this in debug builds, but don't
1621 // let it crash a release browser. 1621 // let it crash a release browser.
1622 DCHECK(GURL(kSwappedOutURL) != *url); 1622 DCHECK(GURL(kSwappedOutURL) != *url);
1623 1623
1624 if (!url->is_valid()) { 1624 if (!url->is_valid()) {
1625 // Have to use about:blank for the denied case, instead of an empty GURL. 1625 // Have to use about:blank for the denied case, instead of an empty GURL.
1626 // This is because the browser treats navigation to an empty GURL as a 1626 // This is because the browser treats navigation to an empty GURL as a
1627 // navigation to the home page. This is often a privileged page 1627 // navigation to the home page. This is often a privileged page
1628 // (chrome://newtab/) which is exactly what we don't want. 1628 // (chrome://newtab/) which is exactly what we don't want.
1629 *url = GURL(kAboutBlankURL); 1629 *url = GURL(url::kAboutBlankURL);
1630 RecordAction(base::UserMetricsAction("FilterURLTermiate_Invalid")); 1630 RecordAction(base::UserMetricsAction("FilterURLTermiate_Invalid"));
1631 return; 1631 return;
1632 } 1632 }
1633 1633
1634 if (url->SchemeIs(kAboutScheme)) { 1634 if (url->SchemeIs(url::kAboutScheme)) {
1635 // The renderer treats all URLs in the about: scheme as being about:blank. 1635 // The renderer treats all URLs in the about: scheme as being about:blank.
1636 // Canonicalize about: URLs to about:blank. 1636 // Canonicalize about: URLs to about:blank.
1637 *url = GURL(kAboutBlankURL); 1637 *url = GURL(url::kAboutBlankURL);
1638 RecordAction(base::UserMetricsAction("FilterURLTermiate_About")); 1638 RecordAction(base::UserMetricsAction("FilterURLTermiate_About"));
1639 } 1639 }
1640 1640
1641 // Do not allow browser plugin guests to navigate to non-web URLs, since they 1641 // Do not allow browser plugin guests to navigate to non-web URLs, since they
1642 // cannot swap processes or grant bindings. 1642 // cannot swap processes or grant bindings.
1643 bool non_web_url_in_guest = rph->IsIsolatedGuest() && 1643 bool non_web_url_in_guest = rph->IsIsolatedGuest() &&
1644 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); 1644 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme()));
1645 1645
1646 if (non_web_url_in_guest || !policy->CanRequestURL(rph->GetID(), *url)) { 1646 if (non_web_url_in_guest || !policy->CanRequestURL(rph->GetID(), *url)) {
1647 // If this renderer is not permitted to request this URL, we invalidate the 1647 // If this renderer is not permitted to request this URL, we invalidate the
1648 // URL. This prevents us from storing the blocked URL and becoming confused 1648 // URL. This prevents us from storing the blocked URL and becoming confused
1649 // later. 1649 // later.
1650 VLOG(1) << "Blocked URL " << url->spec(); 1650 VLOG(1) << "Blocked URL " << url->spec();
1651 *url = GURL(kAboutBlankURL); 1651 *url = GURL(url::kAboutBlankURL);
1652 RecordAction(base::UserMetricsAction("FilterURLTermiate_Blocked")); 1652 RecordAction(base::UserMetricsAction("FilterURLTermiate_Blocked"));
1653 } 1653 }
1654 } 1654 }
1655 1655
1656 // static 1656 // static
1657 bool RenderProcessHostImpl::IsSuitableHost( 1657 bool RenderProcessHostImpl::IsSuitableHost(
1658 RenderProcessHost* host, 1658 RenderProcessHost* host,
1659 BrowserContext* browser_context, 1659 BrowserContext* browser_context,
1660 const GURL& site_url) { 1660 const GURL& site_url) {
1661 if (run_renderer_in_process()) 1661 if (run_renderer_in_process())
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2248 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2249 IPC::Message* reply, 2249 IPC::Message* reply,
2250 const gfx::GpuMemoryBufferHandle& handle) { 2250 const gfx::GpuMemoryBufferHandle& handle) {
2251 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2251 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2252 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2252 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2253 handle); 2253 handle);
2254 Send(reply); 2254 Send(reply);
2255 } 2255 }
2256 2256
2257 } // namespace content 2257 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698