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; | |
13 | |
14 namespace protocol { | |
15 class InputHandler; | |
16 class InspectorHandler; | |
17 class NetworkHandler; | |
18 class PageHandler; | |
19 class TargetHandler; | |
20 class TracingHandler; | |
21 } | |
10 | 22 |
11 class DevToolsSession : public protocol::FrontendChannel { | 23 class DevToolsSession : public protocol::FrontendChannel { |
12 public: | 24 public: |
13 DevToolsSession(DevToolsAgentHostImpl* agent_host, int session_id); | 25 DevToolsSession(DevToolsAgentHostImpl* agent_host, |
26 DevToolsAgentHostClient* client, | |
27 int session_id); | |
14 ~DevToolsSession() override; | 28 ~DevToolsSession() override; |
15 | 29 |
16 void ResetDispatcher(); | 30 int session_id() { return session_id_; } |
caseq
2016/12/21 23:17:27
nit: could be const.
dgozman
2016/12/22 06:26:13
Done.
| |
31 void AddHandler(std::unique_ptr<protocol::DevToolsDomainHandler> handler); | |
32 void SetRenderFrameHost(RenderFrameHostImpl* host); | |
33 void SetFallThroughForNotFound(bool value); | |
34 | |
17 protocol::Response::Status Dispatch( | 35 protocol::Response::Status Dispatch( |
18 const std::string& message, | 36 const std::string& message, |
37 bool offer_to_delegate, | |
19 int* call_id, | 38 int* call_id, |
20 std::string* method); | 39 std::string* method); |
21 | 40 |
22 int session_id() { return session_id_; } | 41 protocol::InputHandler* GetInputHandler(); |
caseq
2016/12/21 23:17:27
Let's move these somewhere else, it would be nice
dgozman
2016/12/22 06:26:13
Done.
| |
23 protocol::UberDispatcher* dispatcher() { return dispatcher_.get(); } | 42 protocol::InspectorHandler* GetInspectorHandler(); |
43 protocol::NetworkHandler* GetNetworkHandler(); | |
44 protocol::PageHandler* GetPageHandler(); | |
45 protocol::TargetHandler* GetTargetHandler(); | |
46 protocol::TracingHandler* GetTracingHandler(); | |
47 | |
48 // Only used by DevToolsAgentHostImpl. | |
49 DevToolsAgentHostClient* client() const { return client_; } | |
24 | 50 |
25 private: | 51 private: |
26 // protocol::FrontendChannel implementation. | 52 // protocol::FrontendChannel implementation. |
27 void sendProtocolResponse( | 53 void sendProtocolResponse( |
28 int call_id, | 54 int call_id, |
29 std::unique_ptr<protocol::Serializable> message) override; | 55 std::unique_ptr<protocol::Serializable> message) override; |
30 void sendProtocolNotification( | 56 void sendProtocolNotification( |
31 std::unique_ptr<protocol::Serializable> message) override; | 57 std::unique_ptr<protocol::Serializable> message) override; |
32 void flushProtocolNotifications() override; | 58 void flushProtocolNotifications() override; |
33 | 59 |
60 protocol::DevToolsDomainHandler* GetHandlerByName(const std::string& name); | |
61 | |
34 DevToolsAgentHostImpl* agent_host_; | 62 DevToolsAgentHostImpl* agent_host_; |
63 DevToolsAgentHostClient* client_; | |
35 int session_id_; | 64 int session_id_; |
65 std::unordered_map<std::string, | |
66 std::unique_ptr<protocol::DevToolsDomainHandler>> handlers_; | |
67 RenderFrameHostImpl* host_; | |
36 std::unique_ptr<protocol::UberDispatcher> dispatcher_; | 68 std::unique_ptr<protocol::UberDispatcher> dispatcher_; |
37 }; | 69 }; |
38 | 70 |
39 } // namespace content | 71 } // namespace content |
OLD | NEW |