browser: handle flash context menu
This commit is contained in:
parent
cb91d4487b
commit
c969052f12
10 changed files with 177 additions and 22 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "atom/common/api/event_emitter_caller.h"
|
||||
#include "atom/common/native_mate_converters/blink_converter.h"
|
||||
#include "atom/common/native_mate_converters/callback.h"
|
||||
#include "atom/common/native_mate_converters/content_converter.h"
|
||||
#include "atom/common/native_mate_converters/file_path_converter.h"
|
||||
#include "atom/common/native_mate_converters/gfx_converter.h"
|
||||
#include "atom/common/native_mate_converters/gurl_converter.h"
|
||||
|
@ -404,6 +405,12 @@ void WebContents::RendererResponsive(content::WebContents* source) {
|
|||
owner_window()->RendererResponsive(source);
|
||||
}
|
||||
|
||||
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
|
||||
context_menu_context_ = params.custom_context;
|
||||
Emit("-context-menu", params);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WebContents::BeforeUnloadFired(const base::TimeTicks& proceed_time) {
|
||||
// Do nothing, we override this method just to avoid compilation error since
|
||||
// there are two virtual functions named BeforeUnloadFired.
|
||||
|
@ -840,6 +847,15 @@ void WebContents::RemoveWorkSpace(mate::Arguments* args,
|
|||
DevToolsRemoveFileSystem(path);
|
||||
}
|
||||
|
||||
void WebContents::ExecuteContextMenuCommand(int action) {
|
||||
web_contents()->ExecuteCustomContextMenuCommand(action,
|
||||
context_menu_context_);
|
||||
}
|
||||
|
||||
void WebContents::NotifyContextMenuClosed() {
|
||||
web_contents()->NotifyContextMenuClosed(context_menu_context_);
|
||||
}
|
||||
|
||||
void WebContents::Undo() {
|
||||
web_contents()->Undo();
|
||||
}
|
||||
|
@ -1051,6 +1067,10 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
|
|||
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
||||
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
||||
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
||||
.SetMethod("_executeContextMenuCommand",
|
||||
&WebContents::ExecuteContextMenuCommand)
|
||||
.SetMethod("_notifyContextMenuClosed",
|
||||
&WebContents::NotifyContextMenuClosed)
|
||||
.SetProperty("session", &WebContents::Session, true)
|
||||
.SetProperty("devToolsWebContents",
|
||||
&WebContents::DevToolsWebContents, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue