From 3fdc99c3c66268147097992eb970d0d74e91aa42 Mon Sep 17 00:00:00 2001 From: minggo Date: Wed, 7 Sep 2016 10:16:52 +0800 Subject: [PATCH] change the option name to devTools --- atom/browser/api/atom_api_web_contents.cc | 14 +++++++------- atom/browser/api/atom_api_web_contents.h | 4 ++-- docs/api/browser-window.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 508ccf9c31b7..7a66c56d3060 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -262,7 +262,7 @@ WebContents::WebContents(v8::Isolate* isolate, type_(REMOTE), request_id_(0), background_throttling_(true), - disable_devtools_(false) { + enable_devtools_(true) { web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent()); Init(isolate); @@ -275,7 +275,7 @@ WebContents::WebContents(v8::Isolate* isolate, type_(BROWSER_WINDOW), request_id_(0), background_throttling_(true), - disable_devtools_(false) { + enable_devtools_(true) { // Read options. options.Get("backgroundThrottling", &background_throttling_); @@ -292,8 +292,8 @@ WebContents::WebContents(v8::Isolate* isolate, else if (options.Get("offscreen", &b) && b) type_ = OFF_SCREEN; - // Whether to disable DevTools. - options.Get("disableDevTools", &disable_devtools_); + // Whether to enable DevTools. + options.Get("devTools", &enable_devtools_); // Obtain the session. std::string partition; @@ -945,7 +945,7 @@ void WebContents::OpenDevTools(mate::Arguments* args) { if (type_ == REMOTE) return; - if (disable_devtools_) + if (!enable_devtools_) return; std::string state; @@ -1012,7 +1012,7 @@ void WebContents::InspectElement(int x, int y) { if (type_ == REMOTE) return; - if (disable_devtools_) + if (!enable_devtools_) return; if (!managed_web_contents()->GetDevToolsWebContents()) @@ -1026,7 +1026,7 @@ void WebContents::InspectServiceWorker() { if (type_ == REMOTE) return; - if (disable_devtools_) + if (!enable_devtools_) return; for (const auto& agent_host : content::DevToolsAgentHost::GetOrCreateAll()) { diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 205f245ef5e7..aa78ec9ae80d 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -323,8 +323,8 @@ class WebContents : public mate::TrackableObject, // Whether background throttling is disabled. bool background_throttling_; - // Whether to disable devtools. - bool disable_devtools_; + // Whether to enable devtools. + bool enable_devtools_; DISALLOW_COPY_AND_ASSIGN(WebContents); }; diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index c45cf21506fc..e9452fbb63b5 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -225,7 +225,7 @@ Possible values of the `titleBarStyle` option are: The `webPreferences` option is an object that can have the following properties: -* `disableDevTools` Boolean - Whether to disable DevTools. If it is set to `true`, can not use `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `false`. +* `devTools` Boolean - Whether to enable DevTools. If it is set to `false`, can not use `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`. * `nodeIntegration` Boolean - Whether node integration is enabled. Default is `true`. * `preload` String - Specifies a script that will be loaded before other