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 | |
11 #include "base/basictypes.h" | |
12 #include "content/common/content_export.h" | |
13 | |
14 namespace IPC { | |
15 class Message; | |
16 } | |
17 | |
18 class TabContents; | |
19 | |
20 // Describes interface for managing devtools clients from browser process. There | |
21 // are currently two types of clients: devtools windows and TCP socket | |
22 // debuggers. | |
23 class CONTENT_EXPORT DevToolsClientHost { | |
24 public: | |
25 class CONTENT_EXPORT CloseListener { | |
26 public: | |
27 CloseListener() {} | |
28 virtual ~CloseListener() {} | |
29 virtual void ClientHostClosing(DevToolsClientHost* host) = 0; | |
30 private: | |
31 DISALLOW_COPY_AND_ASSIGN(CloseListener); | |
32 }; | |
33 | |
34 virtual ~DevToolsClientHost(); | |
35 | |
36 // This method is called when tab inspected by this devtools client is | |
37 // closing. | |
38 virtual void InspectedTabClosing() = 0; | |
39 | |
40 // This method is called when tab inspected by this devtools client is | |
41 // navigating to |url|. | |
42 virtual void FrameNavigating(const std::string& url) = 0; | |
43 | |
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 | |
52 // TabStripModel::ReplaceTabContentsAt. | |
53 virtual void TabReplaced(TabContents* new_tab) = 0; | |
54 | |
55 protected: | |
56 DevToolsClientHost(); | |
57 | |
58 void ForwardToDevToolsAgent(const IPC::Message& message); | |
59 | |
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 }; | |
68 | |
69 #endif // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ | |
OLD | NEW |