}
void DevToolsDelegate::InspectedContentsClosing() {
- owner_window_->CloseImmediately();
+ delete owner_window_;
}
void DevToolsDelegate::AboutToNavigateRenderView(
owner_window_->GetWebContents()->GetRenderViewHost());
}
+void DevToolsDelegate::OnWindowClosed() {
+ delete owner_window_;
+}
+
} // namespace atom
#define ATOM_BROWSER_DEVTOOLS_DELEGATE_H_
#include "base/memory/scoped_ptr.h"
+#include "browser/native_window_observer.h"
#include "content/public/browser/devtools_frontend_host_delegate.h"
#include "content/public/browser/web_contents_observer.h"
class NativeWindow;
class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
- public content::WebContentsObserver {
+ public content::WebContentsObserver,
+ public NativeWindowObserver {
public:
DevToolsDelegate(NativeWindow* window,
content::WebContents* target_web_contents);
virtual void AboutToNavigateRenderView(
content::RenderViewHost* render_view_host) OVERRIDE;
+ // Implementations of NativeWindowObserver.
+ virtual void OnWindowClosed() OVERRIDE;
+
private:
NativeWindow* owner_window_;
agent->InspectElement(x, y);
}
-scoped_ptr<NativeWindow> NativeWindow::DebugDevTools() {
- scoped_ptr<NativeWindow> window;
- if (IsDevToolsOpened()) {
- base::DictionaryValue options;
- window.reset(NativeWindow::Create(&options));
- window->devtools_delegate_.reset(new DevToolsDelegate(
- window.get(), GetDevToolsWebContents()));
- }
+void NativeWindow::DebugDevTools() {
+ if (!IsDevToolsOpened())
+ return;
- return window.Pass();
+ base::DictionaryValue options;
+ NativeWindow* window = NativeWindow::Create(&options);
+ window->devtools_delegate_.reset(new DevToolsDelegate(
+ window, GetDevToolsWebContents()));
}
void NativeWindow::FocusOnWebView() {
virtual void InspectElement(int x, int y);
// Creates a new window to debug the devtools.
- virtual scoped_ptr<NativeWindow> DebugDevTools();
+ virtual void DebugDevTools();
virtual void FocusOnWebView();
virtual void BlurWebView();