Provide a way to close devtools completely.
This commit is contained in:
parent
5768ff6981
commit
d2ff5ad798
4 changed files with 13 additions and 3 deletions
|
@ -23,6 +23,8 @@ class InspectableWebContents {
|
|||
virtual content::WebContents* GetWebContents() const = 0;
|
||||
|
||||
virtual void ShowDevTools() = 0;
|
||||
// Close the DevTools completely instead of just hide it.
|
||||
virtual void CloseDevTools() = 0;
|
||||
virtual bool IsDevToolsViewShowing() = 0;
|
||||
|
||||
// The delegate manages its own life.
|
||||
|
|
|
@ -101,6 +101,14 @@ void InspectableWebContentsImpl::ShowDevTools() {
|
|||
view_->ShowDevTools();
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::CloseDevTools() {
|
||||
if (IsDevToolsViewShowing()) {
|
||||
view_->CloseDevTools();
|
||||
devtools_web_contents_.reset();
|
||||
web_contents_->GetView()->Focus();
|
||||
}
|
||||
}
|
||||
|
||||
bool InspectableWebContentsImpl::IsDevToolsViewShowing() {
|
||||
return devtools_web_contents_ && view_->IsDevToolsViewShowing();
|
||||
}
|
||||
|
@ -116,9 +124,7 @@ void InspectableWebContentsImpl::ActivateWindow() {
|
|||
}
|
||||
|
||||
void InspectableWebContentsImpl::CloseWindow() {
|
||||
view_->CloseDevTools();
|
||||
devtools_web_contents_.reset();
|
||||
web_contents_->GetView()->Focus();
|
||||
CloseDevTools();
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::MoveWindow(int x, int y) {
|
||||
|
|
|
@ -42,6 +42,7 @@ class InspectableWebContentsImpl :
|
|||
virtual content::WebContents* GetWebContents() const OVERRIDE;
|
||||
|
||||
virtual void ShowDevTools() OVERRIDE;
|
||||
virtual void CloseDevTools() OVERRIDE;
|
||||
virtual bool IsDevToolsViewShowing() OVERRIDE;
|
||||
|
||||
virtual void SetDelegate(InspectableWebContentsDelegate* delegate) {
|
||||
|
|
|
@ -12,6 +12,7 @@ class InspectableWebContentsView {
|
|||
virtual gfx::NativeView GetNativeView() const = 0;
|
||||
|
||||
virtual void ShowDevTools() = 0;
|
||||
// Hide the DevTools view.
|
||||
virtual void CloseDevTools() = 0;
|
||||
virtual bool IsDevToolsViewShowing() = 0;
|
||||
virtual bool SetDockSide(const std::string& side) = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue