Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Side by Side Diff: chrome/browser/extensions/extension_devtools_bridge.h

Issue 8549022: Define DevTools content API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/extensions/extension_message_service.h" 13 #include "chrome/browser/extensions/extension_message_service.h"
14 #include "content/browser/debugger/devtools_client_host.h" 14 #include "content/public/browser/devtools_client_host.h"
15 15
16 class Profile; 16 class Profile;
17 17
18 // This class is a DevToolsClientHost that fires extension events. 18 // This class is a DevToolsClientHost that fires extension events.
19 class ExtensionDevToolsBridge : public DevToolsClientHost { 19 class ExtensionDevToolsBridge : public content::DevToolsClientHost {
20 public: 20 public:
21 ExtensionDevToolsBridge(int tab_id, Profile* profile); 21 ExtensionDevToolsBridge(int tab_id, Profile* profile);
22 virtual ~ExtensionDevToolsBridge(); 22 virtual ~ExtensionDevToolsBridge();
23 23
24 bool RegisterAsDevToolsClientHost(); 24 bool RegisterAsDevToolsClientHost();
25 void UnregisterAsDevToolsClientHost(); 25 void UnregisterAsDevToolsClientHost();
26 26
27 // DevToolsClientHost, called when the tab inspected by this client is 27 // DevToolsClientHost, called when the tab inspected by this client is
28 // closing. 28 // closing.
29 virtual void InspectedTabClosing() OVERRIDE; 29 virtual void InspectedTabClosing() OVERRIDE;
30 30
31 // DevToolsClientHost, called to send a message to this host. 31 // DevToolsClientHost, called to dispatch a message on this client.
32 virtual void SendMessageToClient(const IPC::Message& msg) OVERRIDE; 32 virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE;
33 33
34 virtual void TabReplaced(TabContents* new_tab) OVERRIDE; 34 virtual void TabReplaced(TabContents* new_tab) OVERRIDE;
35 35
36 private: 36 private:
37 void OnDispatchOnInspectorFrontend(const std::string& data);
38
39 virtual void FrameNavigating(const std::string& url) OVERRIDE {} 37 virtual void FrameNavigating(const std::string& url) OVERRIDE {}
40 38
41 // ID of the tab we are monitoring. 39 // ID of the tab we are monitoring.
42 int tab_id_; 40 int tab_id_;
43 41
44 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; 42 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_;
45 43
46 // Profile that owns our tab 44 // Profile that owns our tab
47 Profile* profile_; 45 Profile* profile_;
48 46
49 // The names of the events fired at extensions depend on the tab id, 47 // The names of the events fired at extensions depend on the tab id,
50 // so we store the various event names in each bridge. 48 // so we store the various event names in each bridge.
51 const std::string on_page_event_name_; 49 const std::string on_page_event_name_;
52 const std::string on_tab_close_event_name_; 50 const std::string on_tab_close_event_name_;
53 51
54 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge); 52 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge);
55 }; 53 };
56 54
57 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_ 55 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698