| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/protocol/devtools_domain_handler.h" |
| 5 #include "content/browser/devtools/protocol/protocol.h" | 6 #include "content/browser/devtools/protocol/protocol.h" |
| 6 | 7 |
| 7 namespace content { | 8 namespace content { |
| 8 | 9 |
| 9 class DevToolsAgentHostImpl; | 10 class DevToolsAgentHostImpl; |
| 11 class DevToolsAgentHostClient; |
| 12 class RenderFrameHostImpl; |
| 10 | 13 |
| 11 class DevToolsSession : public protocol::FrontendChannel { | 14 class DevToolsSession : public protocol::FrontendChannel { |
| 12 public: | 15 public: |
| 13 DevToolsSession(DevToolsAgentHostImpl* agent_host, int session_id); | 16 DevToolsSession(DevToolsAgentHostImpl* agent_host, |
| 17 DevToolsAgentHostClient* client, |
| 18 int session_id); |
| 14 ~DevToolsSession() override; | 19 ~DevToolsSession() override; |
| 15 | 20 |
| 16 void ResetDispatcher(); | 21 int session_id() const { return session_id_; } |
| 22 void AddHandler(std::unique_ptr<protocol::DevToolsDomainHandler> handler); |
| 23 void SetRenderFrameHost(RenderFrameHostImpl* host); |
| 24 void SetFallThroughForNotFound(bool value); |
| 25 protocol::DevToolsDomainHandler* GetHandlerByName(const std::string& name); |
| 26 |
| 17 protocol::Response::Status Dispatch( | 27 protocol::Response::Status Dispatch( |
| 18 const std::string& message, | 28 const std::string& message, |
| 29 bool offer_to_delegate, |
| 19 int* call_id, | 30 int* call_id, |
| 20 std::string* method); | 31 std::string* method); |
| 21 | 32 |
| 22 int session_id() { return session_id_; } | 33 // Only used by DevToolsAgentHostImpl. |
| 23 protocol::UberDispatcher* dispatcher() { return dispatcher_.get(); } | 34 DevToolsAgentHostClient* client() const { return client_; } |
| 24 | 35 |
| 25 private: | 36 private: |
| 26 // protocol::FrontendChannel implementation. | 37 // protocol::FrontendChannel implementation. |
| 27 void sendProtocolResponse( | 38 void sendProtocolResponse( |
| 28 int call_id, | 39 int call_id, |
| 29 std::unique_ptr<protocol::Serializable> message) override; | 40 std::unique_ptr<protocol::Serializable> message) override; |
| 30 void sendProtocolNotification( | 41 void sendProtocolNotification( |
| 31 std::unique_ptr<protocol::Serializable> message) override; | 42 std::unique_ptr<protocol::Serializable> message) override; |
| 32 void flushProtocolNotifications() override; | 43 void flushProtocolNotifications() override; |
| 33 | 44 |
| 34 DevToolsAgentHostImpl* agent_host_; | 45 DevToolsAgentHostImpl* agent_host_; |
| 46 DevToolsAgentHostClient* client_; |
| 35 int session_id_; | 47 int session_id_; |
| 48 std::unordered_map<std::string, |
| 49 std::unique_ptr<protocol::DevToolsDomainHandler>> handlers_; |
| 50 RenderFrameHostImpl* host_; |
| 36 std::unique_ptr<protocol::UberDispatcher> dispatcher_; | 51 std::unique_ptr<protocol::UberDispatcher> dispatcher_; |
| 37 }; | 52 }; |
| 38 | 53 |
| 39 } // namespace content | 54 } // namespace content |
| OLD | NEW |