OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_BROWSER_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_BROWSER_HANDLER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
| 11 #include "content/public/browser/devtools_agent_host.h" |
| 12 |
| 13 namespace net { |
| 14 class ServerSocket; |
| 15 } |
| 16 |
| 17 // Windows headers will redefine SendMessage. |
| 18 #ifdef SendMessage |
| 19 #undef SendMessage |
| 20 #endif |
| 21 |
| 22 namespace content { |
| 23 namespace devtools { |
| 24 namespace browser { |
| 25 |
| 26 class BrowserHandler : public DevToolsAgentHostClient { |
| 27 public: |
| 28 using Response = DevToolsProtocolClient::Response; |
| 29 |
| 30 BrowserHandler(); |
| 31 ~BrowserHandler() override; |
| 32 |
| 33 void SetClient(std::unique_ptr<Client> client); |
| 34 |
| 35 using TargetInfos = std::vector<scoped_refptr<devtools::browser::TargetInfo>>; |
| 36 Response GetTargets(TargetInfos* infos); |
| 37 Response Attach(const std::string& targetId); |
| 38 Response Detach(const std::string& targetId); |
| 39 Response SendMessage(const std::string& targetId, const std::string& message); |
| 40 |
| 41 private: |
| 42 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, |
| 43 const std::string& message) override; |
| 44 |
| 45 void AgentHostClosed(DevToolsAgentHost* agent_host, |
| 46 bool replaced_with_another_client) override; |
| 47 |
| 48 std::unique_ptr<Client> client_; |
| 49 DISALLOW_COPY_AND_ASSIGN(BrowserHandler); |
| 50 }; |
| 51 |
| 52 } // namespace browser |
| 53 } // namespace devtools |
| 54 } // namespace content |
| 55 |
| 56 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_BROWSER_HANDLER_H_ |
OLD | NEW |