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 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "content/public/common/console_message_level.h" | 13 #include "content/public/common/console_message_level.h" |
14 #include "content/public/renderer/render_view_observer.h" | 14 #include "content/public/renderer/render_view_observer.h" |
15 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h" | 15 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h" |
16 | 16 |
17 namespace WebKit { | 17 namespace blink { |
18 class WebDevToolsAgent; | 18 class WebDevToolsAgent; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class RenderViewImpl; | 22 class RenderViewImpl; |
23 | 23 |
24 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's | 24 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's |
25 // agents with the communication capabilities. All messages from/to Glue's | 25 // agents with the communication capabilities. All messages from/to Glue's |
26 // agents infrastructure are flowing through this communication agent. | 26 // agents infrastructure are flowing through this communication agent. |
27 // There is a corresponding DevToolsClient object on the client side. | 27 // There is a corresponding DevToolsClient object on the client side. |
28 class DevToolsAgent : public RenderViewObserver, | 28 class DevToolsAgent : public RenderViewObserver, |
29 public WebKit::WebDevToolsAgentClient { | 29 public blink::WebDevToolsAgentClient { |
30 public: | 30 public: |
31 explicit DevToolsAgent(RenderViewImpl* render_view); | 31 explicit DevToolsAgent(RenderViewImpl* render_view); |
32 virtual ~DevToolsAgent(); | 32 virtual ~DevToolsAgent(); |
33 | 33 |
34 // Returns agent instance for its host id. | 34 // Returns agent instance for its host id. |
35 static DevToolsAgent* FromHostId(int host_id); | 35 static DevToolsAgent* FromHostId(int host_id); |
36 | 36 |
37 WebKit::WebDevToolsAgent* GetWebAgent(); | 37 blink::WebDevToolsAgent* GetWebAgent(); |
38 | 38 |
39 bool IsAttached(); | 39 bool IsAttached(); |
40 | 40 |
41 private: | 41 private: |
42 friend class DevToolsAgentFilter; | 42 friend class DevToolsAgentFilter; |
43 | 43 |
44 // RenderView::Observer implementation. | 44 // RenderView::Observer implementation. |
45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
46 | 46 |
47 // WebDevToolsAgentClient implementation | 47 // WebDevToolsAgentClient implementation |
48 virtual void sendMessageToInspectorFrontend(const WebKit::WebString& data); | 48 virtual void sendMessageToInspectorFrontend(const blink::WebString& data); |
49 | 49 |
50 virtual int hostIdentifier(); | 50 virtual int hostIdentifier(); |
51 virtual void saveAgentRuntimeState(const WebKit::WebString& state); | 51 virtual void saveAgentRuntimeState(const blink::WebString& state); |
52 virtual WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop* | 52 virtual blink::WebDevToolsAgentClient::WebKitClientMessageLoop* |
53 createClientMessageLoop(); | 53 createClientMessageLoop(); |
54 virtual void clearBrowserCache(); | 54 virtual void clearBrowserCache(); |
55 virtual void clearBrowserCookies(); | 55 virtual void clearBrowserCookies(); |
56 virtual void visitAllocatedObjects(AllocatedObjectVisitor* visitor); | 56 virtual void visitAllocatedObjects(AllocatedObjectVisitor* visitor); |
57 | 57 |
58 typedef void (*TraceEventCallback)( | 58 typedef void (*TraceEventCallback)( |
59 char phase, const unsigned char*, const char* name, unsigned long long id, | 59 char phase, const unsigned char*, const char* name, unsigned long long id, |
60 int numArgs, const char* const* argNames, const unsigned char* argTypes, | 60 int numArgs, const char* const* argNames, const unsigned char* argTypes, |
61 const unsigned long long* argValues, | 61 const unsigned long long* argValues, |
62 unsigned char flags, double timestamp); | 62 unsigned char flags, double timestamp); |
63 virtual void setTraceEventCallback(TraceEventCallback cb); | 63 virtual void setTraceEventCallback(TraceEventCallback cb); |
64 | 64 |
65 virtual void enableDeviceEmulation( | 65 virtual void enableDeviceEmulation( |
66 const WebKit::WebSize& device_size, | 66 const blink::WebSize& device_size, |
67 const WebKit::WebRect& view_rect, float device_scale_factor, | 67 const blink::WebRect& view_rect, float device_scale_factor, |
68 bool fit_to_view); | 68 bool fit_to_view); |
69 virtual void disableDeviceEmulation(); | 69 virtual void disableDeviceEmulation(); |
70 | 70 |
71 void OnAttach(); | 71 void OnAttach(); |
72 void OnReattach(const std::string& agent_state); | 72 void OnReattach(const std::string& agent_state); |
73 void OnDetach(); | 73 void OnDetach(); |
74 void OnDispatchOnInspectorBackend(const std::string& message); | 74 void OnDispatchOnInspectorBackend(const std::string& message); |
75 void OnInspectElement(int x, int y); | 75 void OnInspectElement(int x, int y); |
76 void OnAddMessageToConsole(ConsoleMessageLevel level, | 76 void OnAddMessageToConsole(ConsoleMessageLevel level, |
77 const std::string& message); | 77 const std::string& message); |
(...skipping 16 matching lines...) Expand all Loading... |
94 bool is_devtools_client_; | 94 bool is_devtools_client_; |
95 | 95 |
96 static base::subtle::AtomicWord /* TraceEventCallback */ event_callback_; | 96 static base::subtle::AtomicWord /* TraceEventCallback */ event_callback_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | 98 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace content | 101 } // namespace content |
102 | 102 |
103 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 103 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
OLD | NEW |