OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/guest_view/guest_view_manager.h" | 5 #include "extensions/browser/guest_view/guest_view_manager.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( | 257 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( |
258 int embedder_render_process_id, | 258 int embedder_render_process_id, |
259 int guest_instance_id) { | 259 int guest_instance_id) { |
260 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, | 260 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, |
261 guest_instance_id)) { | 261 guest_instance_id)) { |
262 // The embedder process is trying to access a guest it does not own. | 262 // The embedder process is trying to access a guest it does not own. |
263 content::RecordAction( | 263 content::RecordAction( |
264 base::UserMetricsAction("BadMessageTerminate_BPGM")); | 264 base::UserMetricsAction("BadMessageTerminate_BPGM")); |
265 base::KillProcess( | 265 content::RenderProcessHost::FromID(embedder_render_process_id) |
266 content::RenderProcessHost::FromID(embedder_render_process_id)-> | 266 ->FastShutdown(content::RESULT_CODE_KILLED_BAD_MESSAGE, false); |
267 GetHandle(), | |
268 content::RESULT_CODE_KILLED_BAD_MESSAGE, false); | |
269 return false; | 267 return false; |
270 } | 268 } |
271 return true; | 269 return true; |
272 } | 270 } |
273 | 271 |
274 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { | 272 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { |
275 if (guest_instance_id <= last_instance_id_removed_) | 273 if (guest_instance_id <= last_instance_id_removed_) |
276 return false; | 274 return false; |
277 return !ContainsKey(removed_instance_ids_, guest_instance_id); | 275 return !ContainsKey(removed_instance_ids_, guest_instance_id); |
278 } | 276 } |
(...skipping 21 matching lines...) Expand all Loading... |
300 return true; | 298 return true; |
301 | 299 |
302 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); | 300 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); |
303 if (!guest_view) | 301 if (!guest_view) |
304 return false; | 302 return false; |
305 | 303 |
306 return embedder_render_process_id == guest_view->embedder_render_process_id(); | 304 return embedder_render_process_id == guest_view->embedder_render_process_id(); |
307 } | 305 } |
308 | 306 |
309 } // namespace extensions | 307 } // namespace extensions |
OLD | NEW |