small tune of IPC interface.
This commit is contained in:
parent
d28f51fb9c
commit
8f0b2b6363
8 changed files with 25 additions and 21 deletions
|
@ -51,8 +51,8 @@ void AtomRendererBindings::BindToFrame(WebFrame* frame) {
|
|||
AtomBindings::BindTo(GetProcessObject(context));
|
||||
}
|
||||
|
||||
void AtomRendererBindings::OnRendererMessage(const std::string& channel,
|
||||
const base::ListValue& args) {
|
||||
void AtomRendererBindings::OnBrowserMessage(const std::string& channel,
|
||||
const base::ListValue& args) {
|
||||
if (!render_view_->GetWebView())
|
||||
return;
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ class AtomRendererBindings : public AtomBindings {
|
|||
void BindToFrame(WebKit::WebFrame* frame);
|
||||
|
||||
// Dispatch messages from browser.
|
||||
void OnRendererMessage(const std::string& channel,
|
||||
const base::ListValue& args);
|
||||
void OnBrowserMessage(const std::string& channel,
|
||||
const base::ListValue& args);
|
||||
|
||||
private:
|
||||
content::RenderView* render_view_;
|
||||
|
|
|
@ -4,12 +4,12 @@ send = process.atom_binding('ipc').send
|
|||
class Ipc extends EventEmitter
|
||||
constructor: ->
|
||||
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
|
||||
@emit('message', args...)
|
||||
@emit(args...)
|
||||
|
||||
send: (args...) ->
|
||||
@sendChannel('ATOM_INTERNAL_MESSAGE', args...)
|
||||
@sendChannel('message', args...)
|
||||
|
||||
sendChannel: (args...) ->
|
||||
send(args...)
|
||||
send('ATOM_INTERNAL_MESSAGE', args...)
|
||||
|
||||
module.exports = new Ipc
|
||||
|
|
|
@ -82,16 +82,16 @@ void AtomRenderViewObserver::FrameWillClose(WebFrame* frame) {
|
|||
bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
|
||||
IPC_MESSAGE_HANDLER(AtomViewMsg_Message, OnRendererMessage)
|
||||
IPC_MESSAGE_HANDLER(AtomViewMsg_Message, OnBrowserMessage)
|
||||
IPC_MESSAGE_UNHANDLED(handled = false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
void AtomRenderViewObserver::OnRendererMessage(const std::string& channel,
|
||||
const base::ListValue& args) {
|
||||
atom_bindings()->OnRendererMessage(channel, args);
|
||||
void AtomRenderViewObserver::OnBrowserMessage(const std::string& channel,
|
||||
const base::ListValue& args) {
|
||||
atom_bindings()->OnBrowserMessage(channel, args);
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -34,8 +34,8 @@ class AtomRenderViewObserver : content::RenderViewObserver {
|
|||
// content::RenderViewObserver implementation.
|
||||
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
|
||||
|
||||
void OnRendererMessage(const std::string& channel,
|
||||
const base::ListValue& args);
|
||||
void OnBrowserMessage(const std::string& channel,
|
||||
const base::ListValue& args);
|
||||
|
||||
scoped_ptr<AtomRendererBindings> atom_bindings_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue