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 "content/common/content_export.h" |
10 #include "content/public/common/console_message_level.h" | 11 #include "content/public/common/console_message_level.h" |
11 #include "content/public/renderer/render_frame_observer.h" | 12 #include "content/public/renderer/render_frame_observer.h" |
12 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h" | 13 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 class WebDevToolsAgent; | 16 class WebDevToolsAgent; |
16 } | 17 } |
17 | 18 |
18 namespace content { | 19 namespace content { |
19 | 20 |
20 class RenderFrameImpl; | 21 class RenderFrameImpl; |
21 | 22 |
22 // DevToolsAgent belongs to the inspectable RenderFrameImpl and communicates | 23 // DevToolsAgent belongs to the inspectable RenderFrameImpl and communicates |
23 // with WebDevToolsAgent. There is a corresponding DevToolsAgentHost | 24 // with WebDevToolsAgent. There is a corresponding DevToolsAgentHost |
24 // on the browser side. | 25 // on the browser side. |
25 class DevToolsAgent : public RenderFrameObserver, | 26 class CONTENT_EXPORT DevToolsAgent |
26 public blink::WebDevToolsAgentClient { | 27 : public RenderFrameObserver, |
| 28 NON_EXPORTED_BASE(public blink::WebDevToolsAgentClient) { |
27 public: | 29 public: |
28 explicit DevToolsAgent(RenderFrameImpl* frame); | 30 explicit DevToolsAgent(RenderFrameImpl* frame); |
29 ~DevToolsAgent() override; | 31 ~DevToolsAgent() override; |
30 | 32 |
31 // Returns agent instance for its routing id. | 33 // Returns agent instance for its routing id. |
32 static DevToolsAgent* FromRoutingId(int routing_id); | 34 static DevToolsAgent* FromRoutingId(int routing_id); |
33 | 35 |
34 static void SendChunkedProtocolMessage( | 36 static void SendChunkedProtocolMessage( |
35 IPC::Sender* sender, | 37 IPC::Sender* sender, |
36 int routing_id, | 38 int routing_id, |
37 int call_id, | 39 int call_id, |
38 const std::string& message, | 40 const std::string& message, |
39 const std::string& post_state); | 41 const std::string& post_state); |
40 | 42 |
41 blink::WebDevToolsAgent* GetWebAgent(); | 43 blink::WebDevToolsAgent* GetWebAgent(); |
42 | 44 |
43 bool IsAttached(); | 45 bool IsAttached(); |
44 | 46 |
45 private: | 47 private: |
| 48 friend class DevToolsAgentTest; |
| 49 |
46 // RenderFrameObserver implementation. | 50 // RenderFrameObserver implementation. |
47 bool OnMessageReceived(const IPC::Message& message) override; | 51 bool OnMessageReceived(const IPC::Message& message) override; |
| 52 void WidgetWillClose() override; |
48 | 53 |
49 // WebDevToolsAgentClient implementation. | 54 // WebDevToolsAgentClient implementation. |
50 void sendProtocolMessage(int call_id, | 55 void sendProtocolMessage(int call_id, |
51 const blink::WebString& response, | 56 const blink::WebString& response, |
52 const blink::WebString& state) override; | 57 const blink::WebString& state) override; |
53 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* | 58 blink::WebDevToolsAgentClient::WebKitClientMessageLoop* |
54 createClientMessageLoop() override; | 59 createClientMessageLoop() override; |
55 void willEnterDebugLoop() override; | 60 void willEnterDebugLoop() override; |
56 void didExitDebugLoop() override; | 61 void didExitDebugLoop() override; |
57 | 62 |
58 void enableTracing(const blink::WebString& category_filter) override; | 63 void enableTracing(const blink::WebString& category_filter) override; |
59 void disableTracing() override; | 64 void disableTracing() override; |
60 | 65 |
61 void OnAttach(const std::string& host_id); | 66 void OnAttach(const std::string& host_id); |
62 void OnReattach(const std::string& host_id, | 67 void OnReattach(const std::string& host_id, |
63 const std::string& agent_state); | 68 const std::string& agent_state); |
64 void OnDetach(); | 69 void OnDetach(); |
65 void OnDispatchOnInspectorBackend(const std::string& message); | 70 void OnDispatchOnInspectorBackend(const std::string& message); |
66 void OnInspectElement(const std::string& host_id, int x, int y); | 71 void OnInspectElement(const std::string& host_id, int x, int y); |
67 void OnAddMessageToConsole(ConsoleMessageLevel level, | 72 void OnAddMessageToConsole(ConsoleMessageLevel level, |
68 const std::string& message); | 73 const std::string& message); |
69 void ContinueProgram(); | 74 void ContinueProgram(); |
70 void OnSetupDevToolsClient(); | 75 void OnSetupDevToolsClient(); |
71 | 76 |
72 bool is_attached_; | 77 bool is_attached_; |
73 bool is_devtools_client_; | 78 bool is_devtools_client_; |
74 bool paused_in_mouse_move_; | 79 bool paused_in_mouse_move_; |
| 80 bool paused_; |
75 RenderFrameImpl* frame_; | 81 RenderFrameImpl* frame_; |
76 | 82 |
77 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | 83 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
78 }; | 84 }; |
79 | 85 |
80 } // namespace content | 86 } // namespace content |
81 | 87 |
82 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ | 88 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_ |
OLD | NEW |