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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( | 261 bool GuestViewManager::CanEmbedderAccessInstanceIDMaybeKill( |
262 int embedder_render_process_id, | 262 int embedder_render_process_id, |
263 int guest_instance_id) { | 263 int guest_instance_id) { |
264 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, | 264 if (!CanEmbedderAccessInstanceID(embedder_render_process_id, |
265 guest_instance_id)) { | 265 guest_instance_id)) { |
266 // The embedder process is trying to access a guest it does not own. | 266 // The embedder process is trying to access a guest it does not own. |
267 content::RecordAction( | 267 content::RecordAction( |
268 base::UserMetricsAction("BadMessageTerminate_BPGM")); | 268 base::UserMetricsAction("BadMessageTerminate_BPGM")); |
269 base::KillProcess( | 269 content::RenderProcessHost::FromID(embedder_render_process_id) |
270 content::RenderProcessHost::FromID(embedder_render_process_id)-> | 270 ->Shutdown(content::RESULT_CODE_KILLED_BAD_MESSAGE, false); |
271 GetHandle(), | |
272 content::RESULT_CODE_KILLED_BAD_MESSAGE, false); | |
273 return false; | 271 return false; |
274 } | 272 } |
275 return true; | 273 return true; |
276 } | 274 } |
277 | 275 |
278 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { | 276 bool GuestViewManager::CanUseGuestInstanceID(int guest_instance_id) { |
279 if (guest_instance_id <= last_instance_id_removed_) | 277 if (guest_instance_id <= last_instance_id_removed_) |
280 return false; | 278 return false; |
281 return !ContainsKey(removed_instance_ids_, guest_instance_id); | 279 return !ContainsKey(removed_instance_ids_, guest_instance_id); |
282 } | 280 } |
(...skipping 21 matching lines...) Expand all Loading... |
304 return true; | 302 return true; |
305 | 303 |
306 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); | 304 GuestViewBase* guest_view = GuestViewBase::FromWebContents(it->second); |
307 if (!guest_view) | 305 if (!guest_view) |
308 return false; | 306 return false; |
309 | 307 |
310 return embedder_render_process_id == guest_view->owner_render_process_id(); | 308 return embedder_render_process_id == guest_view->owner_render_process_id(); |
311 } | 309 } |
312 | 310 |
313 } // namespace extensions | 311 } // namespace extensions |
OLD | NEW |