]> khamidou — GitHub mirrors - electron.git/commitdiff
Add BrowserWindow.isDevToolsFocused
authorCheng Zhao <zcbenz@gmail.com>
Tue, 15 Sep 2015 03:27:32 +0000 (11:27 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 15 Sep 2015 03:43:45 +0000 (11:43 +0800)
atom/browser/api/atom_api_window.cc
atom/browser/api/atom_api_window.h
atom/browser/native_window.cc
atom/browser/native_window.h

index ede6bcd71e6b3d227fa1164d0462f736dfe459b5..1a76c3e5f0788231ea3910d7479d83dd671d7f9c 100644 (file)
@@ -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)
index 4384e03a249f7fb651c361a323efb0f34385d9ab..d60bf0d87ea0360684eecdf5116750c401745101 100644 (file)
@@ -124,6 +124,7 @@ class Window : public mate::TrackableObject<Window>,
   void FocusOnWebView();
   void BlurWebView();
   bool IsWebViewFocused();
+  bool IsDevToolsFocused();
   void SetRepresentedFilename(const std::string& filename);
   std::string GetRepresentedFilename();
   void SetDocumentEdited(bool edited);
index 997fe72c4ae7bc6919dfc53e8ba22ead6fdb5467..f40f7de8dbc3df84c11ef6193b6d913b4e34aa06 100644 (file)
@@ -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();
index b89e2b58e6e47eb07bbe225ebfe56e393049fc14..f09845aad34876ad6aaed53357705c5d463130bd 100644 (file)
@@ -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.