browserWindow: adding devtools-focused event
This commit is contained in:
parent
ce3d9f44ff
commit
3aefa5f549
6 changed files with 17 additions and 0 deletions
|
@ -139,6 +139,10 @@ void Window::OnRendererResponsive() {
|
|||
Emit("responsive");
|
||||
}
|
||||
|
||||
void Window::OnDevToolsFocus() {
|
||||
Emit("devtools-focused");
|
||||
}
|
||||
|
||||
// static
|
||||
mate::Wrappable* Window::New(v8::Isolate* isolate,
|
||||
const mate::Dictionary& options) {
|
||||
|
|
|
@ -64,6 +64,7 @@ class Window : public mate::EventEmitter,
|
|||
void OnWindowLeaveFullScreen() override;
|
||||
void OnRendererUnresponsive() override;
|
||||
void OnRendererResponsive() override;
|
||||
void OnDevToolsFocus() override;
|
||||
|
||||
private:
|
||||
// APIs for NativeWindow.
|
||||
|
|
|
@ -762,6 +762,10 @@ void NativeWindow::DevToolsAppendToFile(const std::string& url,
|
|||
CallDevToolsFunction("DevToolsAPI.appendedToURL", &url_value);
|
||||
}
|
||||
|
||||
void NativeWindow::DevToolsFocused() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsFocus());
|
||||
}
|
||||
|
||||
void NativeWindow::ScheduleUnresponsiveEvent(int ms) {
|
||||
if (!window_unresposive_closure_.IsCancelled())
|
||||
return;
|
||||
|
|
|
@ -290,6 +290,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
bool save_as) override;
|
||||
void DevToolsAppendToFile(const std::string& url,
|
||||
const std::string& content) override;
|
||||
void DevToolsFocused() override;
|
||||
|
||||
// Whether window has standard frame.
|
||||
bool has_frame_;
|
||||
|
|
|
@ -50,6 +50,9 @@ class NativeWindowObserver {
|
|||
virtual void OnWindowEnterFullScreen() {}
|
||||
virtual void OnWindowLeaveFullScreen() {}
|
||||
|
||||
// Called when devtools window gets focused.
|
||||
virtual void OnDevToolsFocus() {}
|
||||
|
||||
// Called when renderer is hung.
|
||||
virtual void OnRendererUnresponsive() {}
|
||||
|
||||
|
|
|
@ -184,6 +184,10 @@ Emitted when devtools is opened.
|
|||
|
||||
Emitted when devtools is closed.
|
||||
|
||||
### Event: 'devtools-focused'
|
||||
|
||||
Emitted when devtools is focused / opened.
|
||||
|
||||
### Class Method: BrowserWindow.getAllWindows()
|
||||
|
||||
Returns an array of all opened browser windows.
|
||||
|
|
Loading…
Reference in a new issue