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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 // Kill the renderer process if it violates this policy. | 1247 // Kill the renderer process if it violates this policy. |
1248 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1248 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1249 if (command_line.HasSwitch(switches::kSitePerProcess) && | 1249 if (command_line.HasSwitch(switches::kSitePerProcess) && |
1250 static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite() && | 1250 static_cast<SiteInstanceImpl*>(GetSiteInstance())->HasSite() && |
1251 validated_params.url != GURL(chrome::kAboutBlankURL)) { | 1251 validated_params.url != GURL(chrome::kAboutBlankURL)) { |
1252 if (!SiteInstance::IsSameWebSite(GetSiteInstance()->GetBrowserContext(), | 1252 if (!SiteInstance::IsSameWebSite(GetSiteInstance()->GetBrowserContext(), |
1253 GetSiteInstance()->GetSiteURL(), | 1253 GetSiteInstance()->GetSiteURL(), |
1254 validated_params.url) || | 1254 validated_params.url) || |
1255 static_cast<SiteInstanceImpl*>(GetSiteInstance())-> | 1255 static_cast<SiteInstanceImpl*>(GetSiteInstance())-> |
1256 HasWrongProcessForURL(validated_params.url)) { | 1256 HasWrongProcessForURL(validated_params.url)) { |
1257 base::KillProcess(process->GetHandle(), RESULT_CODE_KILLED, true); | 1257 // TODO(nasko): Removed the actual kill process call until out-of-process |
1258 UMA_HISTOGRAM_COUNTS("ChildProcess.ViolatedSitePerProcess", 1); | 1258 // iframes is ready to go. |
1259 } | 1259 } |
1260 } | 1260 } |
1261 | 1261 |
1262 ChildProcessSecurityPolicyImpl* policy = | 1262 ChildProcessSecurityPolicyImpl* policy = |
1263 ChildProcessSecurityPolicyImpl::GetInstance(); | 1263 ChildProcessSecurityPolicyImpl::GetInstance(); |
1264 // Without this check, an evil renderer can trick the browser into creating | 1264 // Without this check, an evil renderer can trick the browser into creating |
1265 // a navigation entry for a banned URL. If the user clicks the back button | 1265 // a navigation entry for a banned URL. If the user clicks the back button |
1266 // followed by the forward button (or clicks reload, or round-trips through | 1266 // followed by the forward button (or clicks reload, or round-trips through |
1267 // session restore, etc), we'll think that the browser commanded the | 1267 // session restore, etc), we'll think that the browser commanded the |
1268 // renderer to load the URL and grant the renderer the privileges to request | 1268 // renderer to load the URL and grant the renderer the privileges to request |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2101 GetRoutingID(), snapshot_id, snapshot_size, png)); | 2101 GetRoutingID(), snapshot_id, snapshot_size, png)); |
2102 return; | 2102 return; |
2103 } | 2103 } |
2104 } | 2104 } |
2105 | 2105 |
2106 Send(new ViewMsg_WindowSnapshotCompleted( | 2106 Send(new ViewMsg_WindowSnapshotCompleted( |
2107 GetRoutingID(), snapshot_id, gfx::Size(), png)); | 2107 GetRoutingID(), snapshot_id, gfx::Size(), png)); |
2108 } | 2108 } |
2109 | 2109 |
2110 } // namespace content | 2110 } // namespace content |
OLD | NEW |