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