OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_CLIENT_HOST_H_ |
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_CLIENT_HOST_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 "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 | 13 |
14 namespace IPC { | 14 namespace IPC { |
15 class Message; | 15 class Message; |
16 } | 16 } |
17 | 17 |
| 18 class RenderViewHost; |
18 class TabContents; | 19 class TabContents; |
19 | 20 |
| 21 namespace content { |
| 22 |
| 23 class DevToolsFrontendHostDelegate; |
| 24 |
20 // Describes interface for managing devtools clients from browser process. There | 25 // Describes interface for managing devtools clients from browser process. There |
21 // are currently two types of clients: devtools windows and TCP socket | 26 // are currently two types of clients: devtools windows and TCP socket |
22 // debuggers. | 27 // debuggers. |
23 class CONTENT_EXPORT DevToolsClientHost { | 28 class CONTENT_EXPORT DevToolsClientHost { |
24 public: | 29 public: |
25 class CONTENT_EXPORT CloseListener { | 30 virtual ~DevToolsClientHost() {} |
26 public: | |
27 CloseListener() {} | |
28 virtual ~CloseListener() {} | |
29 virtual void ClientHostClosing(DevToolsClientHost* host) = 0; | |
30 private: | |
31 DISALLOW_COPY_AND_ASSIGN(CloseListener); | |
32 }; | |
33 | 31 |
34 virtual ~DevToolsClientHost(); | 32 // Dispatches given message on the front-end. |
| 33 virtual void DispatchOnInspectorFrontend(const std::string& message) = 0; |
35 | 34 |
36 // This method is called when tab inspected by this devtools client is | 35 // This method is called when tab inspected by this devtools client is |
37 // closing. | 36 // closing. |
38 virtual void InspectedTabClosing() = 0; | 37 virtual void InspectedTabClosing() = 0; |
39 | 38 |
40 // This method is called when tab inspected by this devtools client is | 39 // This method is called when tab inspected by this devtools client is |
41 // navigating to |url|. | 40 // navigating to |url|. |
42 virtual void FrameNavigating(const std::string& url) = 0; | 41 virtual void FrameNavigating(const std::string& url) = 0; |
43 | 42 |
44 // Sends the message to the devtools client hosted by this object. | |
45 virtual void SendMessageToClient(const IPC::Message& msg) = 0; | |
46 | |
47 void set_close_listener(CloseListener* listener) { | |
48 close_listener_ = listener; | |
49 } | |
50 | |
51 // Invoked when a tab is replaced by another tab. This is triggered by | 43 // Invoked when a tab is replaced by another tab. This is triggered by |
52 // TabStripModel::ReplaceTabContentsAt. | 44 // TabStripModel::ReplaceTabContentsAt. |
53 virtual void TabReplaced(TabContents* new_tab) = 0; | 45 virtual void TabReplaced(TabContents* new_tab) = 0; |
54 | 46 |
55 protected: | 47 // Creates DevToolsClientHost for TabContents containing default DevTools |
56 DevToolsClientHost(); | 48 // frontend implementation. |
| 49 static DevToolsClientHost* CreateDevToolsFrontendHost( |
| 50 TabContents* client_tab_contents, |
| 51 DevToolsFrontendHostDelegate* delegate); |
57 | 52 |
58 void ForwardToDevToolsAgent(const IPC::Message& message); | 53 // Sets up DevToolsClient on the corresponding RenderView. |
59 | 54 static void SetupDevToolsFrontendClient(RenderViewHost* frontend_rvh); |
60 // Should be called when the devtools client is going to die and this | |
61 // DevToolsClientHost should not be used anymore. | |
62 void NotifyCloseListener(); | |
63 | |
64 private: | |
65 CloseListener* close_listener_; | |
66 DISALLOW_COPY_AND_ASSIGN(DevToolsClientHost); | |
67 }; | 55 }; |
68 | 56 |
69 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ | 57 } // namespace content |
| 58 |
| 59 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_CLIENT_HOST_H_ |
OLD | NEW |