OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "chrome/browser/extensions/extension_devtools_manager.h" | 12 #include "chrome/browser/extensions/extension_devtools_manager.h" |
13 #include "content/public/browser/devtools_client_host.h" | 13 #include "content/public/browser/devtools_client_host.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 // This class is a DevToolsClientHost that fires extension events. | 17 // This class is a DevToolsClientHost that fires extension events. |
18 class ExtensionDevToolsBridge : public content::DevToolsClientHost { | 18 class ExtensionDevToolsBridge : public content::DevToolsClientHost { |
19 public: | 19 public: |
20 ExtensionDevToolsBridge(int tab_id, Profile* profile); | 20 ExtensionDevToolsBridge(int tab_id, Profile* profile); |
21 virtual ~ExtensionDevToolsBridge(); | 21 virtual ~ExtensionDevToolsBridge(); |
22 | 22 |
23 bool RegisterAsDevToolsClientHost(); | 23 bool RegisterAsDevToolsClientHost(); |
24 void UnregisterAsDevToolsClientHost(); | 24 void UnregisterAsDevToolsClientHost(); |
25 | 25 |
26 // DevToolsClientHost, called when the tab inspected by this client is | 26 // DevToolsClientHost, called when the tab inspected by this client is |
27 // closing. | 27 // closing. |
28 virtual void InspectedTabClosing() OVERRIDE; | 28 virtual void InspectedContentsClosing() OVERRIDE; |
29 | 29 |
30 // DevToolsClientHost, called to dispatch a message on this client. | 30 // DevToolsClientHost, called to dispatch a message on this client. |
31 virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE; | 31 virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE; |
32 | 32 |
33 virtual void TabReplaced(content::WebContents* new_tab) OVERRIDE; | 33 virtual void ContentsReplaced(content::WebContents* new_contents) OVERRIDE; |
34 | 34 |
35 private: | 35 private: |
36 virtual void FrameNavigating(const std::string& url) OVERRIDE {} | 36 virtual void FrameNavigating(const std::string& url) OVERRIDE {} |
37 | 37 |
38 // ID of the tab we are monitoring. | 38 // ID of the tab we are monitoring. |
39 int tab_id_; | 39 int tab_id_; |
40 | 40 |
41 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; | 41 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; |
42 | 42 |
43 // Profile that owns our tab | 43 // Profile that owns our tab |
44 Profile* profile_; | 44 Profile* profile_; |
45 | 45 |
46 // The names of the events fired at extensions depend on the tab id, | 46 // The names of the events fired at extensions depend on the tab id, |
47 // so we store the various event names in each bridge. | 47 // so we store the various event names in each bridge. |
48 const std::string on_page_event_name_; | 48 const std::string on_page_event_name_; |
49 const std::string on_tab_close_event_name_; | 49 const std::string on_tab_close_event_name_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge); | 51 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge); |
52 }; | 52 }; |
53 | 53 |
54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ | 54 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ |
OLD | NEW |