window_->InspectElement(x, y);
}
+void Window::InspectServiceWorker() {
+ window_->InspectServiceWorker();
+}
+
void Window::FocusOnWebView() {
window_->FocusOnWebView();
}
&Window::ShowDefinitionForSelection)
#endif
.SetMethod("_getWebContents", &Window::GetWebContents)
- .SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents);
+ .SetMethod("_getDevToolsWebContents", &Window::GetDevToolsWebContents)
+ .SetMethod("inspectServiceWorker", &Window::InspectServiceWorker);
}
} // namespace api
void CloseDevTools();
bool IsDevToolsOpened();
void InspectElement(int x, int y);
+ void InspectServiceWorker();
void FocusOnWebView();
void BlurWebView();
bool IsWebViewFocused();
agent->InspectElement(x, y);
}
+void NativeWindow::InspectServiceWorker() {
+ for (const auto& agent_host : content::DevToolsAgentHost::GetOrCreateAll()) {
+ if (agent_host->GetType() ==
+ content::DevToolsAgentHost::TYPE_SERVICE_WORKER) {
+ OpenDevTools(true);
+ inspectable_web_contents()->AttachTo(agent_host);
+ break;
+ }
+ }
+}
+
void NativeWindow::FocusOnWebView() {
GetWebContents()->GetRenderViewHost()->Focus();
}
virtual void CloseDevTools();
virtual bool IsDevToolsOpened();
virtual void InspectElement(int x, int y);
+ virtual void InspectServiceWorker();
virtual void FocusOnWebView();
virtual void BlurWebView();
Starts inspecting element at position (`x`, `y`).
+### BrowserWindow.inspectServiceWorker()
+
+Opens the developer tools for the service worker context present in the web contents.
+
### BrowserWindow.focusOnWebView()
### BrowserWindow.blurWebView()