| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_HTML_VIEWER_DEVTOOLS_AGENT_IMPL_H_ | 5 #ifndef COMPONENTS_HTML_VIEWER_DEVTOOLS_AGENT_IMPL_H_ |
| 6 #define COMPONENTS_HTML_VIEWER_DEVTOOLS_AGENT_IMPL_H_ | 6 #define COMPONENTS_HTML_VIEWER_DEVTOOLS_AGENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 ~DevToolsAgentImpl() override; | 31 ~DevToolsAgentImpl() override; |
| 32 | 32 |
| 33 void BindToRequest(mojo::InterfaceRequest<DevToolsAgent> request); | 33 void BindToRequest(mojo::InterfaceRequest<DevToolsAgent> request); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // devtools_service::DevToolsAgent implementation. | 36 // devtools_service::DevToolsAgent implementation. |
| 37 void SetClient(devtools_service::DevToolsAgentClientPtr client) override; | 37 void SetClient(devtools_service::DevToolsAgentClientPtr client) override; |
| 38 void DispatchProtocolMessage(const mojo::String& message) override; | 38 void DispatchProtocolMessage(const mojo::String& message) override; |
| 39 | 39 |
| 40 // blink::WebDevToolsAgentClient implementation. | 40 // blink::WebDevToolsAgentClient implementation. |
| 41 void sendProtocolMessage(int session_id, | 41 void sendProtocolMessage(int call_id, |
| 42 int call_id, | |
| 43 const blink::WebString& response, | 42 const blink::WebString& response, |
| 44 const blink::WebString& state); | 43 const blink::WebString& state); |
| 45 | 44 |
| 46 void OnConnectionError(); | 45 void OnConnectionError(); |
| 47 | 46 |
| 48 blink::WebLocalFrame* const frame_; | 47 blink::WebLocalFrame* const frame_; |
| 49 const std::string id_; | 48 const std::string id_; |
| 50 | 49 |
| 51 mojo::Binding<DevToolsAgent> binding_; | 50 mojo::Binding<DevToolsAgent> binding_; |
| 52 devtools_service::DevToolsAgentClientPtr client_; | 51 devtools_service::DevToolsAgentClientPtr client_; |
| 53 | 52 |
| 54 // If we restore the agent's internal state using serialized state data from a | 53 // If we restore the agent's internal state using serialized state data from a |
| 55 // previous agent, the agent may generate messages before |client_| is set. | 54 // previous agent, the agent may generate messages before |client_| is set. |
| 56 // In that case, we need to cache messages for the client. | 55 // In that case, we need to cache messages for the client. |
| 57 bool cache_until_client_ready_; | 56 bool cache_until_client_ready_; |
| 58 | 57 |
| 59 struct CachedClientMessage { | 58 struct CachedClientMessage { |
| 60 int call_id; | 59 int call_id; |
| 61 mojo::String response; | 60 mojo::String response; |
| 62 mojo::String state; | 61 mojo::String state; |
| 63 }; | 62 }; |
| 64 std::vector<CachedClientMessage> cached_client_messages_; | 63 std::vector<CachedClientMessage> cached_client_messages_; |
| 65 | 64 |
| 66 DISALLOW_COPY_AND_ASSIGN(DevToolsAgentImpl); | 65 DISALLOW_COPY_AND_ASSIGN(DevToolsAgentImpl); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 } // namespace html_viewer | 68 } // namespace html_viewer |
| 70 | 69 |
| 71 #endif // COMPONENTS_HTML_VIEWER_DEVTOOLS_AGENT_IMPL_H_ | 70 #endif // COMPONENTS_HTML_VIEWER_DEVTOOLS_AGENT_IMPL_H_ |
| OLD | NEW |