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