| // Copyright 2026 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_SESSION_BASE_H_ |
| #define CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_SESSION_BASE_H_ |
| |
| #include <memory> |
| |
| #include "base/containers/span.h" |
| #include "base/memory/raw_ptr.h" |
| #include "chrome/browser/devtools/protocol/protocol.h" |
| #include "content/public/browser/devtools_manager_delegate.h" |
| |
| namespace content { |
| class DevToolsAgentHostClientChannel; |
| } // namespace content |
| |
| class ChromeDevToolsSessionBase : public protocol::FrontendChannel { |
| public: |
| explicit ChromeDevToolsSessionBase( |
| content::DevToolsAgentHostClientChannel* channel); |
| |
| ChromeDevToolsSessionBase(const ChromeDevToolsSessionBase&) = delete; |
| ChromeDevToolsSessionBase& operator=(const ChromeDevToolsSessionBase&) = |
| delete; |
| |
| ~ChromeDevToolsSessionBase() override; |
| |
| void HandleCommand( |
| base::span<const uint8_t> message, |
| content::DevToolsManagerDelegate::NotHandledCallback callback); |
| |
| protected: |
| protocol::UberDispatcher* dispatcher() { return &dispatcher_; } |
| |
| private: |
| // protocol::FrontendChannel: |
| void SendProtocolResponse( |
| int call_id, |
| std::unique_ptr<protocol::Serializable> message) override; |
| void SendProtocolNotification( |
| std::unique_ptr<protocol::Serializable> message) override; |
| void FlushProtocolNotifications() override; |
| |
| protocol::UberDispatcher dispatcher_; |
| raw_ptr<content::DevToolsAgentHostClientChannel> client_channel_; |
| }; |
| |
| #endif // CHROME_BROWSER_DEVTOOLS_CHROME_DEVTOOLS_SESSION_BASE_H_ |