| 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 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ |
| 7 | 7 |
| 8 #include "base/containers/flat_map.h" | 8 #include "base/containers/flat_map.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 DevToolsSession(DevToolsAgentHostImpl* agent_host, | 22 DevToolsSession(DevToolsAgentHostImpl* agent_host, |
| 23 DevToolsAgentHostClient* client, | 23 DevToolsAgentHostClient* client, |
| 24 int session_id); | 24 int session_id); |
| 25 ~DevToolsSession() override; | 25 ~DevToolsSession() override; |
| 26 | 26 |
| 27 int session_id() const { return session_id_; } | 27 int session_id() const { return session_id_; } |
| 28 void AddHandler(std::unique_ptr<protocol::DevToolsDomainHandler> handler); | 28 void AddHandler(std::unique_ptr<protocol::DevToolsDomainHandler> handler); |
| 29 void SetRenderFrameHost(RenderFrameHostImpl* host); | 29 void SetRenderFrameHost(RenderFrameHostImpl* host); |
| 30 void SetFallThroughForNotFound(bool value); | 30 void SetFallThroughForNotFound(bool value); |
| 31 bool ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); |
| 31 | 32 |
| 32 protocol::Response::Status Dispatch( | 33 protocol::Response::Status Dispatch( |
| 33 const std::string& message, | 34 const std::string& message, |
| 34 int* call_id, | 35 int* call_id, |
| 35 std::string* method); | 36 std::string* method); |
| 36 | 37 |
| 37 // Only used by DevToolsAgentHostImpl. | 38 // Only used by DevToolsAgentHostImpl. |
| 38 DevToolsAgentHostClient* client() const { return client_; } | 39 DevToolsAgentHostClient* client() const { return client_; } |
| 40 void SendMessageToClient(const std::string& message); |
| 39 | 41 |
| 40 template <typename Handler> | 42 template <typename Handler> |
| 41 static std::vector<Handler*> HandlersForAgentHost( | 43 static std::vector<Handler*> HandlersForAgentHost( |
| 42 DevToolsAgentHostImpl* agent_host, | 44 DevToolsAgentHostImpl* agent_host, |
| 43 const std::string& name) { | 45 const std::string& name) { |
| 44 std::vector<Handler*> result; | 46 std::vector<Handler*> result; |
| 45 if (agent_host->sessions_.empty()) | 47 if (agent_host->sessions_.empty()) |
| 46 return result; | 48 return result; |
| 47 for (const auto& session : agent_host->sessions_) { | 49 for (const auto& session : agent_host->sessions_) { |
| 48 auto it = session->handlers_.find(name); | 50 auto it = session->handlers_.find(name); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 69 handlers_; | 71 handlers_; |
| 70 RenderFrameHostImpl* host_; | 72 RenderFrameHostImpl* host_; |
| 71 std::unique_ptr<protocol::UberDispatcher> dispatcher_; | 73 std::unique_ptr<protocol::UberDispatcher> dispatcher_; |
| 72 | 74 |
| 73 base::WeakPtrFactory<DevToolsSession> weak_factory_; | 75 base::WeakPtrFactory<DevToolsSession> weak_factory_; |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace content | 78 } // namespace content |
| 77 | 79 |
| 78 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ | 80 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_SESSION_H_ |
| OLD | NEW |