feat: emit context-menu
event from extensions (#38029)
feat: emit context-menu event from extensions
This commit is contained in:
parent
f35b9b3f06
commit
ba8887f586
2 changed files with 14 additions and 4 deletions
|
@ -326,6 +326,9 @@ class WebContents : public ExclusiveAccessContext,
|
||||||
const base::FilePath& file_path);
|
const base::FilePath& file_path);
|
||||||
v8::Local<v8::Promise> GetProcessMemoryInfo(v8::Isolate* isolate);
|
v8::Local<v8::Promise> GetProcessMemoryInfo(v8::Isolate* isolate);
|
||||||
|
|
||||||
|
bool HandleContextMenu(content::RenderFrameHost& render_frame_host,
|
||||||
|
const content::ContextMenuParams& params) override;
|
||||||
|
|
||||||
// Properties.
|
// Properties.
|
||||||
int32_t ID() const { return id_; }
|
int32_t ID() const { return id_; }
|
||||||
v8::Local<v8::Value> Session(v8::Isolate* isolate);
|
v8::Local<v8::Value> Session(v8::Isolate* isolate);
|
||||||
|
@ -551,8 +554,6 @@ class WebContents : public ExclusiveAccessContext,
|
||||||
void RendererResponsive(
|
void RendererResponsive(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host) override;
|
||||||
bool HandleContextMenu(content::RenderFrameHost& render_frame_host,
|
|
||||||
const content::ContextMenuParams& params) override;
|
|
||||||
void FindReply(content::WebContents* web_contents,
|
void FindReply(content::WebContents* web_contents,
|
||||||
int request_id,
|
int request_id,
|
||||||
int number_of_matches,
|
int number_of_matches,
|
||||||
|
|
|
@ -65,10 +65,19 @@ class ElectronMimeHandlerViewGuestDelegate
|
||||||
// MimeHandlerViewGuestDelegate.
|
// MimeHandlerViewGuestDelegate.
|
||||||
bool HandleContextMenu(content::RenderFrameHost& render_frame_host,
|
bool HandleContextMenu(content::RenderFrameHost& render_frame_host,
|
||||||
const content::ContextMenuParams& params) override {
|
const content::ContextMenuParams& params) override {
|
||||||
// TODO(nornagon): surface this event to JS
|
auto* web_contents =
|
||||||
LOG(INFO) << "HCM";
|
content::WebContents::FromRenderFrameHost(&render_frame_host);
|
||||||
|
if (!web_contents)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
electron::api::WebContents* api_web_contents =
|
||||||
|
electron::api::WebContents::From(
|
||||||
|
web_contents->GetOutermostWebContents());
|
||||||
|
if (api_web_contents)
|
||||||
|
api_web_contents->HandleContextMenu(render_frame_host, params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordLoadMetric(bool in_main_frame,
|
void RecordLoadMetric(bool in_main_frame,
|
||||||
const std::string& mime_type) override {}
|
const std::string& mime_type) override {}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue