| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_DEVTOOLS_AGENT_H_ | |
| 6 #define CONTENT_RENDERER_DEVTOOLS_AGENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 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/WebDevToolsAgentClien
t.h" | |
| 14 | |
| 15 namespace WebKit { | |
| 16 class WebDevToolsAgent; | |
| 17 } | |
| 18 | |
| 19 namespace content { | |
| 20 class RenderViewImpl; | |
| 21 | |
| 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(); | |
| 31 | |
| 32 // Returns agent instance for its host id. | |
| 33 static DevToolsAgent* FromHostId(int host_id); | |
| 34 | |
| 35 WebKit::WebDevToolsAgent* GetWebAgent(); | |
| 36 | |
| 37 bool IsAttached(); | |
| 38 | |
| 39 private: | |
| 40 friend class DevToolsAgentFilter; | |
| 41 | |
| 42 // RenderView::Observer implementation. | |
| 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 44 | |
| 45 // WebDevToolsAgentClient implementation | |
| 46 virtual void sendMessageToInspectorFrontend(const WebKit::WebString& data); | |
| 47 | |
| 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); | |
| 55 | |
| 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(); | |
| 65 | |
| 66 bool is_attached_; | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); | |
| 69 }; | |
| 70 | |
| 71 } // namespace content | |
| 72 | |
| 73 #endif // CONTENT_RENDERER_DEVTOOLS_AGENT_H_ | |
| OLD | NEW |