Add ICU message format support
[chromium-blink-merge.git] / content / renderer / devtools / devtools_agent.h
blob7b1200ba98d09cfd296947db2ebb261d8dc4fa5f
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_
6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_
8 #include <string>
10 #include "content/common/content_export.h"
11 #include "content/public/common/console_message_level.h"
12 #include "content/public/renderer/render_frame_observer.h"
13 #include "third_party/WebKit/public/web/WebDevToolsAgentClient.h"
15 namespace blink {
16 class WebDevToolsAgent;
19 namespace content {
21 class RenderFrameImpl;
23 // DevToolsAgent belongs to the inspectable RenderFrameImpl and communicates
24 // with WebDevToolsAgent. There is a corresponding DevToolsAgentHost
25 // on the browser side.
26 class CONTENT_EXPORT DevToolsAgent
27 : public RenderFrameObserver,
28 NON_EXPORTED_BASE(public blink::WebDevToolsAgentClient) {
29 public:
30 explicit DevToolsAgent(RenderFrameImpl* frame);
31 ~DevToolsAgent() override;
33 // Returns agent instance for its routing id.
34 static DevToolsAgent* FromRoutingId(int routing_id);
36 static void SendChunkedProtocolMessage(
37 IPC::Sender* sender,
38 int routing_id,
39 int call_id,
40 const std::string& message,
41 const std::string& post_state);
43 blink::WebDevToolsAgent* GetWebAgent();
45 bool IsAttached();
47 void AddMessageToConsole(ConsoleMessageLevel level,
48 const std::string& message);
50 private:
51 friend class DevToolsAgentTest;
53 // RenderFrameObserver implementation.
54 bool OnMessageReceived(const IPC::Message& message) override;
55 void WidgetWillClose() override;
57 // WebDevToolsAgentClient implementation.
58 void sendProtocolMessage(int call_id,
59 const blink::WebString& response,
60 const blink::WebString& state) override;
61 blink::WebDevToolsAgentClient::WebKitClientMessageLoop*
62 createClientMessageLoop() override;
63 void willEnterDebugLoop() override;
64 void didExitDebugLoop() override;
66 void enableTracing(const blink::WebString& category_filter) override;
67 void disableTracing() override;
69 void OnAttach(const std::string& host_id);
70 void OnReattach(const std::string& host_id,
71 const std::string& agent_state);
72 void OnDetach();
73 void OnDispatchOnInspectorBackend(const std::string& message);
74 void OnInspectElement(const std::string& host_id, int x, int y);
75 void ContinueProgram();
76 void OnSetupDevToolsClient(const std::string& compatibility_script);
78 bool is_attached_;
79 bool is_devtools_client_;
80 bool paused_in_mouse_move_;
81 bool paused_;
82 RenderFrameImpl* frame_;
84 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent);
87 } // namespace content
89 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_H_