| Index: components/renderer_context_menu/render_view_context_menu_base.cc
|
| diff --git a/components/renderer_context_menu/render_view_context_menu_base.cc b/components/renderer_context_menu/render_view_context_menu_base.cc
|
| index cda6c4667aef1908774a90842753fd62598a7b95..3cdf8a326a08a1478e2bd1171c6cbf9d47c56453 100644
|
| --- a/components/renderer_context_menu/render_view_context_menu_base.cc
|
| +++ b/components/renderer_context_menu/render_view_context_menu_base.cc
|
| @@ -15,6 +15,9 @@
|
| #include "content/public/browser/render_widget_host_view.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/common/menu_item.h"
|
| +#if defined(ENABLE_EXTENSIONS)
|
| +#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
| +#endif
|
| #include "third_party/WebKit/public/web/WebContextMenuData.h"
|
|
|
| using blink::WebContextMenuData;
|
| @@ -126,6 +129,17 @@ void AddCustomItemsToMenu(const std::vector<content::MenuItem>& items,
|
| }
|
| }
|
|
|
| +content::WebContents* GetWebContentsToUse(content::WebContents* web_contents) {
|
| +// If we're viewing in a MimeHandlerViewGuest, use its embedder WebContents.
|
| +#if defined(ENABLE_EXTENSIONS)
|
| + auto guest_view =
|
| + extensions::MimeHandlerViewGuest::FromWebContents(web_contents);
|
| + if (guest_view)
|
| + return guest_view->embedder_web_contents();
|
| +#endif
|
| + return web_contents;
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -155,6 +169,7 @@ RenderViewContextMenuBase::RenderViewContextMenuBase(
|
| const content::ContextMenuParams& params)
|
| : params_(params),
|
| source_web_contents_(WebContents::FromRenderFrameHost(render_frame_host)),
|
| + embedded_web_contents_(GetWebContentsToUse(source_web_contents_)),
|
| browser_context_(source_web_contents_->GetBrowserContext()),
|
| menu_model_(this),
|
| render_frame_id_(render_frame_host->GetRoutingID()),
|
|
|