#include "common/v8_value_converter_impl.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/render_process_host.h"
#include "ui/gfx/point.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
}
// static
+v8::Handle<v8::Value> Window::GetRoutingID(const v8::Arguments &args) {
+ Window* self = ObjectWrap::Unwrap<Window>(args.This());
+
+ return v8::Integer::New(self->window_->GetWebContents()->GetRoutingID());
+}
+
+// static
+v8::Handle<v8::Value> Window::GetProcessID(const v8::Arguments &args) {
+ Window* self = ObjectWrap::Unwrap<Window>(args.This());
+
+ return v8::Integer::New(
+ self->window_->GetWebContents()->GetRenderProcessHost()->GetID());
+}
+
+// static
v8::Handle<v8::Value> Window::LoadURL(const v8::Arguments &args) {
Window* self = ObjectWrap::Unwrap<Window>(args.This());
NODE_SET_PROTOTYPE_METHOD(t, "isLoading", IsLoading);
NODE_SET_PROTOTYPE_METHOD(t, "isWaitingForResponse", IsWaitingForResponse);
NODE_SET_PROTOTYPE_METHOD(t, "stop", Stop);
+ NODE_SET_PROTOTYPE_METHOD(t, "getRoutingID", GetRoutingID);
+ NODE_SET_PROTOTYPE_METHOD(t, "getProcessID", GetProcessID);
NODE_SET_PROTOTYPE_METHOD(t, "loadURL", LoadURL);
NODE_SET_PROTOTYPE_METHOD(t, "getURL", GetURL);
static v8::Handle<v8::Value> IsLoading(const v8::Arguments &args);
static v8::Handle<v8::Value> IsWaitingForResponse(const v8::Arguments &args);
static v8::Handle<v8::Value> Stop(const v8::Arguments &args);
+ static v8::Handle<v8::Value> GetRoutingID(const v8::Arguments &args);
+ static v8::Handle<v8::Value> GetProcessID(const v8::Arguments &args);
// APIs for NavigationController.
static v8::Handle<v8::Value> LoadURL(const v8::Arguments &args);
@emit('message', args...)
send: (process_id, routing_id, args...) ->
- send(process_id, routing_id, 'ATOM_INTERNAL_MESSAGE', args...)
+ @sendChannel(process_id, routing_id, 'ATOM_INTERNAL_MESSAGE', args...)
+
+ sendChannel: (args...) ->
+ send(args...)
module.exports = new Ipc
var mainWindow = null;
+// Echo every message back.
ipc.on('message', function(process_id, routing_id) {
- console.log('message from', process_id, routing_id);
ipc.send.apply(ipc, arguments);
});
@emit('message', args...)
send: (args...) ->
- send('ATOM_INTERNAL_MESSAGE', args...)
+ @sendChannel('ATOM_INTERNAL_MESSAGE', args...)
+
+ sendChannel: (args...) ->
+ send(args...)
module.exports = new Ipc