| 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_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
| 10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 | 282 |
| 283 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( | 283 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( |
| 284 int embedder_render_process_id, | 284 int embedder_render_process_id, |
| 285 int guest_instance_id) { | 285 int guest_instance_id) { |
| 286 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, | 286 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, |
| 287 guest_instance_id)) { | 287 guest_instance_id)) { |
| 288 // The embedder process is trying to access a guest it does not own. | 288 // The embedder process is trying to access a guest it does not own. |
| 289 content::RecordAction( | 289 content::RecordAction( |
| 290 base::UserMetricsAction("BadMessageTerminate_BPGM")); | 290 base::UserMetricsAction("BadMessageTerminate_BPGM")); |
| 291 base::KillProcess( | 291 content::RenderProcessHost::FromID(embedder_render_process_id) |
| 292 content::RenderProcessHost::FromID(embedder_render_process_id)-> | 292 ->Shutdown(content::RESULT_CODE_KILLED_BAD_MESSAGE, false); |
| 293 GetHandle(), | |
| 294 content::RESULT_CODE_KILLED_BAD_MESSAGE, false); | |
| 295 return false; | 293 return false; |
| 296 } | 294 } |
| 297 return true; | 295 return true; |
| 298 } | 296 } |
| 299 | 297 |
| 300 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { | 298 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { |
| 301 if (guest_instance_id <= last_instance_id_removed_) | 299 if (guest_instance_id <= last_instance_id_removed_) |
| 302 return false; | 300 return false; |
| 303 return !ContainsKey(removed_instance_ids_, guest_instance_id); | 301 return !ContainsKey(removed_instance_ids_, guest_instance_id); |
| 304 } | 302 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 326 return true; | 324 return true; |
| 327 | 325 |
| 328 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); | 326 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); |
| 329 if (!guest_view) | 327 if (!guest_view) |
| 330 return false; | 328 return false; |
| 331 | 329 |
| 332 return embedder_render_process_id == guest_view->owner_render_process_id(); | 330 return embedder_render_process_id == guest_view->owner_render_process_id(); |
| 333 } | 331 } |
| 334 | 332 |
| 335 } // namespace extensions | 333 } // namespace extensions |
| OLD | NEW |