| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_RENDERER_DEVTOOLS_CLIENT_H_ | 5 #ifndef CHROME_RENDERER_DEVTOOLS_CLIENT_H_ |
| 6 #define CHROME_RENDERER_DEVTOOLS_CLIENT_H_ | 6 #define CHROME_RENDERER_DEVTOOLS_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontendClient.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontendClient.h" |
| 14 | 14 |
| 15 namespace IPC { | 15 namespace IPC { |
| 16 class Message; | 16 class Message; |
| 17 } | 17 } |
| 18 class MessageLoop; | 18 class MessageLoop; |
| 19 class RenderView; | 19 class RenderView; |
| 20 | 20 |
| 21 namespace WebKit { | 21 namespace WebKit { |
| 22 class WebDevToolsFrontend; | 22 class WebDevToolsFrontend; |
| 23 class WebString; |
| 23 } | 24 } |
| 24 | 25 |
| 25 struct DevToolsMessageData; | 26 struct DevToolsMessageData; |
| 26 | 27 |
| 27 // Developer tools UI end of communication channel between the render process of | 28 // Developer tools UI end of communication channel between the render process of |
| 28 // the page being inspected and tools UI renderer process. All messages will | 29 // the page being inspected and tools UI renderer process. All messages will |
| 29 // go through browser process. On the side of the inspected page there's | 30 // go through browser process. On the side of the inspected page there's |
| 30 // corresponding DevToolsAgent object. | 31 // corresponding DevToolsAgent object. |
| 31 // TODO(yurys): now the client is almost empty later it will delegate calls to | 32 // TODO(yurys): now the client is almost empty later it will delegate calls to |
| 32 // code in glue | 33 // code in glue |
| 33 class DevToolsClient : public WebKit::WebDevToolsFrontendClient { | 34 class DevToolsClient : public WebKit::WebDevToolsFrontendClient { |
| 34 public: | 35 public: |
| 35 explicit DevToolsClient(RenderView* view); | 36 explicit DevToolsClient(RenderView* view); |
| 36 virtual ~DevToolsClient(); | 37 virtual ~DevToolsClient(); |
| 37 | 38 |
| 38 // Called to possibly handle the incoming IPC message. Returns true if | 39 // Called to possibly handle the incoming IPC message. Returns true if |
| 39 // handled. Called in render thread. | 40 // handled. Called in render thread. |
| 40 bool OnMessageReceived(const IPC::Message& message); | 41 bool OnMessageReceived(const IPC::Message& message); |
| 41 | 42 |
| 42 // WebDevToolsFrontendClient implementation | 43 // WebDevToolsFrontendClient implementation |
| 43 virtual void sendMessageToAgent( | 44 virtual void sendMessageToBackend(const WebKit::WebString&); |
| 44 const WebKit::WebDevToolsMessageData& data); | |
| 45 virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command); | 45 virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command); |
| 46 virtual void sendDebuggerPauseScript(); | 46 virtual void sendDebuggerPauseScript(); |
| 47 | 47 |
| 48 virtual void activateWindow(); | 48 virtual void activateWindow(); |
| 49 virtual void closeWindow(); | 49 virtual void closeWindow(); |
| 50 virtual void requestDockWindow(); | 50 virtual void requestDockWindow(); |
| 51 virtual void requestUndockWindow(); | 51 virtual void requestUndockWindow(); |
| 52 | 52 |
| 53 virtual bool shouldHideScriptsPanel(); | 53 virtual bool shouldHideScriptsPanel(); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 void OnRpcMessage(const DevToolsMessageData& data); | 56 void OnDispatchOnInspectorFrontend(const std::string& message); |
| 57 | 57 |
| 58 // Sends message to DevToolsAgent. | 58 // Sends message to DevToolsAgent. |
| 59 void Send(const IPC::Message& tools_agent_message); | 59 void Send(const IPC::Message& tools_agent_message); |
| 60 | 60 |
| 61 RenderView* render_view_; // host render view | 61 RenderView* render_view_; // host render view |
| 62 scoped_ptr<WebKit::WebDevToolsFrontend> web_tools_frontend_; | 62 scoped_ptr<WebKit::WebDevToolsFrontend> web_tools_frontend_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(DevToolsClient); | 64 DISALLOW_COPY_AND_ASSIGN(DevToolsClient); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 #endif // CHROME_RENDERER_DEVTOOLS_CLIENT_H_ | 67 #endif // CHROME_RENDERER_DEVTOOLS_CLIENT_H_ |
| OLD | NEW |