Add isDevToolsFocused to webview

This commit is contained in:
Cheng Zhao 2016-01-04 10:46:30 +08:00
parent 4cdee5547f
commit 14db4a1946
7 changed files with 12 additions and 14 deletions

View file

@ -468,10 +468,6 @@ bool Window::IsWebViewFocused() {
return window_->IsWebViewFocused(); return window_->IsWebViewFocused();
} }
bool Window::IsDevToolsFocused() {
return window_->IsDevToolsFocused();
}
void Window::SetRepresentedFilename(const std::string& filename) { void Window::SetRepresentedFilename(const std::string& filename) {
window_->SetRepresentedFilename(filename); window_->SetRepresentedFilename(filename);
} }
@ -670,7 +666,6 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("focusOnWebView", &Window::FocusOnWebView) .SetMethod("focusOnWebView", &Window::FocusOnWebView)
.SetMethod("blurWebView", &Window::BlurWebView) .SetMethod("blurWebView", &Window::BlurWebView)
.SetMethod("isWebViewFocused", &Window::IsWebViewFocused) .SetMethod("isWebViewFocused", &Window::IsWebViewFocused)
.SetMethod("isDevToolsFocused", &Window::IsDevToolsFocused)
.SetMethod("capturePage", &Window::CapturePage) .SetMethod("capturePage", &Window::CapturePage)
.SetMethod("setProgressBar", &Window::SetProgressBar) .SetMethod("setProgressBar", &Window::SetProgressBar)
.SetMethod("setOverlayIcon", &Window::SetOverlayIcon) .SetMethod("setOverlayIcon", &Window::SetOverlayIcon)

View file

@ -121,7 +121,6 @@ class Window : public mate::TrackableObject<Window>,
void FocusOnWebView(); void FocusOnWebView();
void BlurWebView(); void BlurWebView();
bool IsWebViewFocused(); bool IsWebViewFocused();
bool IsDevToolsFocused();
void SetRepresentedFilename(const std::string& filename); void SetRepresentedFilename(const std::string& filename);
std::string GetRepresentedFilename(); std::string GetRepresentedFilename();
void SetDocumentEdited(bool edited); void SetDocumentEdited(bool edited);

View file

@ -268,10 +268,6 @@ bool NativeWindow::IsWebViewFocused() {
return host_view && host_view->HasFocus(); return host_view && host_view->HasFocus();
} }
bool NativeWindow::IsDevToolsFocused() {
return inspectable_web_contents_->GetView()->IsDevToolsViewFocused();
}
void NativeWindow::CapturePage(const gfx::Rect& rect, void NativeWindow::CapturePage(const gfx::Rect& rect,
const CapturePageCallback& callback) { const CapturePageCallback& callback) {
const auto view = web_contents()->GetRenderWidgetHostView(); const auto view = web_contents()->GetRenderWidgetHostView();

View file

@ -157,7 +157,6 @@ class NativeWindow : public base::SupportsUserData,
virtual void FocusOnWebView(); virtual void FocusOnWebView();
virtual void BlurWebView(); virtual void BlurWebView();
virtual bool IsWebViewFocused(); virtual bool IsWebViewFocused();
virtual bool IsDevToolsFocused();
// Captures the page with |rect|, |callback| would be called when capturing is // Captures the page with |rect|, |callback| would be called when capturing is
// done. // done.

View file

@ -273,6 +273,7 @@ registerWebViewElement = ->
'openDevTools' 'openDevTools'
'closeDevTools' 'closeDevTools'
'isDevToolsOpened' 'isDevToolsOpened'
'isDevToolsFocused'
'inspectElement' 'inspectElement'
'setAudioMuted' 'setAudioMuted'
'isAudioMuted' 'isAudioMuted'

View file

@ -596,15 +596,19 @@ Removes the specified path from DevTools workspace.
* `options` Object (optional). Properties: * `options` Object (optional). Properties:
* `detach` Boolean - opens DevTools in a new window * `detach` Boolean - opens DevTools in a new window
Opens the developer tools. Opens the devtools.
### `webContents.closeDevTools()` ### `webContents.closeDevTools()`
Closes the developer tools. Closes the devtools.
### `webContents.isDevToolsOpened()` ### `webContents.isDevToolsOpened()`
Returns whether the developer tools are opened. Returns whether the devtools is opened.
### `webContents.isDevToolsFocused()`
Returns whether the devtools view is focused .
### `webContents.toggleDevTools()` ### `webContents.toggleDevTools()`

View file

@ -279,6 +279,10 @@ Closes the DevTools window of guest page.
Returns a boolean whether guest page has a DevTools window attached. Returns a boolean whether guest page has a DevTools window attached.
### `<webview>.isDevToolsFocused()`
Returns a boolean whether DevTools window of guest page is focused.
### `<webview>.inspectElement(x, y)` ### `<webview>.inspectElement(x, y)`
* `x` Integer * `x` Integer