Merge pull request #2785 from atom/fix-devtools-extension
Add BrowserWindow.isDevToolsFocused and fix "devtools-focused" not working
This commit is contained in:
commit
3cf34fe40f
6 changed files with 17 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)`
|
||||
|
||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 1cfc13fec13a36f3682ee702c32dc2cf22363143
|
||||
Subproject commit 41f5c2caeaa246b2d4ede37dc49345e313b19b5a
|
Loading…
Reference in a new issue