add option to disable devtools

This commit is contained in:
minggo 2016-09-05 16:27:56 +08:00
parent 02ce727ff6
commit 0d7e7be748
5 changed files with 17 additions and 0 deletions

View file

@ -290,6 +290,9 @@ WebContents::WebContents(v8::Isolate* isolate,
else if (options.Get("offscreen", &b) && b)
type_ = OFF_SCREEN;
// Whether to disable DevTools.
options.Get("disableDevTools", &disable_devtools_);
// Obtain the session.
std::string partition;
mate::Handle<api::Session> session;
@ -940,6 +943,9 @@ void WebContents::OpenDevTools(mate::Arguments* args) {
if (type_ == REMOTE)
return;
if (disable_devtools_)
return;
std::string state;
if (type_ == WEB_VIEW || !owner_window()) {
state = "detach";