Index: chrome/devtools.js |
diff --git a/chrome/devtools.js b/chrome/devtools.js |
index 255aeb387bfa8db9e15005390587874a782f4a1b..aed487c1fdef1c8ae00dd1cf9306e836fe5f50c4 100644 |
--- a/chrome/devtools.js |
+++ b/chrome/devtools.js |
@@ -17,6 +17,8 @@ |
"use strict"; |
+var panelWindow = null; |
+ |
chrome.runtime.sendMessage( |
{ |
type: "prefs.get", |
@@ -25,8 +27,35 @@ chrome.runtime.sendMessage( |
function(enabled) |
{ |
if (enabled) |
- chrome.devtools.panels.create("Adblock Plus", |
- "icons/detailed/abp-48.png", |
- "devtools-panel.html"); |
+ { |
+ chrome.devtools.panels.create( |
+ "Adblock Plus", |
+ "icons/detailed/abp-48.png", |
+ "devtools-panel.html", |
+ function (panel) |
+ { |
+ panel.onShown.addListener(function(window) |
+ { |
+ panelWindow = window; |
+ }); |
+ |
+ panel.onHidden.addListener(function(window) |
+ { |
+ panelWindow = null; |
+ }); |
+ |
+ panel.onSearch.addListener(function(eventName, queryString) |
+ { |
+ if (panelWindow) |
+ { |
+ panelWindow.postMessage({ |
+ type: eventName, |
+ queryString: queryString |
+ }, "*"); |
+ } |
+ }); |
+ } |
+ ); |
+ } |
} |
); |