Implement event.sender for ipcRenderer
This commit is contained in:
parent
90a7d4a906
commit
d234f10177
1 changed files with 5 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -143,8 +144,10 @@ void AtomRenderViewObserver::OnBrowserMessage(const base::string16& channel,
|
|||
v8::Local<v8::Object> ipc;
|
||||
if (GetIPCObject(isolate, context, &ipc)) {
|
||||
auto args_vector = ListValueToVector(isolate, args);
|
||||
// Insert a dummy Event object.
|
||||
args_vector.insert(args_vector.begin(), v8::Object::New(isolate));
|
||||
// Insert the Event object, event.sender is ipc.
|
||||
mate::Dictionary event = mate::Dictionary::CreateEmpty(isolate);
|
||||
event.Set("sender", ipc);
|
||||
args_vector.insert(args_vector.begin(), event.GetHandle());
|
||||
mate::EmitEvent(isolate, ipc, channel, args_vector);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue