2013-11-08 17:06:06 +01:00
|
|
|
// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright
|
|
|
|
// 2012 The Chromium Authors. All rights reserved. Use of this source code is
|
|
|
|
// governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_
|
|
|
|
|
|
|
|
#include "libcef/browser/browser_host_impl.h"
|
|
|
|
|
|
|
|
#include "base/basictypes.h"
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "base/memory/ref_counted.h"
|
|
|
|
#include "base/memory/scoped_ptr.h"
|
|
|
|
#include "content/public/browser/devtools_agent_host.h"
|
2014-09-04 19:53:40 +02:00
|
|
|
#include "content/public/browser/devtools_frontend_host.h"
|
2013-11-08 17:06:06 +01:00
|
|
|
#include "content/public/browser/web_contents_observer.h"
|
|
|
|
|
|
|
|
namespace content {
|
|
|
|
class RenderViewHost;
|
|
|
|
class WebContents;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CefDevToolsFrontend : public content::WebContentsObserver,
|
2014-09-04 19:53:40 +02:00
|
|
|
public content::DevToolsFrontendHost::Delegate,
|
|
|
|
public content::DevToolsAgentHostClient {
|
2013-11-08 17:06:06 +01:00
|
|
|
public:
|
|
|
|
static CefDevToolsFrontend* Show(
|
|
|
|
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
|
|
|
const CefWindowInfo& windowInfo,
|
|
|
|
CefRefPtr<CefClient> client,
|
2014-10-11 02:12:01 +02:00
|
|
|
const CefBrowserSettings& settings,
|
|
|
|
const CefPoint& inspect_element_at);
|
2013-11-08 17:06:06 +01:00
|
|
|
|
|
|
|
void Activate();
|
|
|
|
void Focus();
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
|
|
|
|
return frontend_browser_;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
|
|
|
content::DevToolsAgentHost* agent_host);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefDevToolsFrontend() override;
|
2013-11-08 17:06:06 +01:00
|
|
|
|
2014-09-04 19:53:40 +02:00
|
|
|
// WebContentsObserver overrides.
|
2014-11-12 20:25:15 +01:00
|
|
|
void RenderViewCreated(
|
|
|
|
content::RenderViewHost* render_view_host) override;
|
|
|
|
void WebContentsDestroyed() override;
|
2013-11-08 17:06:06 +01:00
|
|
|
|
2014-09-04 19:53:40 +02:00
|
|
|
// content::DevToolsFrontendHost::Delegate implementation.
|
2014-11-12 20:25:15 +01:00
|
|
|
void HandleMessageFromDevToolsFrontend(
|
|
|
|
const std::string& message) override;
|
|
|
|
void HandleMessageFromDevToolsFrontendToBackend(
|
|
|
|
const std::string& message) override;
|
2013-11-08 17:06:06 +01:00
|
|
|
|
2014-09-04 19:53:40 +02:00
|
|
|
// content::DevToolsAgentHostClient implementation.
|
2014-11-12 20:25:15 +01:00
|
|
|
void DispatchProtocolMessage(
|
2014-09-04 19:53:40 +02:00
|
|
|
content::DevToolsAgentHost* agent_host,
|
2014-11-12 20:25:15 +01:00
|
|
|
const std::string& message) override;
|
|
|
|
void AgentHostClosed(
|
2014-09-04 19:53:40 +02:00
|
|
|
content::DevToolsAgentHost* agent_host,
|
2014-11-12 20:25:15 +01:00
|
|
|
bool replaced) override;
|
2013-11-08 17:06:06 +01:00
|
|
|
|
|
|
|
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
|
|
|
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
2014-09-04 19:53:40 +02:00
|
|
|
scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
|
2013-11-08 17:06:06 +01:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_
|