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

Unified Diff: chrome/browser/extensions/extension_devtools_bridge.h

Issue 159882: Implements extensions devtools API (Closed)
Patch Set: Fixes flakiness in tests by grabbing tab ID in C++ land and passing it down Created 11 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_devtools_bridge.h
diff --git a/chrome/browser/extensions/extension_devtools_bridge.h b/chrome/browser/extensions/extension_devtools_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..b4cb98ded0956b8d2045652695aa033b28b5a304
--- /dev/null
+++ b/chrome/browser/extensions/extension_devtools_bridge.h
@@ -0,0 +1,60 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_
+
+#include <string>
+
+#include "base/ref_counted.h"
+#include "chrome/browser/debugger/devtools_client_host.h"
+#include "chrome/browser/extensions/extension_devtools_manager.h"
+#include "chrome/browser/extensions/extension_message_service.h"
+
+class Profile;
+class RenderViewHost;
+
+// This class is a DevToolsClientHost that fires extension events.
+class ExtensionDevToolsBridge : public DevToolsClientHost {
+ public:
+ ExtensionDevToolsBridge(int tab_id, Profile* profile);
+ virtual ~ExtensionDevToolsBridge();
+
+ bool RegisterAsDevToolsClientHost();
+ void UnregisterAsDevToolsClientHost();
+
+ // DevToolsClientHost, called when the tab inspected by this client is
+ // closing.
+ virtual void InspectedTabClosing();
+
+ // DevToolsClientHost, called to send a message to this host.
+ virtual void SendMessageToClient(const IPC::Message& msg);
+
+ private:
+ void OnRpcMessage(const std::string& class_name,
+ const std::string& message_name,
+ const std::string& msg);
+
+ // ID of the tab we are monitoring.
+ int tab_id_;
+ // Host of the tab we are monitoring, NULL if not monitoring anything.
+ RenderViewHost* inspected_rvh_;
+
+ scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_;
+ scoped_refptr<ExtensionMessageService> extension_message_service_;
+
+ // Profile that owns our tab
+ Profile* profile_;
+
+ // The names of the events fired at extensions depend on the tab id,
+ // so we store the various event names in each bridge.
+ const std::string on_page_event_name_;
+ const std::string on_tab_url_change_event_name_;
+ const std::string on_tab_close_event_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge);
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEVTOOLS_BRIDGE_H_
+
« no previous file with comments | « chrome/browser/automation/automation_profile_impl.h ('k') | chrome/browser/extensions/extension_devtools_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698