Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / content / renderer / devtools_agent.h
blob219a767d9729682383254b0dc9745d224fd10aa9
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_AGENT_H_
6 #define CONTENT_RENDERER_DEVTOOLS_AGENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "content/public/common/console_message_level.h"
12 #include "content/public/renderer/render_view_observer.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsAgentClient.h"
15 namespace WebKit {
16 class WebDevToolsAgent;
19 namespace content {
20 class RenderViewImpl;
22 // DevToolsAgent belongs to the inspectable RenderView and provides Glue's
23 // agents with the communication capabilities. All messages from/to Glue's
24 // agents infrastructure are flowing through this communication agent.
25 // There is a corresponding DevToolsClient object on the client side.
26 class DevToolsAgent : public RenderViewObserver,
27 public WebKit::WebDevToolsAgentClient {
28 public:
29 explicit DevToolsAgent(RenderViewImpl* render_view);
30 virtual ~DevToolsAgent();
32 // Returns agent instance for its host id.
33 static DevToolsAgent* FromHostId(int host_id);
35 WebKit::WebDevToolsAgent* GetWebAgent();
37 bool IsAttached();
39 private:
40 friend class DevToolsAgentFilter;
42 // RenderView::Observer implementation.
43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
45 // WebDevToolsAgentClient implementation
46 virtual void sendMessageToInspectorFrontend(const WebKit::WebString& data);
48 virtual int hostIdentifier();
49 virtual void saveAgentRuntimeState(const WebKit::WebString& state);
50 virtual WebKit::WebDevToolsAgentClient::WebKitClientMessageLoop*
51 createClientMessageLoop();
52 virtual void clearBrowserCache();
53 virtual void clearBrowserCookies();
54 virtual void visitAllocatedObjects(AllocatedObjectVisitor* visitor);
56 void OnAttach();
57 void OnReattach(const std::string& agent_state);
58 void OnDetach();
59 void OnDispatchOnInspectorBackend(const std::string& message);
60 void OnInspectElement(int x, int y);
61 void OnAddMessageToConsole(ConsoleMessageLevel level,
62 const std::string& message);
63 void ContinueProgram();
64 void OnSetupDevToolsClient();
66 bool is_attached_;
68 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent);
71 } // namespace content
73 #endif // CONTENT_RENDERER_DEVTOOLS_AGENT_H_