| 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 20 matching lines...) Expand all Loading... |
| 31 // Informs the hosted agent that a client host has attached. | 31 // Informs the hosted agent that a client host has attached. |
| 32 virtual void Attach() = 0; | 32 virtual void Attach() = 0; |
| 33 | 33 |
| 34 // Informs the hosted agent that a client host has detached. | 34 // Informs the hosted agent that a client host has detached. |
| 35 virtual void Detach() = 0; | 35 virtual void Detach() = 0; |
| 36 | 36 |
| 37 // Opens the inspector for this host. | 37 // Opens the inspector for this host. |
| 38 bool Inspect(BrowserContext* browser_context); | 38 bool Inspect(BrowserContext* browser_context); |
| 39 | 39 |
| 40 // DevToolsAgentHost implementation. | 40 // DevToolsAgentHost implementation. |
| 41 void AttachClient(DevToolsAgentHostClient* client) override; | 41 bool AttachClient(DevToolsAgentHostClient* client) override; |
| 42 void DetachClient() override; | 42 bool ForceAttachClient(DevToolsAgentHostClient* client) override; |
| 43 bool DetachClient(DevToolsAgentHostClient* client) override; |
| 43 bool IsAttached() override; | 44 bool IsAttached() override; |
| 44 void InspectElement(int x, int y) override; | 45 void InspectElement(int x, int y) override; |
| 45 std::string GetId() override; | 46 std::string GetId() override; |
| 46 BrowserContext* GetBrowserContext() override; | 47 BrowserContext* GetBrowserContext() override; |
| 47 WebContents* GetWebContents() override; | 48 WebContents* GetWebContents() override; |
| 48 void DisconnectWebContents() override; | 49 void DisconnectWebContents() override; |
| 49 void ConnectWebContents(WebContents* wc) override; | 50 void ConnectWebContents(WebContents* wc) override; |
| 50 | 51 |
| 51 // DevToolsProtocolDelegate implementation. | 52 // DevToolsProtocolDelegate implementation. |
| 52 void SendProtocolResponse(int session_id, | 53 void SendProtocolResponse(int session_id, |
| 53 const std::string& message) override; | 54 const std::string& message) override; |
| 54 void SendProtocolNotification(const std::string& message) override; | 55 void SendProtocolNotification(const std::string& message) override; |
| 55 | 56 |
| 56 protected: | 57 protected: |
| 57 DevToolsAgentHostImpl(); | 58 DevToolsAgentHostImpl(); |
| 58 ~DevToolsAgentHostImpl() override; | 59 ~DevToolsAgentHostImpl() override; |
| 59 | 60 |
| 60 void HostClosed(); | 61 void HostClosed(); |
| 61 void SendMessageToClient(int session_id, const std::string& message); | 62 void SendMessageToClient(int session_id, const std::string& message); |
| 62 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } | 63 devtools::DevToolsIOContext* GetIOContext() { return &io_context_; } |
| 63 | 64 |
| 64 int session_id() { DCHECK(client_); return session_id_; } | 65 int session_id() { DCHECK(client_); return session_id_; } |
| 65 | 66 |
| 66 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); | 67 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 friend class DevToolsAgentHost; // for static methods | 70 friend class DevToolsAgentHost; // for static methods |
| 71 bool InnerAttach(DevToolsAgentHostClient* client, bool force); |
| 70 void InnerDetach(); | 72 void InnerDetach(); |
| 71 | 73 |
| 72 const std::string id_; | 74 const std::string id_; |
| 73 int session_id_; | 75 int session_id_; |
| 74 DevToolsAgentHostClient* client_; | 76 DevToolsAgentHostClient* client_; |
| 75 devtools::DevToolsIOContext io_context_; | 77 devtools::DevToolsIOContext io_context_; |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 class DevToolsMessageChunkProcessor { | 80 class DevToolsMessageChunkProcessor { |
| 79 public: | 81 public: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 90 SendMessageCallback callback_; | 92 SendMessageCallback callback_; |
| 91 std::string message_buffer_; | 93 std::string message_buffer_; |
| 92 uint32_t message_buffer_size_; | 94 uint32_t message_buffer_size_; |
| 93 std::string state_cookie_; | 95 std::string state_cookie_; |
| 94 int last_call_id_; | 96 int last_call_id_; |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace content | 99 } // namespace content |
| 98 | 100 |
| 99 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 101 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
| OLD | NEW |