chrome: Add DevTools protocol support (see issue #2969)

Testable with the following:
$ ceftests --enable-chrome-runtime --gtest_filter=DevToolsMessageTest.*
This commit is contained in:
Dmitry Azaraev
2021-03-18 13:17:33 -04:00
committed by Marshall Greenblatt
parent a17c59ce1d
commit 505bf24abb
8 changed files with 109 additions and 130 deletions

View File

@@ -12,6 +12,7 @@
#include "libcef/browser/browser_contents_delegate.h"
#include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/devtools/devtools_manager.h"
#include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/request_context_impl.h"
@@ -165,6 +166,12 @@ class CefBrowserHostBase : public CefBrowserHost,
void SendMouseWheelEvent(const CefMouseEvent& event,
int deltaX,
int deltaY) override;
bool SendDevToolsMessage(const void* message, size_t message_size) override;
int ExecuteDevToolsMethod(int message_id,
const CefString& method,
CefRefPtr<CefDictionaryValue> params) override;
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
CefRefPtr<CefDevToolsMessageObserver> observer) override;
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
@@ -256,6 +263,10 @@ class CefBrowserHostBase : public CefBrowserHost,
#endif
protected:
bool EnsureDevToolsManager();
void InitializeDevToolsRegistrationOnUIThread(
CefRefPtr<CefRegistration> registration);
// Called from LoadMainFrameURL to perform the actual navigation.
virtual bool Navigate(const content::OpenURLParams& params);
@@ -284,6 +295,9 @@ class CefBrowserHostBase : public CefBrowserHost,
bool is_fullscreen_ = false;
CefRefPtr<CefFrameHostImpl> focused_frame_;
// Used for creating and managing DevTools instances.
std::unique_ptr<CefDevToolsManager> devtools_manager_;
private:
IMPLEMENT_REFCOUNTING(CefBrowserHostBase);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostBase);