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

Unified Diff: chrome/browser/extensions/menu_manager.cc

Issue 1772513002: Add frameId to contextMenus.onClicked / onclick. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/extensions/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 9c794fa41ad46c70bf97c0b276f1f2630a7d727a..77a7b9cea99e1f98002f9470adf06becca66a4b3 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -28,6 +28,7 @@
#include "content/public/common/child_process_host.h"
#include "content/public/common/context_menu_params.h"
#include "extensions/browser/event_router.h"
+#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/state_store.h"
@@ -617,6 +618,7 @@ static void AddURLProperty(base::DictionaryValue* dictionary,
void MenuManager::ExecuteCommand(content::BrowserContext* context,
WebContents* web_contents,
+ content::RenderFrameHost* render_frame_host,
const content::ContextMenuParams& params,
const MenuItem::Id& menu_item_id) {
EventRouter* event_router = EventRouter::Get(context);
@@ -679,6 +681,10 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
if (!extension || !extension->is_platform_app()) {
// Note: web_contents are NULL in unit tests :(
if (web_contents) {
+ int frame_id = ExtensionApiFrameIdMap::GetFrameId(render_frame_host);
+ if (frame_id != ExtensionApiFrameIdMap::kInvalidFrameId)
+ properties->SetInteger("frameId", frame_id);
+
args->Append(
ExtensionTabUtil::CreateTabObject(web_contents)->ToValue().release());
} else {

Powered by Google App Engine
This is Rietveld 408576698