Chromium Code Reviews| 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_; } |
| 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(); |
| 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_; } | |
| 50 void Attach(); | |
| 51 void Detach(); | |
| 24 | 52 |
| 25 private: | 53 private: |
| 26 // protocol::FrontendChannel implementation. | 54 // protocol::FrontendChannel implementation. |
| 27 void sendProtocolResponse( | 55 void sendProtocolResponse( |
| 28 int call_id, | 56 int call_id, |
| 29 std::unique_ptr<protocol::Serializable> message) override; | 57 std::unique_ptr<protocol::Serializable> message) override; |
| 30 void sendProtocolNotification( | 58 void sendProtocolNotification( |
| 31 std::unique_ptr<protocol::Serializable> message) override; | 59 std::unique_ptr<protocol::Serializable> message) override; |
| 32 void flushProtocolNotifications() override; | 60 void flushProtocolNotifications() override; |
| 33 | 61 |
| 62 protocol::DevToolsDomainHandler* GetHandlerByName(const std::string& name); | |
| 63 | |
| 34 DevToolsAgentHostImpl* agent_host_; | 64 DevToolsAgentHostImpl* agent_host_; |
| 65 DevToolsAgentHostClient* client_; | |
| 35 int session_id_; | 66 int session_id_; |
| 67 std::unordered_map<std::string, | |
| 68 std::unique_ptr<protocol::DevToolsDomainHandler>> handlers_; | |
| 69 RenderFrameHostImpl* host_; | |
| 70 bool attached_; | |
|
caseq
2016/12/20 23:13:20
Let's try to get rid of that, as well as of Attach
dgozman
2016/12/21 00:29:40
Done.
| |
| 36 std::unique_ptr<protocol::UberDispatcher> dispatcher_; | 71 std::unique_ptr<protocol::UberDispatcher> dispatcher_; |
| 37 }; | 72 }; |
| 38 | 73 |
| 39 } // namespace content | 74 } // namespace content |
| OLD | NEW |