| 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/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 // of the renderer's messages. Check for this in debug builds, but don't | 1712 // of the renderer's messages. Check for this in debug builds, but don't |
| 1713 // let it crash a release browser. | 1713 // let it crash a release browser. |
| 1714 DCHECK(GURL(kSwappedOutURL) != *url); | 1714 DCHECK(GURL(kSwappedOutURL) != *url); |
| 1715 | 1715 |
| 1716 if (!url->is_valid()) { | 1716 if (!url->is_valid()) { |
| 1717 // Have to use about:blank for the denied case, instead of an empty GURL. | 1717 // Have to use about:blank for the denied case, instead of an empty GURL. |
| 1718 // This is because the browser treats navigation to an empty GURL as a | 1718 // This is because the browser treats navigation to an empty GURL as a |
| 1719 // navigation to the home page. This is often a privileged page | 1719 // navigation to the home page. This is often a privileged page |
| 1720 // (chrome://newtab/) which is exactly what we don't want. | 1720 // (chrome://newtab/) which is exactly what we don't want. |
| 1721 *url = GURL(chrome::kAboutBlankURL); | 1721 *url = GURL(chrome::kAboutBlankURL); |
| 1722 RecordAction(UserMetricsAction("FilterURLTermiate_Invalid")); |
| 1722 return; | 1723 return; |
| 1723 } | 1724 } |
| 1724 | 1725 |
| 1725 if (url->SchemeIs(chrome::kAboutScheme)) { | 1726 if (url->SchemeIs(chrome::kAboutScheme)) { |
| 1726 // The renderer treats all URLs in the about: scheme as being about:blank. | 1727 // The renderer treats all URLs in the about: scheme as being about:blank. |
| 1727 // Canonicalize about: URLs to about:blank. | 1728 // Canonicalize about: URLs to about:blank. |
| 1728 *url = GURL(chrome::kAboutBlankURL); | 1729 *url = GURL(chrome::kAboutBlankURL); |
| 1730 RecordAction(UserMetricsAction("FilterURLTermiate_About")); |
| 1729 } | 1731 } |
| 1730 | 1732 |
| 1731 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 1733 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
| 1732 // cannot swap processes or grant bindings. | 1734 // cannot swap processes or grant bindings. |
| 1733 bool non_web_url_in_guest = process->IsGuest() && | 1735 bool non_web_url_in_guest = process->IsGuest() && |
| 1734 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); | 1736 !(url->is_valid() && policy->IsWebSafeScheme(url->scheme())); |
| 1735 | 1737 |
| 1736 if (non_web_url_in_guest || !policy->CanRequestURL(process->GetID(), *url)) { | 1738 if (non_web_url_in_guest || !policy->CanRequestURL(process->GetID(), *url)) { |
| 1737 // If this renderer is not permitted to request this URL, we invalidate the | 1739 // If this renderer is not permitted to request this URL, we invalidate the |
| 1738 // URL. This prevents us from storing the blocked URL and becoming confused | 1740 // URL. This prevents us from storing the blocked URL and becoming confused |
| 1739 // later. | 1741 // later. |
| 1740 VLOG(1) << "Blocked URL " << url->spec(); | 1742 VLOG(1) << "Blocked URL " << url->spec(); |
| 1741 *url = GURL(chrome::kAboutBlankURL); | 1743 *url = GURL(chrome::kAboutBlankURL); |
| 1744 RecordAction(UserMetricsAction("FilterURLTermiate_Blocked")); |
| 1742 } | 1745 } |
| 1743 } | 1746 } |
| 1744 | 1747 |
| 1745 void RenderViewHostImpl::SetAltErrorPageURL(const GURL& url) { | 1748 void RenderViewHostImpl::SetAltErrorPageURL(const GURL& url) { |
| 1746 Send(new ViewMsg_SetAltErrorPageURL(GetRoutingID(), url)); | 1749 Send(new ViewMsg_SetAltErrorPageURL(GetRoutingID(), url)); |
| 1747 } | 1750 } |
| 1748 | 1751 |
| 1749 void RenderViewHostImpl::ExitFullscreen() { | 1752 void RenderViewHostImpl::ExitFullscreen() { |
| 1750 RejectMouseLockOrUnlockIfNecessary(); | 1753 RejectMouseLockOrUnlockIfNecessary(); |
| 1751 // We need to notify the contents that its fullscreen state has changed. This | 1754 // We need to notify the contents that its fullscreen state has changed. This |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2063 GetRoutingID(), snapshot_id, snapshot_size, png)); | 2066 GetRoutingID(), snapshot_id, snapshot_size, png)); |
| 2064 return; | 2067 return; |
| 2065 } | 2068 } |
| 2066 } | 2069 } |
| 2067 | 2070 |
| 2068 Send(new ViewMsg_WindowSnapshotCompleted( | 2071 Send(new ViewMsg_WindowSnapshotCompleted( |
| 2069 GetRoutingID(), snapshot_id, gfx::Size(), png)); | 2072 GetRoutingID(), snapshot_id, gfx::Size(), png)); |
| 2070 } | 2073 } |
| 2071 | 2074 |
| 2072 } // namespace content | 2075 } // namespace content |
| OLD | NEW |