From 97857aa152e12ed5f2044edf53b23ed6992c2b0d Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 15 Sep 2015 11:26:55 +0800 Subject: [PATCH 1/4] Update brightray for DevToolsFocused fix --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 1cfc13fec13..1c12c823237 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 1cfc13fec13a36f3682ee702c32dc2cf22363143 +Subproject commit 1c12c82323769f677c0c487c910575f1f487637d From b72a5884f2147b010dd563d1a05efe65b9132f4f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 15 Sep 2015 11:27:32 +0800 Subject: [PATCH 2/4] Add BrowserWindow.isDevToolsFocused --- atom/browser/api/atom_api_window.cc | 5 +++++ atom/browser/api/atom_api_window.h | 1 + atom/browser/native_window.cc | 4 ++++ atom/browser/native_window.h | 1 + 4 files changed, 11 insertions(+) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index ede6bcd71e6..1a76c3e5f07 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -414,6 +414,10 @@ bool Window::IsWebViewFocused() { return window_->IsWebViewFocused(); } +bool Window::IsDevToolsFocused() { + return window_->IsDevToolsFocused(); +} + void Window::SetRepresentedFilename(const std::string& filename) { window_->SetRepresentedFilename(filename); } @@ -591,6 +595,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetMethod("focusOnWebView", &Window::FocusOnWebView) .SetMethod("blurWebView", &Window::BlurWebView) .SetMethod("isWebViewFocused", &Window::IsWebViewFocused) + .SetMethod("isDevToolsFocused", &Window::IsDevToolsFocused) .SetMethod("capturePage", &Window::CapturePage) .SetMethod("setProgressBar", &Window::SetProgressBar) .SetMethod("setOverlayIcon", &Window::SetOverlayIcon) diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 4384e03a249..d60bf0d87ea 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -124,6 +124,7 @@ class Window : public mate::TrackableObject, void FocusOnWebView(); void BlurWebView(); bool IsWebViewFocused(); + bool IsDevToolsFocused(); void SetRepresentedFilename(const std::string& filename); std::string GetRepresentedFilename(); void SetDocumentEdited(bool edited); diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 997fe72c4ae..f40f7de8dbc 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -249,6 +249,10 @@ bool NativeWindow::IsWebViewFocused() { return host_view && host_view->HasFocus(); } +bool NativeWindow::IsDevToolsFocused() { + return inspectable_web_contents_->GetView()->IsDevToolsViewFocused(); +} + void NativeWindow::CapturePage(const gfx::Rect& rect, const CapturePageCallback& callback) { const auto view = web_contents()->GetRenderWidgetHostView(); diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index b89e2b58e6e..f09845aad34 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -148,6 +148,7 @@ class NativeWindow : public content::WebContentsObserver, virtual void FocusOnWebView(); virtual void BlurWebView(); virtual bool IsWebViewFocused(); + virtual bool IsDevToolsFocused(); // Captures the page with |rect|, |callback| would be called when capturing is // done. From c9ee6b4caf03b104a83b28ad9360d7f6fac647c5 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 15 Sep 2015 11:43:04 +0800 Subject: [PATCH 3/4] docs: BrowserWindow.isDevToolsFocused --- docs/api/browser-window.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index a9f046774af..f0119700f2c 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -613,7 +613,11 @@ Returns whether the developer tools are opened. ### `win.toggleDevTools()` -Toggle the developer tools. +Toggles the developer tools. + +### `win.isDevToolsFocused()` + +Returns whether the developer tools is focused. ### `win.inspectElement(x, y)` From 2a3a65f67c898a6569a16b233468d6e41cdf7159 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 15 Sep 2015 12:08:17 +0800 Subject: [PATCH 4/4] Update brightray to use 10.10 SDK --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 1c12c823237..41f5c2caeaa 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 1c12c82323769f677c0c487c910575f1f487637d +Subproject commit 41f5c2caeaa246b2d4ede37dc49345e313b19b5a