Make the devtools close button work

This commit is contained in:
Adam Roben 2013-03-27 10:59:40 -04:00
parent d20ecc0e2b
commit 001d0197de
4 changed files with 10 additions and 1 deletions

View file

@ -13,6 +13,7 @@
#include "content/public/browser/devtools_client_host.h" #include "content/public/browser/devtools_client_host.h"
#include "content/public/browser/devtools_http_handler.h" #include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_manager.h" #include "content/public/browser/devtools_manager.h"
#include "content/public/browser/web_contents_view.h"
namespace brightray { namespace brightray {
@ -60,6 +61,9 @@ void InspectableWebContentsImpl::ChangeAttachedWindowHeight(unsigned height) {
} }
void InspectableWebContentsImpl::CloseWindow() { void InspectableWebContentsImpl::CloseWindow() {
view_->CloseDevTools();
devtools_web_contents_.reset();
web_contents_->GetView()->Focus();
} }
void InspectableWebContentsImpl::MoveWindow(int x, int y) { void InspectableWebContentsImpl::MoveWindow(int x, int y) {
@ -99,7 +103,6 @@ void InspectableWebContentsImpl::WebContentsDestroyed(content::WebContents*) {
Observe(nullptr); Observe(nullptr);
agent_host_ = nullptr; agent_host_ = nullptr;
frontend_host_.reset(); frontend_host_.reset();
devtools_web_contents_.reset();
} }
void InspectableWebContentsImpl::HandleKeyboardEvent(content::WebContents* source, const content::NativeWebKeyboardEvent& event) { void InspectableWebContentsImpl::HandleKeyboardEvent(content::WebContents* source, const content::NativeWebKeyboardEvent& event) {

View file

@ -12,6 +12,7 @@ public:
virtual gfx::NativeView GetNativeView() const = 0; virtual gfx::NativeView GetNativeView() const = 0;
virtual void ShowDevTools() = 0; virtual void ShowDevTools() = 0;
virtual void CloseDevTools() = 0;
}; };
} }

View file

@ -17,6 +17,7 @@ public:
virtual gfx::NativeView GetNativeView() const OVERRIDE; virtual gfx::NativeView GetNativeView() const OVERRIDE;
virtual void ShowDevTools() OVERRIDE; virtual void ShowDevTools() OVERRIDE;
virtual void CloseDevTools() OVERRIDE;
InspectableWebContentsImpl* inspectable_web_contents() { return inspectable_web_contents_; } InspectableWebContentsImpl* inspectable_web_contents() { return inspectable_web_contents_; }

View file

@ -25,4 +25,8 @@ void InspectableWebContentsViewMac::ShowDevTools() {
[view_ setDevToolsVisible:YES]; [view_ setDevToolsVisible:YES];
} }
void InspectableWebContentsViewMac::CloseDevTools() {
[view_ setDevToolsVisible:NO];
}
} }