Chromium Code Reviews| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 BrowserContext* GetBrowserContext() override; | 42 BrowserContext* GetBrowserContext() override; |
| 43 WebContents* GetWebContents() override; | 43 WebContents* GetWebContents() override; |
| 44 void DisconnectWebContents() override; | 44 void DisconnectWebContents() override; |
| 45 void ConnectWebContents(WebContents* wc) override; | 45 void ConnectWebContents(WebContents* wc) override; |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 DevToolsAgentHostImpl(); | 48 DevToolsAgentHostImpl(); |
| 49 ~DevToolsAgentHostImpl() override; | 49 ~DevToolsAgentHostImpl() override; |
| 50 | 50 |
| 51 void HostClosed(); | 51 void HostClosed(); |
| 52 void SendMessageToClient(const std::string& message); | 52 void SendMessageToClient(int session_id, const std::string& message); |
| 53 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } | 53 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } |
| 54 | 54 |
| 55 int SessionId() { return session_id_; } | |
|
dgozman
2015/11/06 22:57:27
int session_id() { return session_id_; }
kozy
2015/11/07 01:54:43
Done.
| |
| 56 | |
| 55 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); | 57 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 friend class DevToolsAgentHost; // for static methods | 60 friend class DevToolsAgentHost; // for static methods |
| 59 void InnerDetach(); | 61 void InnerDetach(); |
| 60 | 62 |
| 61 const std::string id_; | 63 const std::string id_; |
| 64 int session_id_; | |
| 62 DevToolsAgentHostClient* client_; | 65 DevToolsAgentHostClient* client_; |
| 63 devtools::DevToolsIOContext io_context_; | 66 devtools::DevToolsIOContext io_context_; |
| 64 }; | 67 }; |
| 65 | 68 |
| 66 class DevToolsMessageChunkProcessor { | 69 class DevToolsMessageChunkProcessor { |
| 67 public: | 70 public: |
| 68 using SendMessageCallback = base::Callback<void(const std::string&)>; | 71 using SendMessageCallback = base::Callback<void(int, const std::string&)>; |
| 69 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); | 72 explicit DevToolsMessageChunkProcessor(const SendMessageCallback& callback); |
| 70 ~DevToolsMessageChunkProcessor(); | 73 ~DevToolsMessageChunkProcessor(); |
| 71 | 74 |
| 72 std::string state_cookie() const { return state_cookie_; } | 75 std::string state_cookie() const { return state_cookie_; } |
| 73 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } | 76 void set_state_cookie(const std::string& cookie) { state_cookie_ = cookie; } |
| 74 int last_call_id() const { return last_call_id_; } | 77 int last_call_id() const { return last_call_id_; } |
| 75 void ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); | 78 void ProcessChunkedMessageFromAgent(const DevToolsMessageChunk& chunk); |
| 76 | 79 |
| 77 private: | 80 private: |
| 78 SendMessageCallback callback_; | 81 SendMessageCallback callback_; |
| 79 std::string message_buffer_; | 82 std::string message_buffer_; |
| 80 uint32 message_buffer_size_; | 83 uint32 message_buffer_size_; |
| 81 std::string state_cookie_; | 84 std::string state_cookie_; |
| 82 int last_call_id_; | 85 int last_call_id_; |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 } // namespace content | 88 } // namespace content |
| 86 | 89 |
| 87 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 90 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
| OLD | NEW |