args.GetReturnValue().Set(self->window_->GetWebContents()->IsCrashed());
}
+// static
+void Window::GetDevTools(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ UNWRAP_WINDOW_AND_CHECK;
+
+ content::WebContents* web_contents = self->window_->GetDevToolsWebContents();
+ v8::Local<v8::Object> devtools = v8::Object::New();
+ devtools->Set(ToV8Value("processId"),
+ ToV8Value(web_contents->GetRenderProcessHost()->GetID()));
+ devtools->Set(ToV8Value("routingId"),
+ ToV8Value(web_contents->GetRoutingID()));
+ args.GetReturnValue().Set(devtools);
+}
+
// static
void Window::LoadURL(const v8::FunctionCallbackInfo<v8::Value>& args) {
UNWRAP_WINDOW_AND_CHECK;
NODE_SET_PROTOTYPE_METHOD(t, "getProcessId", GetProcessID);
NODE_SET_PROTOTYPE_METHOD(t, "isCrashed", IsCrashed);
+ NODE_SET_PROTOTYPE_METHOD(t, "getDevTools", GetDevTools);
+
NODE_SET_PROTOTYPE_METHOD(t, "loadUrl", LoadURL);
NODE_SET_PROTOTYPE_METHOD(t, "getUrl", GetURL);
NODE_SET_PROTOTYPE_METHOD(t, "canGoBack", CanGoBack);
static void GetProcessID(const v8::FunctionCallbackInfo<v8::Value>& args);
static void IsCrashed(const v8::FunctionCallbackInfo<v8::Value>& args);
+ // APIs for devtools.
+ static void GetDevTools(const v8::FunctionCallbackInfo<v8::Value>& args);
+
// APIs for NavigationController.
static void LoadURL(const v8::FunctionCallbackInfo<v8::Value>& args);
static void GetURL(const v8::FunctionCallbackInfo<v8::Value>& args);
return window for window in windows when window.getProcessId() == processId and
window.getRoutingId() == routingId
+BrowserWindow.fromDevTools = (processId, routingId) ->
+ windows = BrowserWindow.getAllWindows()
+ for window in windows
+ devtools = window.getDevTools()
+ return window if devtools.processId == processId and
+ devtools.routingId == routingId
+
module.exports = BrowserWindow