Allow using docked devtools for webview
This commit is contained in:
parent
ea9771702b
commit
6b408de884
2 changed files with 8 additions and 4 deletions
|
@ -895,10 +895,10 @@ void WebContents::DevToolsOpened() {
|
||||||
managed_web_contents()->CallClientFunction(
|
managed_web_contents()->CallClientFunction(
|
||||||
"DevToolsAPI.setInspectedTabId", &tab_id, nullptr, nullptr);
|
"DevToolsAPI.setInspectedTabId", &tab_id, nullptr, nullptr);
|
||||||
|
|
||||||
// Inherit owner window in devtools.
|
// Inherit owner window in devtools when it doesn't have one.
|
||||||
auto* devtools = managed_web_contents()->GetDevToolsWebContents();
|
auto* devtools = managed_web_contents()->GetDevToolsWebContents();
|
||||||
if (owner_window() &&
|
bool has_window = devtools->GetUserData(NativeWindowRelay::UserDataKey());
|
||||||
!devtools->GetUserData(NativeWindowRelay::UserDataKey()))
|
if (owner_window() && !has_window)
|
||||||
handle->SetOwnerWindow(devtools, owner_window());
|
handle->SetOwnerWindow(devtools, owner_window());
|
||||||
|
|
||||||
Emit("devtools-opened");
|
Emit("devtools-opened");
|
||||||
|
@ -1179,7 +1179,8 @@ void WebContents::OpenDevTools(mate::Arguments* args) {
|
||||||
std::string state;
|
std::string state;
|
||||||
if (type_ == WEB_VIEW || !owner_window()) {
|
if (type_ == WEB_VIEW || !owner_window()) {
|
||||||
state = "detach";
|
state = "detach";
|
||||||
} else if (args && args->Length() == 1) {
|
}
|
||||||
|
if (args && args->Length() == 1) {
|
||||||
bool detach = false;
|
bool detach = false;
|
||||||
mate::Dictionary options;
|
mate::Dictionary options;
|
||||||
if (args->GetNext(&options)) {
|
if (args->GetNext(&options)) {
|
||||||
|
|
|
@ -1144,6 +1144,9 @@ app.once('ready', () => {
|
||||||
|
|
||||||
Opens the devtools.
|
Opens the devtools.
|
||||||
|
|
||||||
|
When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
|
||||||
|
explicitly passing an empty `mode` can force using last used dock state.
|
||||||
|
|
||||||
#### `contents.closeDevTools()`
|
#### `contents.closeDevTools()`
|
||||||
|
|
||||||
Closes the devtools.
|
Closes the devtools.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue