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 "components/guest_view/browser/guest_view_manager.h" | 5 #include "components/guest_view/browser/guest_view_manager.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 // We might get some late arriving messages at tear down. Let's let the | 456 // We might get some late arriving messages at tear down. Let's let the |
457 // embedder tear down in peace. | 457 // embedder tear down in peace. |
458 auto it = guest_web_contents_by_instance_id_.find(guest_instance_id); | 458 auto it = guest_web_contents_by_instance_id_.find(guest_instance_id); |
459 if (it == guest_web_contents_by_instance_id_.end()) | 459 if (it == guest_web_contents_by_instance_id_.end()) |
460 return true; | 460 return true; |
461 | 461 |
462 auto* guest_view = GuestViewBase::FromWebContents(it->second); | 462 auto* guest_view = GuestViewBase::FromWebContents(it->second); |
463 if (!guest_view) | 463 if (!guest_view) |
464 return false; | 464 return false; |
465 | 465 |
| 466 if (guest_view->CanBeEmbeddedInsideCrossProcessFrames()) { |
| 467 // MimeHandlerViewGuests (PDF) may be embedded in a cross-process frame. |
| 468 return embedder_render_process_id == |
| 469 guest_view->GetOwnerSiteInstance()->GetProcess()->GetID(); |
| 470 } |
| 471 |
| 472 // Other than MimeHandlerViewGuest, all other guest types are only permitted |
| 473 // to run in the main frame. |
466 return embedder_render_process_id == | 474 return embedder_render_process_id == |
467 guest_view->owner_web_contents()->GetRenderProcessHost()->GetID(); | 475 guest_view->owner_web_contents()->GetRenderProcessHost()->GetID(); |
468 } | 476 } |
469 | 477 |
470 GuestViewManager::ElementInstanceKey::ElementInstanceKey() | 478 GuestViewManager::ElementInstanceKey::ElementInstanceKey() |
471 : embedder_process_id(content::ChildProcessHost::kInvalidUniqueID), | 479 : embedder_process_id(content::ChildProcessHost::kInvalidUniqueID), |
472 element_instance_id(content::ChildProcessHost::kInvalidUniqueID) { | 480 element_instance_id(content::ChildProcessHost::kInvalidUniqueID) { |
473 } | 481 } |
474 | 482 |
475 GuestViewManager::ElementInstanceKey::ElementInstanceKey( | 483 GuestViewManager::ElementInstanceKey::ElementInstanceKey( |
476 int embedder_process_id, | 484 int embedder_process_id, |
477 int element_instance_id) | 485 int element_instance_id) |
(...skipping 17 matching lines...) Expand all Loading... |
495 const GuestViewCreateFunction& create_function, | 503 const GuestViewCreateFunction& create_function, |
496 const GuestViewCleanUpFunction& cleanup_function) | 504 const GuestViewCleanUpFunction& cleanup_function) |
497 : create_function(create_function), cleanup_function(cleanup_function) {} | 505 : create_function(create_function), cleanup_function(cleanup_function) {} |
498 | 506 |
499 GuestViewManager::GuestViewData::GuestViewData(const GuestViewData& other) = | 507 GuestViewManager::GuestViewData::GuestViewData(const GuestViewData& other) = |
500 default; | 508 default; |
501 | 509 |
502 GuestViewManager::GuestViewData::~GuestViewData() {} | 510 GuestViewManager::GuestViewData::~GuestViewData() {} |
503 | 511 |
504 } // namespace guest_view | 512 } // namespace guest_view |
OLD | NEW |