| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_RENDERER_DEVTOOLS_AGENT_H_ | 5 #ifndef CHROME_RENDERER_DEVTOOLS_AGENT_H_ |
| 6 #define CHROME_RENDERER_DEVTOOLS_AGENT_H_ | 6 #define CHROME_RENDERER_DEVTOOLS_AGENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "webkit/glue/webdevtoolsagent_delegate.h" | 11 #include "base/basictypes.h" |
| 12 #include "webkit/api/public/WebDevToolsAgentClient.h" |
| 12 | 13 |
| 13 namespace IPC { | 14 namespace IPC { |
| 14 class Message; | 15 class Message; |
| 15 } | 16 } |
| 16 | 17 |
| 18 namespace WebKit { |
| 19 class WebDevToolsAgent; |
| 20 } |
| 21 |
| 17 class RenderView; | 22 class RenderView; |
| 18 class WebDevToolsAgent; | |
| 19 | 23 |
| 20 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's | 24 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's |
| 21 // agents with the communication capabilities. All messages from/to Glue's | 25 // agents with the communication capabilities. All messages from/to Glue's |
| 22 // agents infrastructure are flowing through this comminucation agent. | 26 // agents infrastructure are flowing through this comminucation agent. |
| 23 // There is a corresponding DevToolsClient object on the client side. | 27 // There is a corresponding DevToolsClient object on the client side. |
| 24 class DevToolsAgent : public WebDevToolsAgentDelegate { | 28 class DevToolsAgent : public WebKit::WebDevToolsAgentClient { |
| 25 public: | 29 public: |
| 26 DevToolsAgent(int routing_id, RenderView* view); | 30 DevToolsAgent(int routing_id, RenderView* view); |
| 27 virtual ~DevToolsAgent(); | 31 virtual ~DevToolsAgent(); |
| 28 | 32 |
| 29 void OnNavigate(); | 33 void OnNavigate(); |
| 30 | 34 |
| 31 // IPC message interceptor. Called on the Render thread. | 35 // IPC message interceptor. Called on the Render thread. |
| 32 virtual bool OnMessageReceived(const IPC::Message& message); | 36 virtual bool OnMessageReceived(const IPC::Message& message); |
| 33 | 37 |
| 34 // WebDevToolsAgentDelegate implementation | 38 // WebDevToolsAgentClient implementation |
| 35 virtual void SendMessageToClient(const WebKit::WebString& class_name, | 39 virtual void sendMessageToFrontend(const WebKit::WebString& class_name, |
| 36 const WebKit::WebString& method_name, | 40 const WebKit::WebString& method_name, |
| 37 const WebKit::WebString& param1, | 41 const WebKit::WebString& param1, |
| 38 const WebKit::WebString& param2, | 42 const WebKit::WebString& param2, |
| 39 const WebKit::WebString& param3); | 43 const WebKit::WebString& param3); |
| 40 virtual int GetHostId(); | 44 virtual int hostIdentifier(); |
| 41 virtual void ForceRepaint(); | 45 virtual void forceRepaint(); |
| 42 | 46 |
| 43 // Returns agent instance for its host id. | 47 // Returns agent instance for its host id. |
| 44 static DevToolsAgent* FromHostId(int host_id); | 48 static DevToolsAgent* FromHostId(int host_id); |
| 45 | 49 |
| 46 RenderView* render_view() { return view_; } | 50 RenderView* render_view() { return view_; } |
| 47 | 51 |
| 48 WebDevToolsAgent* GetWebAgent(); | 52 WebKit::WebDevToolsAgent* GetWebAgent(); |
| 49 | 53 |
| 50 private: | 54 private: |
| 51 friend class DevToolsAgentFilter; | 55 friend class DevToolsAgentFilter; |
| 52 | 56 |
| 53 void OnAttach(); | 57 void OnAttach(); |
| 54 void OnDetach(); | 58 void OnDetach(); |
| 55 void OnRpcMessage(const std::string& class_name, | 59 void OnRpcMessage(const std::string& class_name, |
| 56 const std::string& method_name, | 60 const std::string& method_name, |
| 57 const std::string& param1, | 61 const std::string& param1, |
| 58 const std::string& param2, | 62 const std::string& param2, |
| 59 const std::string& param3); | 63 const std::string& param3); |
| 60 void OnInspectElement(int x, int y); | 64 void OnInspectElement(int x, int y); |
| 61 void OnSetApuAgentEnabled(bool enabled); | 65 void OnSetApuAgentEnabled(bool enabled); |
| 62 | 66 |
| 63 static std::map<int, DevToolsAgent*> agent_for_routing_id_; | 67 static std::map<int, DevToolsAgent*> agent_for_routing_id_; |
| 64 | 68 |
| 65 int routing_id_; // View routing id that we can access from IO thread. | 69 int routing_id_; // View routing id that we can access from IO thread. |
| 66 RenderView* view_; | 70 RenderView* view_; |
| 67 | 71 |
| 68 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | 72 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 #endif // CHROME_RENDERER_DEVTOOLS_AGENT_H_ | 75 #endif // CHROME_RENDERER_DEVTOOLS_AGENT_H_ |
| OLD | NEW |