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_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ |
6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ | 6 #define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | |
11 | 10 |
12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
13 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
14 | 13 |
15 namespace IPC { | 14 namespace IPC { |
16 class Message; | 15 class Message; |
17 } | 16 } |
18 | 17 |
19 class RenderViewHost; | |
20 class TabContents; | 18 class TabContents; |
21 | 19 |
22 // Describes interface for managing devtools clients from browser process. There | 20 // Describes interface for managing devtools clients from browser process. There |
23 // are currently two types of clients: devtools windows and TCP socket | 21 // are currently two types of clients: devtools windows and TCP socket |
24 // debuggers. | 22 // debuggers. |
25 class CONTENT_EXPORT DevToolsClientHost { | 23 class CONTENT_EXPORT DevToolsClientHost { |
26 public: | 24 public: |
27 class CONTENT_EXPORT CloseListener { | 25 class CONTENT_EXPORT CloseListener { |
28 public: | 26 public: |
29 CloseListener() {} | 27 CloseListener() {} |
30 virtual ~CloseListener() {} | 28 virtual ~CloseListener() {} |
31 virtual void ClientHostClosing(DevToolsClientHost* host) = 0; | 29 virtual void ClientHostClosing(DevToolsClientHost* host) = 0; |
32 private: | 30 private: |
33 DISALLOW_COPY_AND_ASSIGN(CloseListener); | 31 DISALLOW_COPY_AND_ASSIGN(CloseListener); |
34 }; | 32 }; |
35 | 33 |
36 static DevToolsClientHost* FindOwnerClientHost(RenderViewHost* client_rvh); | |
37 | |
38 virtual ~DevToolsClientHost(); | 34 virtual ~DevToolsClientHost(); |
39 | 35 |
40 // This method is called when tab inspected by this devtools client is | 36 // This method is called when tab inspected by this devtools client is |
41 // closing. | 37 // closing. |
42 virtual void InspectedTabClosing() = 0; | 38 virtual void InspectedTabClosing() = 0; |
43 | 39 |
44 // This method is called when tab inspected by this devtools client is | 40 // This method is called when tab inspected by this devtools client is |
45 // navigating to |url|. | 41 // navigating to |url|. |
46 virtual void FrameNavigating(const std::string& url) = 0; | 42 virtual void FrameNavigating(const std::string& url) = 0; |
47 | 43 |
48 // Sends the message to the devtools client hosted by this object. | 44 // Sends the message to the devtools client hosted by this object. |
49 virtual void SendMessageToClient(const IPC::Message& msg) = 0; | 45 virtual void SendMessageToClient(const IPC::Message& msg) = 0; |
50 | 46 |
51 void set_close_listener(CloseListener* listener) { | 47 void set_close_listener(CloseListener* listener) { |
52 close_listener_ = listener; | 48 close_listener_ = listener; |
53 } | 49 } |
54 | 50 |
55 // Invoked when a tab is replaced by another tab. This is triggered by | 51 // Invoked when a tab is replaced by another tab. This is triggered by |
56 // TabStripModel::ReplaceTabContentsAt. | 52 // TabStripModel::ReplaceTabContentsAt. |
57 virtual void TabReplaced(TabContents* new_tab) = 0; | 53 virtual void TabReplaced(TabContents* new_tab) = 0; |
58 | 54 |
59 // Returns client (front-end) RenderViewHost implementation of this | |
60 // client host if applicable. NULL otherwise. | |
61 virtual RenderViewHost* GetClientRenderViewHost(); | |
62 | |
63 protected: | 55 protected: |
64 DevToolsClientHost(); | 56 DevToolsClientHost(); |
65 | 57 |
66 void ForwardToDevToolsAgent(const IPC::Message& message); | 58 void ForwardToDevToolsAgent(const IPC::Message& message); |
67 | 59 |
68 // Should be called when the devtools client is going to die and this | 60 // Should be called when the devtools client is going to die and this |
69 // DevToolsClientHost should not be used anymore. | 61 // DevToolsClientHost should not be used anymore. |
70 void NotifyCloseListener(); | 62 void NotifyCloseListener(); |
71 | 63 |
72 private: | 64 private: |
73 CloseListener* close_listener_; | 65 CloseListener* close_listener_; |
74 DISALLOW_COPY_AND_ASSIGN(DevToolsClientHost); | 66 DISALLOW_COPY_AND_ASSIGN(DevToolsClientHost); |
75 }; | 67 }; |
76 | 68 |
77 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ | 69 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ |
OLD | NEW |