| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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 CHROME_RENDERER_DEV_TOOLS_AGENT_H_ |
| 6 #define CHROME_RENDERER_DEV_TOOLS_AGENT_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/ref_counted.h" |
| 12 #include "base/scoped_ptr.h" |
| 13 #include "chrome/common/ipc_channel_proxy.h" |
| 14 #include "webkit/glue/debugger_bridge.h" |
| 15 |
| 16 class MessageLoop; |
| 17 class RenderView; |
| 18 |
| 19 // Inspected page end of communication channel between the render process of |
| 20 // the page being inspected and tools UI renderer process. All messages will |
| 21 // go through browser process. On the renderer side of the tools UI there's |
| 22 // a corresponding ToolsClient object. |
| 23 class DevToolsAgent : public IPC::ChannelProxy::MessageFilter, |
| 24 public DebuggerBridge::Delegate { |
| 25 public: |
| 26 // DevToolsAgent is a field of the RenderView. The view is supposed to remove |
| 27 // this agent from message filter list on IO thread before dying. |
| 28 explicit DevToolsAgent(RenderView* view, MessageLoop* view_loop); |
| 29 virtual ~DevToolsAgent(); |
| 30 |
| 31 private: |
| 32 // Sends message to DevToolsClient. May be called on any thread. |
| 33 void Send(const IPC::Message& tools_client_message); |
| 34 |
| 35 // Sends message to DevToolsClient. Must be called on IO thread. Takes |
| 36 // ownership of the message. |
| 37 void SendFromIOThread(IPC::Message* message); |
| 38 |
| 39 // IPC::ChannelProxy::MessageFilter overrides. Called on IO thread. |
| 40 virtual void OnFilterAdded(IPC::Channel* channel); |
| 41 virtual bool OnMessageReceived(const IPC::Message& message); |
| 42 virtual void OnFilterRemoved(); |
| 43 |
| 44 // Debugger::Delegate callback method to handle debugger output. |
| 45 void DebuggerOutput(const std::wstring& out); |
| 46 |
| 47 // Evaluate javascript URL in the renderer |
| 48 void EvaluateScript(const std::wstring& script); |
| 49 |
| 50 // All these OnXXX methods will be executed in IO thread so that we can |
| 51 // handle debug messages even when v8 is stopped. |
| 52 void OnDebugAttach(); |
| 53 void OnDebugDetach(); |
| 54 void OnDebugBreak(bool force); |
| 55 void OnDebugCommand(const std::wstring& cmd); |
| 56 |
| 57 scoped_refptr<DebuggerBridge> debugger_; |
| 58 |
| 59 RenderView* view_; |
| 60 MessageLoop* view_loop_; |
| 61 |
| 62 IPC::Channel* channel_; |
| 63 MessageLoop* io_loop_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(DevToolsAgent); |
| 66 }; |
| 67 |
| 68 #endif // CHROME_RENDERER_DEV_TOOLS_AGENT_H_ |
| 69 |
| OLD | NEW |