Merge pull request #107 from deepak1556/devtools_patch
method to reset devtools agent host
This commit is contained in:
commit
bf99380c5d
3 changed files with 20 additions and 0 deletions
|
@ -3,6 +3,10 @@
|
||||||
|
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
class DevToolsAgentHost;
|
||||||
|
}
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
class InspectableWebContentsDelegate;
|
class InspectableWebContentsDelegate;
|
||||||
|
@ -27,6 +31,7 @@ class InspectableWebContents {
|
||||||
// Close the DevTools completely instead of just hide it.
|
// Close the DevTools completely instead of just hide it.
|
||||||
virtual void CloseDevTools() = 0;
|
virtual void CloseDevTools() = 0;
|
||||||
virtual bool IsDevToolsViewShowing() = 0;
|
virtual bool IsDevToolsViewShowing() = 0;
|
||||||
|
virtual void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) = 0;
|
||||||
|
|
||||||
// The delegate manages its own life.
|
// The delegate manages its own life.
|
||||||
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0;
|
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0;
|
||||||
|
|
|
@ -188,6 +188,18 @@ bool InspectableWebContentsImpl::IsDevToolsViewShowing() {
|
||||||
return devtools_web_contents_ && view_->IsDevToolsViewShowing();
|
return devtools_web_contents_ && view_->IsDevToolsViewShowing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InspectableWebContentsImpl::AttachTo(const scoped_refptr<content::DevToolsAgentHost>& host) {
|
||||||
|
if (agent_host_.get())
|
||||||
|
Detach();
|
||||||
|
agent_host_ = host;
|
||||||
|
agent_host_->AttachClient(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InspectableWebContentsImpl::Detach() {
|
||||||
|
agent_host_->DetachClient();
|
||||||
|
agent_host_ = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
gfx::Rect InspectableWebContentsImpl::GetDevToolsBounds() const {
|
gfx::Rect InspectableWebContentsImpl::GetDevToolsBounds() const {
|
||||||
return devtools_bounds_;
|
return devtools_bounds_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,9 @@ class InspectableWebContentsImpl :
|
||||||
void ShowDevTools() override;
|
void ShowDevTools() override;
|
||||||
void CloseDevTools() override;
|
void CloseDevTools() override;
|
||||||
bool IsDevToolsViewShowing() override;
|
bool IsDevToolsViewShowing() override;
|
||||||
|
void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) override;
|
||||||
|
|
||||||
|
void Detach();
|
||||||
|
|
||||||
// Return the last position and size of devtools window.
|
// Return the last position and size of devtools window.
|
||||||
gfx::Rect GetDevToolsBounds() const;
|
gfx::Rect GetDevToolsBounds() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue