Inherit owner window in devtools
This commit is contained in:
parent
1045bbc861
commit
ca40ea8e2f
3 changed files with 12 additions and 1 deletions
|
@ -506,6 +506,11 @@ void WebContents::DevToolsOpened() {
|
||||||
isolate(), managed_web_contents()->GetDevToolsWebContents());
|
isolate(), managed_web_contents()->GetDevToolsWebContents());
|
||||||
devtools_web_contents_.Reset(isolate(), handle.ToV8());
|
devtools_web_contents_.Reset(isolate(), handle.ToV8());
|
||||||
|
|
||||||
|
// Inherit owner window in devtools.
|
||||||
|
if (owner_window())
|
||||||
|
handle->SetOwnerWindow(managed_web_contents()->GetDevToolsWebContents(),
|
||||||
|
owner_window());
|
||||||
|
|
||||||
Emit("devtools-opened");
|
Emit("devtools-opened");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,11 @@ void CommonWebContentsDelegate::InitWithWebContents(
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
|
void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) {
|
||||||
content::WebContents* web_contents = GetWebContents();
|
SetOwnerWindow(GetWebContents(), owner_window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommonWebContentsDelegate::SetOwnerWindow(
|
||||||
|
content::WebContents* web_contents, NativeWindow* owner_window) {
|
||||||
owner_window_ = owner_window->GetWeakPtr();
|
owner_window_ = owner_window->GetWeakPtr();
|
||||||
NativeWindowRelay* relay = new NativeWindowRelay(owner_window_);
|
NativeWindowRelay* relay = new NativeWindowRelay(owner_window_);
|
||||||
web_contents->SetUserData(relay->key, relay);
|
web_contents->SetUserData(relay->key, relay);
|
||||||
|
|
|
@ -34,6 +34,8 @@ class CommonWebContentsDelegate
|
||||||
|
|
||||||
// Set the window as owner window.
|
// Set the window as owner window.
|
||||||
void SetOwnerWindow(NativeWindow* owner_window);
|
void SetOwnerWindow(NativeWindow* owner_window);
|
||||||
|
void SetOwnerWindow(content::WebContents* web_contents,
|
||||||
|
NativeWindow* owner_window);
|
||||||
|
|
||||||
// Destroy the managed InspectableWebContents object.
|
// Destroy the managed InspectableWebContents object.
|
||||||
void DestroyWebContents();
|
void DestroyWebContents();
|
||||||
|
|
Loading…
Add table
Reference in a new issue