Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 1117893002: Moving extension code out of "components/" to avoid layering violations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nit. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index c3cc583fa78fcdabc8bbbcf44939bcc4cb825da1..35c7ebf352f8aceb4a0e742817a6962df8da9aae 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -103,6 +103,10 @@
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/text_elider.h"
+#if defined(ENABLE_EXTENSIONS)
+#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
+#endif
+
#if defined(ENABLE_PRINTING)
#include "chrome/browser/printing/print_view_manager_common.h"
#include "components/printing/common/print_messages.h"
@@ -303,6 +307,19 @@ content::Referrer CreateSaveAsReferrer(
content::Referrer(referring_url.GetAsReferrer(), params.referrer_policy));
}
+content::WebContents* GetWebContentsToUse(content::WebContents* web_contents) {
+#if defined(ENABLE_EXTENSIONS)
+ // If we're viewing in a MimeHandlerViewGuest, use its embedder WebContents.
+ if (extensions::MimeHandlerViewGuest::FromWebContents(web_contents)) {
+ WebContents* top_level_web_contents =
+ guest_view::GuestViewBase::GetTopLevelWebContents(web_contents);
+ if (top_level_web_contents)
+ return top_level_web_contents;
+ }
+#endif
+ return web_contents;
+}
+
bool g_custom_id_ranges_initialized = false;
const int kSpellcheckRadioGroup = 1;
@@ -350,7 +367,8 @@ RenderViewContextMenu::RenderViewContextMenu(
base::Bind(MenuItemMatchesParams, params_)),
protocol_handler_submenu_model_(this),
protocol_handler_registry_(
- ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())) {
+ ProtocolHandlerRegistryFactory::GetForBrowserContext(GetProfile())),
+ embedder_web_contents_(GetWebContentsToUse(source_web_contents_)) {
if (!g_custom_id_ranges_initialized) {
g_custom_id_ranges_initialized = true;
SetContentCustomCommandIdRange(IDC_CONTENT_CONTEXT_CUSTOM_FIRST,
« no previous file with comments | « chrome/browser/renderer_context_menu/render_view_context_menu.h ('k') | components/renderer_context_menu/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698