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