| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 virtual bool DispatchProtocolMessage(const std::string& message) = 0; | 67 virtual bool DispatchProtocolMessage(const std::string& message) = 0; |
| 68 virtual void InspectElement(int x, int y); | 68 virtual void InspectElement(int x, int y); |
| 69 | 69 |
| 70 void HostClosed(); | 70 void HostClosed(); |
| 71 void SendMessageToClient(int session_id, const std::string& message); | 71 void SendMessageToClient(int session_id, const std::string& message); |
| 72 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } | 72 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } |
| 73 | 73 |
| 74 int session_id() { DCHECK(client_); return session_id_; } | 74 int session_id() { DCHECK(client_); return session_id_; } |
| 75 | 75 |
| 76 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); | |
| 77 | |
| 78 private: | 76 private: |
| 79 friend class DevToolsAgentHost; // for static methods | 77 friend class DevToolsAgentHost; // for static methods |
| 80 bool InnerAttach(DevToolsAgentHostClient* client, bool force); | 78 bool InnerAttach(DevToolsAgentHostClient* client, bool force); |
| 81 void InnerDetach(); | 79 void InnerDetach(); |
| 80 void NotifyAttached(); |
| 81 void NotifyDetached(); |
| 82 | 82 |
| 83 const std::string id_; | 83 const std::string id_; |
| 84 int session_id_; | 84 int session_id_; |
| 85 DevToolsAgentHostClient* client_; | 85 DevToolsAgentHostClient* client_; |
| 86 devtools::DevToolsIOContext io_context_; | 86 devtools::DevToolsIOContext io_context_; |
| 87 static int s_attached_count_; |
| 87 }; | 88 }; |
| 88 | 89 |
| 89 class DevToolsMessageChunkProcessor { | 90 class DevToolsMessageChunkProcessor { |
| 90 public: | 91 public: |
| 91 using SendMessageCallback = base::Callback<void(int, const std::string&)>; | 92 using SendMessageCallback = base::Callback<void(int, const std::string&)>; |
| 92 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); | 93 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); |
| 93 ~DevToolsMessageChunkProcessor(); | 94 ~DevToolsMessageChunkProcessor(); |
| 94 | 95 |
| 95 std::string state_cookie() const { return state_cookie_; } | 96 std::string state_cookie() const { return state_cookie_; } |
| 96 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } | 97 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } |
| 97 int last_call_id() const { return last_call_id_; } | 98 int last_call_id() const { return last_call_id_; } |
| 98 bool ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); | 99 bool ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 SendMessageCallback callback_; | 102 SendMessageCallback callback_; |
| 102 std::string message_buffer_; | 103 std::string message_buffer_; |
| 103 uint32_t message_buffer_size_; | 104 uint32_t message_buffer_size_; |
| 104 std::string state_cookie_; | 105 std::string state_cookie_; |
| 105 int last_call_id_; | 106 int last_call_id_; |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 } // namespace content | 109 } // namespace content |
| 109 | 110 |
| 110 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 111 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
| OLD | NEW |