| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_AGENT_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "content/browser/devtools/devtools_io_context.h" |
| 11 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 12 #include "content/common/devtools_messages.h" | 13 #include "content/common/devtools_messages.h" |
| 13 #include "content/public/browser/devtools_agent_host.h" | 14 #include "content/public/browser/devtools_agent_host.h" |
| 14 | 15 |
| 15 namespace IPC { | 16 namespace IPC { |
| 16 class Message; | 17 class Message; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 42 WebContents* GetWebContents() override; | 43 WebContents* GetWebContents() override; |
| 43 void DisconnectWebContents() override; | 44 void DisconnectWebContents() override; |
| 44 void ConnectWebContents(WebContents* wc) override; | 45 void ConnectWebContents(WebContents* wc) override; |
| 45 | 46 |
| 46 protected: | 47 protected: |
| 47 DevToolsAgentHostImpl(); | 48 DevToolsAgentHostImpl(); |
| 48 ~DevToolsAgentHostImpl() override; | 49 ~DevToolsAgentHostImpl() override; |
| 49 | 50 |
| 50 void HostClosed(); | 51 void HostClosed(); |
| 51 void SendMessageToClient(const std::string& message); | 52 void SendMessageToClient(const std::string& message); |
| 53 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } |
| 54 |
| 52 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); | 55 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); |
| 53 | 56 |
| 54 private: | 57 private: |
| 55 friend class DevToolsAgentHost; // for static methods | 58 friend class DevToolsAgentHost; // for static methods |
| 59 void InnerDetach(); |
| 56 | 60 |
| 57 const std::string id_; | 61 const std::string id_; |
| 58 DevToolsAgentHostClient* client_; | 62 DevToolsAgentHostClient* client_; |
| 63 devtools::DevToolsIOContext io_context_; |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 class DevToolsMessageChunkProcessor { | 66 class DevToolsMessageChunkProcessor { |
| 62 public: | 67 public: |
| 63 using SendMessageCallback = base::Callback<void(const std::string&)>; | 68 using SendMessageCallback = base::Callback<void(const std::string&)>; |
| 64 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); | 69 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); |
| 65 ~DevToolsMessageChunkProcessor(); | 70 ~DevToolsMessageChunkProcessor(); |
| 66 | 71 |
| 67 std::string state_cookie() const { return state_cookie_; } | 72 std::string state_cookie() const { return state_cookie_; } |
| 68 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } | 73 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } |
| 69 int last_call_id() const { return last_call_id_; } | 74 int last_call_id() const { return last_call_id_; } |
| 70 void ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); | 75 void ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); |
| 71 | 76 |
| 72 private: | 77 private: |
| 73 SendMessageCallback callback_; | 78 SendMessageCallback callback_; |
| 74 std::string message_buffer_; | 79 std::string message_buffer_; |
| 75 uint32 message_buffer_size_; | 80 uint32 message_buffer_size_; |
| 76 std::string state_cookie_; | 81 std::string state_cookie_; |
| 77 int last_call_id_; | 82 int last_call_id_; |
| 78 }; | 83 }; |
| 79 | 84 |
| 80 } // namespace content | 85 } // namespace content |
| 81 | 86 |
| 82 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 87 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
| OLD | NEW |