| 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_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 5 #ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
| 6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // agents with the communication capabilities. All messages from/to Glue's | 29 // agents with the communication capabilities. All messages from/to Glue's |
| 30 // agents infrastructure are flowing through this communication agent. | 30 // agents infrastructure are flowing through this communication agent. |
| 31 // There is a corresponding DevToolsClient object on the client side. | 31 // There is a corresponding DevToolsClient object on the client side. |
| 32 class DevToolsAgent : public RenderViewObserver, | 32 class DevToolsAgent : public RenderViewObserver, |
| 33 public base::SupportsWeakPtr<DevToolsAgent>, | 33 public base::SupportsWeakPtr<DevToolsAgent>, |
| 34 public blink::WebDevToolsAgentClient { | 34 public blink::WebDevToolsAgentClient { |
| 35 public: | 35 public: |
| 36 explicit DevToolsAgent(RenderViewImpl* render_view); | 36 explicit DevToolsAgent(RenderViewImpl* render_view); |
| 37 virtual ~DevToolsAgent(); | 37 virtual ~DevToolsAgent(); |
| 38 | 38 |
| 39 // Returns agent instance for its host id. | 39 // Returns agent instance for its routing id. |
| 40 static DevToolsAgent* FromHostId(int host_id); | 40 static DevToolsAgent* FromRoutingId(int routing_id); |
| 41 | 41 |
| 42 blink::WebDevToolsAgent* GetWebAgent(); | 42 blink::WebDevToolsAgent* GetWebAgent(); |
| 43 | 43 |
| 44 bool IsAttached(); | 44 bool IsAttached(); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 // RenderView::Observer implementation. | 47 // RenderView::Observer implementation. |
| 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 48 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 49 | 49 |
| 50 // WebDevToolsAgentClient implementation | 50 // WebDevToolsAgentClient implementation |
| 51 virtual void sendMessageToInspectorFrontend(const blink::WebString& data); | 51 virtual void sendMessageToInspectorFrontend(const blink::WebString& data); |
| 52 | 52 |
| 53 virtual int hostIdentifier() OVERRIDE; | 53 virtual int hostIdentifier() OVERRIDE; |
| 54 virtual int debuggerId() OVERRIDE; |
| 54 virtual void saveAgentRuntimeState(const blink::WebString& state) OVERRIDE; | 55 virtual void saveAgentRuntimeState(const blink::WebString& state) OVERRIDE; |
| 55 virtual blink::WebDevToolsAgentClient::WebKitClientMessageLoop* | 56 virtual blink::WebDevToolsAgentClient::WebKitClientMessageLoop* |
| 56 createClientMessageLoop() OVERRIDE; | 57 createClientMessageLoop() OVERRIDE; |
| 57 virtual void willEnterDebugLoop() OVERRIDE; | 58 virtual void willEnterDebugLoop() OVERRIDE; |
| 58 virtual void didExitDebugLoop() OVERRIDE; | 59 virtual void didExitDebugLoop() OVERRIDE; |
| 59 virtual void visitAllocatedObjects(AllocatedObjectVisitor* visitor) OVERRIDE; | 60 virtual void visitAllocatedObjects(AllocatedObjectVisitor* visitor) OVERRIDE; |
| 60 | 61 |
| 61 typedef void (*TraceEventCallback)( | 62 typedef void (*TraceEventCallback)( |
| 62 char phase, const unsigned char*, const char* name, unsigned long long id, | 63 char phase, const unsigned char*, const char* name, unsigned long long id, |
| 63 int numArgs, const char* const* argNames, const unsigned char* argTypes, | 64 int numArgs, const char* const* argNames, const unsigned char* argTypes, |
| 64 const unsigned long long* argValues, | 65 const unsigned long long* argValues, |
| 65 unsigned char flags, double timestamp); | 66 unsigned char flags, double timestamp); |
| 66 virtual void resetTraceEventCallback() OVERRIDE; | 67 virtual void resetTraceEventCallback() OVERRIDE; |
| 67 virtual void setTraceEventCallback(const blink::WebString& category_filter, | 68 virtual void setTraceEventCallback(const blink::WebString& category_filter, |
| 68 TraceEventCallback cb) OVERRIDE; | 69 TraceEventCallback cb) OVERRIDE; |
| 69 virtual void enableTracing(const blink::WebString& category_filter) OVERRIDE; | 70 virtual void enableTracing(const blink::WebString& category_filter) OVERRIDE; |
| 70 virtual void disableTracing() OVERRIDE; | 71 virtual void disableTracing() OVERRIDE; |
| 71 virtual void startGPUEventsRecording() OVERRIDE; | 72 virtual void startGPUEventsRecording() OVERRIDE; |
| 72 virtual void stopGPUEventsRecording() OVERRIDE; | 73 virtual void stopGPUEventsRecording() OVERRIDE; |
| 73 | 74 |
| 74 virtual void enableDeviceEmulation( | 75 virtual void enableDeviceEmulation( |
| 75 const blink::WebDeviceEmulationParams& params) OVERRIDE; | 76 const blink::WebDeviceEmulationParams& params) OVERRIDE; |
| 76 virtual void disableDeviceEmulation() OVERRIDE; | 77 virtual void disableDeviceEmulation() OVERRIDE; |
| 77 virtual void setTouchEventEmulationEnabled(bool enabled, | 78 virtual void setTouchEventEmulationEnabled(bool enabled, |
| 78 bool allow_pinch) OVERRIDE; | 79 bool allow_pinch) OVERRIDE; |
| 79 | 80 |
| 80 void OnAttach(); | 81 void OnAttach(const std::string& host_id); |
| 81 void OnReattach(const std::string& agent_state); | 82 void OnReattach(const std::string& host_id, |
| 83 const std::string& agent_state); |
| 82 void OnDetach(); | 84 void OnDetach(); |
| 83 void OnDispatchOnInspectorBackend(const std::string& message); | 85 void OnDispatchOnInspectorBackend(const std::string& message); |
| 84 void OnInspectElement(int x, int y); | 86 void OnInspectElement(const std::string& host_id, int x, int y); |
| 85 void OnAddMessageToConsole(ConsoleMessageLevel level, | 87 void OnAddMessageToConsole(ConsoleMessageLevel level, |
| 86 const std::string& message); | 88 const std::string& message); |
| 87 void OnGpuTasksChunk(const std::vector<GpuTaskInfo>& tasks); | 89 void OnGpuTasksChunk(const std::vector<GpuTaskInfo>& tasks); |
| 88 void ContinueProgram(); | 90 void ContinueProgram(); |
| 89 void OnSetupDevToolsClient(); | 91 void OnSetupDevToolsClient(); |
| 90 | 92 |
| 91 static void TraceEventCallbackWrapper( | 93 static void TraceEventCallbackWrapper( |
| 92 base::TimeTicks timestamp, | 94 base::TimeTicks timestamp, |
| 93 char phase, | 95 char phase, |
| 94 const unsigned char* category_group_enabled, | 96 const unsigned char* category_group_enabled, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 106 bool paused_in_mouse_move_; | 108 bool paused_in_mouse_move_; |
| 107 | 109 |
| 108 static base::subtle::AtomicWord /* TraceEventCallback */ event_callback_; | 110 static base::subtle::AtomicWord /* TraceEventCallback */ event_callback_; |
| 109 | 111 |
| 110 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | 112 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
| 111 }; | 113 }; |
| 112 | 114 |
| 113 } // namespace content | 115 } // namespace content |
| 114 | 116 |
| 115 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 117 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
| OLD | NEW |