#include "content/public/browser/devtools_http_handler.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/web_contents.h"
+#include "ui/gfx/point.h"
namespace atom {
DevToolsDelegate::DevToolsDelegate(NativeWindow* window,
content::WebContents* target_web_contents)
: content::WebContentsObserver(window->GetWebContents()),
- owner_window_(window) {
+ owner_window_(window),
+ embedder_message_dispatcher_(
+ new DevToolsEmbedderMessageDispatcher(this)) {
content::WebContents* web_contents = window->GetWebContents();
// Setup devtools.
options.SetString("title", "DevTools Debugger");
window->InitFromOptions(&options);
web_contents->GetController().LoadURL(
- GURL("chrome-devtools://devtools/devtools.html"),
+ GURL("chrome-devtools://devtools/devtools.html?dockSide=undocked"),
content::Referrer(),
content::PAGE_TRANSITION_AUTO_TOPLEVEL,
std::string());
}
void DevToolsDelegate::DispatchOnEmbedder(const std::string& message) {
+ embedder_message_dispatcher_->Dispatch(message);
}
void DevToolsDelegate::InspectedContentsClosing() {
delete owner_window_;
}
+void DevToolsDelegate::ActivateWindow() {
+}
+
+void DevToolsDelegate::CloseWindow() {
+ owner_window_->Close();
+}
+
+void DevToolsDelegate::MoveWindow(int x, int y) {
+ owner_window_->SetPosition(gfx::Point(x, y));
+}
+
+void DevToolsDelegate::SetDockSide(const std::string& dock_side) {
+ if (dock_side != "undocked")
+ owner_window_->Close();
+}
+
+void DevToolsDelegate::OpenInNewTab(const std::string& url) {
+}
+
+void DevToolsDelegate::SaveToFile(
+ const std::string& url, const std::string& content, bool save_as) {
+}
+
+void DevToolsDelegate::AppendToFile(
+ const std::string& url, const std::string& content) {
+}
+
+void DevToolsDelegate::RequestFileSystems() {
+}
+
+void DevToolsDelegate::AddFileSystem() {
+}
+
+void DevToolsDelegate::RemoveFileSystem(const std::string& file_system_path) {
+}
+
+void DevToolsDelegate::IndexPath(
+ int request_id, const std::string& file_system_path) {
+}
+
+void DevToolsDelegate::StopIndexing(int request_id) {
+}
+
+void DevToolsDelegate::SearchInPath(
+ int request_id,
+ const std::string& file_system_path,
+ const std::string& query) {
+}
+
} // namespace atom
#include "browser/native_window_observer.h"
#include "content/public/browser/devtools_frontend_host_delegate.h"
#include "content/public/browser/web_contents_observer.h"
+#include "vendor/brightray/browser/devtools_embedder_message_dispatcher.h"
namespace content {
class DevToolsAgentHost;
class DevToolsClientHost;
}
+using brightray::DevToolsEmbedderMessageDispatcher;
+
namespace atom {
class NativeWindow;
class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
public content::WebContentsObserver,
- public NativeWindowObserver {
+ public NativeWindowObserver,
+ public DevToolsEmbedderMessageDispatcher::Delegate {
public:
DevToolsDelegate(NativeWindow* window,
content::WebContents* target_web_contents);
// Implementations of NativeWindowObserver.
virtual void OnWindowClosed() OVERRIDE;
+ // Implementations of DevToolsEmbedderMessageDispatcher::Delegate.
+ virtual void ActivateWindow() OVERRIDE;
+ virtual void CloseWindow() OVERRIDE;
+ virtual void MoveWindow(int x, int y) OVERRIDE;
+ virtual void SetDockSide(const std::string& dock_side) OVERRIDE;
+ virtual void OpenInNewTab(const std::string& url) OVERRIDE;
+ virtual void SaveToFile(const std::string& url,
+ const std::string& content,
+ bool save_as) OVERRIDE;
+ virtual void AppendToFile(const std::string& url,
+ const std::string& content) OVERRIDE;
+ virtual void RequestFileSystems() OVERRIDE;
+ virtual void AddFileSystem() OVERRIDE;
+ virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE;
+ virtual void IndexPath(int request_id,
+ const std::string& file_system_path) OVERRIDE;
+ virtual void StopIndexing(int request_id) OVERRIDE;
+ virtual void SearchInPath(int request_id,
+ const std::string& file_system_path,
+ const std::string& query) OVERRIDE;
+
private:
NativeWindow* owner_window_;
scoped_refptr<content::DevToolsAgentHost> devtools_agent_host_;
scoped_ptr<content::DevToolsClientHost> devtools_client_host_;
+ scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
};