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