Make DevToolsDelegate respond to messages.

This commit is contained in:
Cheng Zhao 2014-03-04 17:50:57 +08:00
parent 5e05a3045c
commit 391468ece0
2 changed files with 82 additions and 3 deletions

View file

@ -9,19 +9,23 @@
#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);
@ -39,11 +43,33 @@ class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
// 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);
};