#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
-#include "atom/browser/atom_javascript_dialog_manager.h"
-#include "brightray/browser/inspectable_web_contents.h"
#include "base/strings/utf_string_conversions.h"
+#include "brightray/browser/inspectable_web_contents.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
storage_->ShowDevTools();
}
+void WebContents::CloseDevTools() {
+ storage_->CloseDevTools();
+}
+
+bool WebContents::IsDevToolsOpened() {
+ return storage_->IsDevToolsViewShowing();
+}
+
bool WebContents::SendIPCMessage(const base::string16& channel,
const base::ListValue& args) {
return Send(new AtomViewMsg_Message(routing_id(), channel, args));
.SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency)
.SetMethod("isGuest", &WebContents::is_guest)
.SetMethod("openDevTools", &WebContents::OpenDevTools)
+ .SetMethod("closeDevTools", &WebContents::CloseDevTools)
+ .SetMethod("isDevToolsOpened", &WebContents::IsDevToolsOpened)
.Build());
return mate::ObjectTemplateBuilder(
#include <string>
#include "atom/browser/api/event_emitter.h"
+#include "brightray/browser/default_web_contents_delegate.h"
#include "content/public/browser/browser_plugin_guest_delegate.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
-#include "brightray/browser/default_web_contents_delegate.h"
#include "native_mate/handle.h"
-namespace mate {
-class Dictionary;
-}
-
namespace brightray {
class InspectableWebContents;
}
+namespace mate {
+class Dictionary;
+}
+
namespace atom {
namespace api {
void InsertCSS(const std::string& css);
void ExecuteJavaScript(const base::string16& code);
void OpenDevTools();
+ void CloseDevTools();
+ bool IsDevToolsOpened();
bool SendIPCMessage(const base::string16& channel,
const base::ListValue& args);
* `code` String
-Evaluate `code` in guest page.
+Evaluates `code` in guest page.
### `<webview>`.openDevTools()
-Open a devtools instance for the webview's contents.
+Opens a devtools window for guest page.
+
+### `<webview>`.closeDevTools()
+
+Closes the devtools window of guest page.
+
+### `<webview>`.isDevToolsOpened()
+
+Returns whether guest page has a devtools window attached.
### `<webview>`.send(channel[, args...])