Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

method to reset devtools agent host #107

Merged
merged 1 commit into from
May 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions browser/inspectable_web_contents.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include "content/public/browser/web_contents.h"

namespace content {
class DevToolsAgentHost;
}

namespace brightray {

class InspectableWebContentsDelegate;
Expand All @@ -27,6 +31,7 @@ class InspectableWebContents {
// Close the DevTools completely instead of just hide it.
virtual void CloseDevTools() = 0;
virtual bool IsDevToolsViewShowing() = 0;
virtual void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) = 0;

// The delegate manages its own life.
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0;
Expand Down
12 changes: 12 additions & 0 deletions browser/inspectable_web_contents_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ bool InspectableWebContentsImpl::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 {
return devtools_bounds_;
}
Expand Down
3 changes: 3 additions & 0 deletions browser/inspectable_web_contents_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class InspectableWebContentsImpl :
void ShowDevTools() override;
void CloseDevTools() override;
bool IsDevToolsViewShowing() override;
void AttachTo(const scoped_refptr<content::DevToolsAgentHost>&) override;

void Detach();

// Return the last position and size of devtools window.
gfx::Rect GetDevToolsBounds() const;
Expand Down