| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ |
| 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 |
| 10 namespace IPC { |
| 11 class Message; |
| 12 } |
| 13 |
| 14 class DevToolsWindow; |
| 15 |
| 16 // Describes interface for managing devtools clients from browser process. There |
| 17 // are currently two types of clients: devtools windows and TCP socket |
| 18 // debuggers. |
| 19 class DevToolsClientHost { |
| 20 public: |
| 21 class CloseListener { |
| 22 public: |
| 23 CloseListener() {} |
| 24 virtual ~CloseListener() {} |
| 25 virtual void ClientHostClosing(DevToolsClientHost* host) = 0; |
| 26 private: |
| 27 DISALLOW_COPY_AND_ASSIGN(CloseListener); |
| 28 }; |
| 29 |
| 30 virtual ~DevToolsClientHost() {} |
| 31 |
| 32 // This method is called when tab inspected by this devtools client is |
| 33 // closing. |
| 34 virtual void InspectedTabClosing() = 0; |
| 35 |
| 36 // Sends the message to the devtools client hosted by this object. |
| 37 virtual void SendMessageToClient(const IPC::Message& msg) = 0; |
| 38 |
| 39 void set_close_listener(CloseListener* listener) { |
| 40 close_listener_ = listener; |
| 41 } |
| 42 |
| 43 virtual DevToolsWindow* AsDevToolsWindow() { return NULL; } |
| 44 |
| 45 protected: |
| 46 DevToolsClientHost() : close_listener_(NULL) {} |
| 47 |
| 48 // Should be called when the devtools client is going to die and this |
| 49 // DevToolsClientHost should not be used anymore. |
| 50 void NotifyCloseListener() { |
| 51 if (close_listener_) { |
| 52 close_listener_->ClientHostClosing(this); |
| 53 close_listener_ = NULL; |
| 54 } |
| 55 } |
| 56 |
| 57 private: |
| 58 CloseListener* close_listener_; |
| 59 DISALLOW_COPY_AND_ASSIGN(DevToolsClientHost); |
| 60 }; |
| 61 |
| 62 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_CLIENT_HOST_H_ |
| OLD | NEW |