| 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/devtools_domain_handler.h" |
| 6 #include "content/browser/devtools/protocol/protocol.h" | 6 #include "content/browser/devtools/protocol/protocol.h" |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 | 9 |
| 10 class DevToolsAgentHostImpl; | 10 class DevToolsAgentHostImpl; |
| 11 class DevToolsAgentHostClient; | 11 class DevToolsAgentHostClient; |
| 12 class RenderFrameHostImpl; | 12 class RenderFrameHostImpl; |
| 13 | 13 |
| 14 class DevToolsSession : public protocol::FrontendChannel { | 14 class DevToolsSession : public protocol::FrontendChannel { |
| 15 public: | 15 public: |
| 16 DevToolsSession(DevToolsAgentHostImpl* agent_host, | 16 DevToolsSession(DevToolsAgentHostImpl* agent_host, |
| 17 DevToolsAgentHostClient* client, | 17 DevToolsAgentHostClient* client, |
| 18 int session_id); | 18 int session_id); |
| 19 ~DevToolsSession() override; | 19 ~DevToolsSession() override; |
| 20 | 20 |
| 21 int session_id() const { return session_id_; } | 21 int session_id() const { return session_id_; } |
| 22 void AddHandler(std::unique_ptr<protocol::DevToolsDomainHandler> handler); | 22 void AddHandler(std::unique_ptr<protocol::DevToolsDomainHandler> handler); |
| 23 void SetRenderFrameHost(RenderFrameHostImpl* host); | 23 void SetRenderFrameHost(RenderFrameHostImpl* host); |
| 24 void SetFallThroughForNotFound(bool value); | 24 void SetFallThroughForNotFound(bool value); |
| 25 protocol::DevToolsDomainHandler* GetHandlerByName(const std::string& name); | 25 protocol::DevToolsDomainHandler* GetHandlerByName(const std::string& name); |
| 26 | 26 |
| 27 protocol::Response::Status Dispatch( | 27 protocol::Response::Status Dispatch( |
| 28 const std::string& message, | 28 const std::string& message, |
| 29 bool offer_to_delegate, | |
| 30 int* call_id, | 29 int* call_id, |
| 31 std::string* method); | 30 std::string* method); |
| 32 | 31 |
| 33 // Only used by DevToolsAgentHostImpl. | 32 // Only used by DevToolsAgentHostImpl. |
| 34 DevToolsAgentHostClient* client() const { return client_; } | 33 DevToolsAgentHostClient* client() const { return client_; } |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 // protocol::FrontendChannel implementation. | 36 // protocol::FrontendChannel implementation. |
| 38 void sendProtocolResponse( | 37 void sendProtocolResponse( |
| 39 int call_id, | 38 int call_id, |
| 40 std::unique_ptr<protocol::Serializable> message) override; | 39 std::unique_ptr<protocol::Serializable> message) override; |
| 41 void sendProtocolNotification( | 40 void sendProtocolNotification( |
| 42 std::unique_ptr<protocol::Serializable> message) override; | 41 std::unique_ptr<protocol::Serializable> message) override; |
| 43 void flushProtocolNotifications() override; | 42 void flushProtocolNotifications() override; |
| 44 | 43 |
| 45 DevToolsAgentHostImpl* agent_host_; | 44 DevToolsAgentHostImpl* agent_host_; |
| 46 DevToolsAgentHostClient* client_; | 45 DevToolsAgentHostClient* client_; |
| 47 int session_id_; | 46 int session_id_; |
| 48 std::unordered_map<std::string, | 47 std::unordered_map<std::string, |
| 49 std::unique_ptr<protocol::DevToolsDomainHandler>> handlers_; | 48 std::unique_ptr<protocol::DevToolsDomainHandler>> handlers_; |
| 50 RenderFrameHostImpl* host_; | 49 RenderFrameHostImpl* host_; |
| 51 std::unique_ptr<protocol::UberDispatcher> dispatcher_; | 50 std::unique_ptr<protocol::UberDispatcher> dispatcher_; |
| 52 }; | 51 }; |
| 53 | 52 |
| 54 } // namespace content | 53 } // namespace content |
| OLD | NEW |