| 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 "ipc/ipc_channel.h" | 13 #include "chrome/renderer/render_view_observer.h" |
| 14 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontendClient.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontendClient.h" |
| 15 | 15 |
| 16 class MessageLoop; | 16 class MessageLoop; |
| 17 class RenderView; | |
| 18 | 17 |
| 19 namespace WebKit { | 18 namespace WebKit { |
| 20 class WebDevToolsFrontend; | 19 class WebDevToolsFrontend; |
| 21 class WebString; | 20 class WebString; |
| 22 } | 21 } |
| 23 | 22 |
| 24 struct DevToolsMessageData; | 23 struct DevToolsMessageData; |
| 25 | 24 |
| 26 // Developer tools UI end of communication channel between the render process of | 25 // Developer tools UI end of communication channel between the render process of |
| 27 // the page being inspected and tools UI renderer process. All messages will | 26 // the page being inspected and tools UI renderer process. All messages will |
| 28 // go through browser process. On the side of the inspected page there's | 27 // go through browser process. On the side of the inspected page there's |
| 29 // corresponding DevToolsAgent object. | 28 // corresponding DevToolsAgent object. |
| 30 // TODO(yurys): now the client is almost empty later it will delegate calls to | 29 // TODO(yurys): now the client is almost empty later it will delegate calls to |
| 31 // code in glue | 30 // code in glue |
| 32 class DevToolsClient : public WebKit::WebDevToolsFrontendClient, | 31 class DevToolsClient : public RenderViewObserver, |
| 33 public IPC::Channel::Listener { | 32 public WebKit::WebDevToolsFrontendClient { |
| 34 public: | 33 public: |
| 35 explicit DevToolsClient(RenderView* view); | 34 explicit DevToolsClient(RenderView* render_view); |
| 36 virtual ~DevToolsClient(); | 35 virtual ~DevToolsClient(); |
| 37 | 36 |
| 38 // IPC::Channel::Listener implementation. | 37 private: |
| 39 bool OnMessageReceived(const IPC::Message& message); | 38 // RenderView::Observer implementation. |
| 39 virtual bool OnMessageReceived(const IPC::Message& message); |
| 40 | 40 |
| 41 // WebDevToolsFrontendClient implementation | 41 // WebDevToolsFrontendClient implementation |
| 42 virtual void sendFrontendLoaded(); | 42 virtual void sendFrontendLoaded(); |
| 43 virtual void sendMessageToBackend(const WebKit::WebString&); | 43 virtual void sendMessageToBackend(const WebKit::WebString&); |
| 44 virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command); | 44 virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command); |
| 45 | 45 |
| 46 virtual void activateWindow(); | 46 virtual void activateWindow(); |
| 47 virtual void closeWindow(); | 47 virtual void closeWindow(); |
| 48 virtual void requestDockWindow(); | 48 virtual void requestDockWindow(); |
| 49 virtual void requestUndockWindow(); | 49 virtual void requestUndockWindow(); |
| 50 | 50 |
| 51 virtual bool shouldHideScriptsPanel(); | 51 virtual bool shouldHideScriptsPanel(); |
| 52 | 52 |
| 53 private: | |
| 54 void OnDispatchOnInspectorFrontend(const std::string& message); | 53 void OnDispatchOnInspectorFrontend(const std::string& message); |
| 55 | 54 |
| 56 // Sends message to DevToolsAgent. | 55 // Sends message to DevToolsAgent. |
| 57 void Send(const IPC::Message& tools_agent_message); | 56 void SendToAgent(const IPC::Message& tools_agent_message); |
| 58 | 57 |
| 59 RenderView* render_view_; // host render view | |
| 60 scoped_ptr<WebKit::WebDevToolsFrontend> web_tools_frontend_; | 58 scoped_ptr<WebKit::WebDevToolsFrontend> web_tools_frontend_; |
| 61 | 59 |
| 62 DISALLOW_COPY_AND_ASSIGN(DevToolsClient); | 60 DISALLOW_COPY_AND_ASSIGN(DevToolsClient); |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 #endif // CHROME_RENDERER_DEVTOOLS_CLIENT_H_ | 63 #endif // CHROME_RENDERER_DEVTOOLS_CLIENT_H_ |
| OLD | NEW |