1 /* See license.txt for terms of usage */
  2 
  3 FBL.ns(function() { with (FBL) {
  4 
  5 // ************************************************************************************************
  6 
  7 Firebug.PluginPanel = function() {};
  8 
  9 Firebug.PluginPanel.prototype = extend(Firebug.Panel,
 10 {
 11     createBrowser: function()
 12     {
 13         var doc = Firebug.chrome.window.document;
 14         this.browser = doc.createElement("browser");
 15         this.browser.addEventListener("DOMContentLoaded", this.browserReady, false);
 16         if (FBTrace.DBG_INITIALIZE)
 17             FBTrace.sysout("plugin.createBrowser DOMContentLoaded addEventListener\n");
 18         this.browser.className = "pluginBrowser";
 19         this.browser.setAttribute("src", this.url);  // see tabContext.createPanelType
 20     },
 21 
 22     destroyBrowser: function()
 23     {
 24         if (this.browser)
 25         {
 26             this.browser.parentNode.removeChild(this.browser);
 27             delete this.browser;
 28             if (FBTrace.DBG_INITIALIZE)
 29                 FBTrace.sysout("plugin.destroyBrowser \n");
 30         }
 31     },
 32 
 33     browserReady: function()
 34     {
 35         this.browser.removeEventListener("DOMContentLoaded", this.browserReady, false);
 36         if (FBTrace.DBG_INITIALIZE) FBTrace.sysout("plugin.browserReady DOMContentLoaded addEventListener\n");
 37         this.innerPanel = this.browser.contentWindow.FirebugPanel; // XXXjjb ?
 38         if (this.visible)
 39         {
 40             if (this.innerPanel)
 41                 innerCall(this.innerPanel, "initialize", [this.context.window]);
 42             this.updateSelection(this.selection);
 43         }
 44     },
 45 
 46     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 47     // extends Panel
 48 
 49     initialize: function()
 50     {
 51         this.browserReady = bindFixed(this.browserReady, this);
 52         Firebug.Panel.initialize.apply(this, arguments);
 53     },
 54 
 55     destroy: function(state)
 56     {
 57         this.destroyBrowser();
 58         Firebug.Panel.destroy.apply(this, arguments);
 59     },
 60 
 61     reattach: function(doc)
 62     {
 63         this.destroyBrowser();
 64         this.createBrowser();
 65     },
 66 
 67     show: function(state)
 68     {
 69         if (!this.browser)
 70             this.createBrowser();
 71     },
 72 
 73     hide: function()
 74     {
 75     },
 76 
 77     supportsObject: function(object)
 78     {
 79         if (this.innerPanel)
 80             return innerCall(this.innerPanel, "supportsObject", [object]);
 81         else
 82             return 0;
 83     },
 84 
 85     updateSelection: function(object)
 86     {
 87         if (!this.innerPanel)
 88             return;
 89 
 90         innerCall(this.innerPanel, "select", [object]);
 91     },
 92 
 93     getObjectPath: function(object)
 94     {
 95     },
 96 
 97     getDefaultSelection: function()
 98     {
 99     },
100 
101     updateOption: function(name, value)
102     {
103     },
104 
105     getOptionsMenuItems: function()
106     {
107     },
108 
109     getContextMenuItems: function(object, target)
110     {
111     },
112 
113     getEditor: function(target, value)
114     {
115     }
116 });
117 
118 // ************************************************************************************************
119 
120 function innerCall(innerPanel, name, args)
121 {
122     try
123     {
124         innerPanel[name].apply(innerPanel, args);
125     }
126     catch (exc)
127     {
128         ERROR(exc);
129     }
130 }
131 
132 // ************************************************************************************************
133 
134 }});
135