| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "chrome/browser/debugger/devtools_client_host.h" | 11 #include "chrome/browser/debugger/devtools_client_host.h" |
| 12 #include "chrome/browser/extensions/extension_devtools_manager.h" | 12 #include "chrome/browser/extensions/extension_devtools_manager.h" |
| 13 #include "chrome/browser/extensions/extension_message_service.h" | 13 #include "chrome/browser/extensions/extension_message_service.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
| 16 class RenderViewHost; | |
| 17 | 16 |
| 18 // This class is a DevToolsClientHost that fires extension events. | 17 // This class is a DevToolsClientHost that fires extension events. |
| 19 class ExtensionDevToolsBridge : public DevToolsClientHost { | 18 class ExtensionDevToolsBridge : public DevToolsClientHost { |
| 20 public: | 19 public: |
| 21 ExtensionDevToolsBridge(int tab_id, Profile* profile); | 20 ExtensionDevToolsBridge(int tab_id, Profile* profile); |
| 22 virtual ~ExtensionDevToolsBridge(); | 21 virtual ~ExtensionDevToolsBridge(); |
| 23 | 22 |
| 24 bool RegisterAsDevToolsClientHost(); | 23 bool RegisterAsDevToolsClientHost(); |
| 25 void UnregisterAsDevToolsClientHost(); | 24 void UnregisterAsDevToolsClientHost(); |
| 26 | 25 |
| 27 // DevToolsClientHost, called when the tab inspected by this client is | 26 // DevToolsClientHost, called when the tab inspected by this client is |
| 28 // closing. | 27 // closing. |
| 29 virtual void InspectedTabClosing(); | 28 virtual void InspectedTabClosing(); |
| 30 | 29 |
| 31 // DevToolsClientHost, called to send a message to this host. | 30 // DevToolsClientHost, called to send a message to this host. |
| 32 virtual void SendMessageToClient(const IPC::Message& msg); | 31 virtual void SendMessageToClient(const IPC::Message& msg); |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 void OnRpcMessage(const std::string& class_name, | 34 void OnRpcMessage(const std::string& class_name, |
| 36 const std::string& message_name, | 35 const std::string& message_name, |
| 37 const std::string& param1, | 36 const std::string& param1, |
| 38 const std::string& param2, | 37 const std::string& param2, |
| 39 const std::string& param3); | 38 const std::string& param3); |
| 40 | 39 |
| 41 // ID of the tab we are monitoring. | 40 // ID of the tab we are monitoring. |
| 42 int tab_id_; | 41 int tab_id_; |
| 43 // Host of the tab we are monitoring, NULL if not monitoring anything. | |
| 44 RenderViewHost* inspected_rvh_; | |
| 45 | 42 |
| 46 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | 43 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; |
| 47 scoped_refptr<ExtensionMessageService> extension_message_service_; | 44 scoped_refptr<ExtensionMessageService> extension_message_service_; |
| 48 | 45 |
| 49 // Profile that owns our tab | 46 // Profile that owns our tab |
| 50 Profile* profile_; | 47 Profile* profile_; |
| 51 | 48 |
| 52 // The names of the events fired at extensions depend on the tab id, | 49 // The names of the events fired at extensions depend on the tab id, |
| 53 // so we store the various event names in each bridge. | 50 // so we store the various event names in each bridge. |
| 54 const std::string on_page_event_name_; | 51 const std::string on_page_event_name_; |
| 55 const std::string on_tab_close_event_name_; | 52 const std::string on_tab_close_event_name_; |
| 56 | 53 |
| 57 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge); | 54 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge); |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ | 57 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ |
| 61 | 58 |
| OLD | NEW |