2014-02-24 03:53:13 +00:00
|
|
|
// Copyright (c) 2014 GitHub, Inc. All rights reserved.
|
2014-04-25 09:49:37 +00:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2014-02-24 03:53:13 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef ATOM_BROWSER_DEVTOOLS_DELEGATE_H_
|
|
|
|
#define ATOM_BROWSER_DEVTOOLS_DELEGATE_H_
|
|
|
|
|
2014-03-16 01:13:06 +00:00
|
|
|
#include <string>
|
|
|
|
|
2014-02-24 03:53:13 +00:00
|
|
|
#include "base/memory/scoped_ptr.h"
|
2014-03-16 00:30:26 +00:00
|
|
|
#include "atom/browser/native_window_observer.h"
|
2014-02-24 03:53:13 +00:00
|
|
|
#include "content/public/browser/devtools_frontend_host_delegate.h"
|
|
|
|
#include "content/public/browser/web_contents_observer.h"
|
2014-03-04 09:50:57 +00:00
|
|
|
#include "vendor/brightray/browser/devtools_embedder_message_dispatcher.h"
|
2014-03-04 11:59:25 +00:00
|
|
|
#include "vendor/brightray/browser/inspectable_web_contents_delegate.h"
|
2014-02-24 03:53:13 +00:00
|
|
|
|
|
|
|
namespace content {
|
|
|
|
class DevToolsAgentHost;
|
|
|
|
class DevToolsClientHost;
|
|
|
|
}
|
|
|
|
|
2014-03-04 09:50:57 +00:00
|
|
|
using brightray::DevToolsEmbedderMessageDispatcher;
|
|
|
|
|
2014-02-24 03:53:13 +00:00
|
|
|
namespace atom {
|
|
|
|
|
|
|
|
class NativeWindow;
|
|
|
|
|
|
|
|
class DevToolsDelegate : public content::DevToolsFrontendHostDelegate,
|
2014-02-24 04:17:10 +00:00
|
|
|
public content::WebContentsObserver,
|
2014-03-04 09:50:57 +00:00
|
|
|
public NativeWindowObserver,
|
|
|
|
public DevToolsEmbedderMessageDispatcher::Delegate {
|
2014-02-24 03:53:13 +00:00
|
|
|
public:
|
|
|
|
DevToolsDelegate(NativeWindow* window,
|
|
|
|
content::WebContents* target_web_contents);
|
|
|
|
virtual ~DevToolsDelegate();
|
|
|
|
|
2014-03-04 11:59:25 +00:00
|
|
|
void SetDelegate(brightray::InspectableWebContentsDelegate* delegate) {
|
|
|
|
delegate_ = delegate;
|
|
|
|
}
|
|
|
|
|
2014-02-24 03:53:13 +00:00
|
|
|
protected:
|
|
|
|
// Implementations of content::DevToolsFrontendHostDelegate.
|
|
|
|
virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE;
|
|
|
|
virtual void InspectedContentsClosing() OVERRIDE;
|
|
|
|
|
|
|
|
// Implementations of content::WebContentsObserver.
|
|
|
|
virtual void AboutToNavigateRenderView(
|
|
|
|
content::RenderViewHost* render_view_host) OVERRIDE;
|
|
|
|
|
2014-02-24 04:17:10 +00:00
|
|
|
// Implementations of NativeWindowObserver.
|
|
|
|
virtual void OnWindowClosed() OVERRIDE;
|
|
|
|
|
2014-03-04 09:50:57 +00:00
|
|
|
// 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;
|
|
|
|
|
2014-02-24 03:53:13 +00:00
|
|
|
private:
|
|
|
|
NativeWindow* owner_window_;
|
2014-03-04 11:59:25 +00:00
|
|
|
brightray::InspectableWebContentsDelegate* delegate_;
|
2014-02-24 03:53:13 +00:00
|
|
|
|
|
|
|
scoped_refptr<content::DevToolsAgentHost> devtools_agent_host_;
|
|
|
|
scoped_ptr<content::DevToolsClientHost> devtools_client_host_;
|
2014-03-04 09:50:57 +00:00
|
|
|
scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_;
|
2014-02-24 03:53:13 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(DevToolsDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace atom
|
|
|
|
|
|
|
|
#endif // ATOM_BROWSER_DEVTOOLS_DELEGATE_H_
|