Bug 692731 Re-implement sidebar.addPanel as an interim measure r=Mnyromyr
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Sun, 06 Nov 2011 21:48:14 +0000
changeset 8793 bd69b32048913160e4510720c41cf765506ee502
parent 8792 d78a56d046889e9869b04a0651ce89b80bf6d6f0
child 8794 ed660e715f22849b48030d7a03b05b25dd1e3f2d
push id6751
push userneil@parkwaycc.co.uk
push dateSun, 06 Nov 2011 21:48:25 +0000
treeherdercomm-central@bd69b3204891 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMnyromyr
bugs692731
Bug 692731 Re-implement sidebar.addPanel as an interim measure r=Mnyromyr
suite/common/public/Makefile.in
suite/common/public/nsISidebarPanel.idl
suite/common/src/nsSidebar.js
--- a/suite/common/public/Makefile.in
+++ b/suite/common/public/Makefile.in
@@ -41,16 +41,17 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= suitecommon
 XPIDL_MODULE	= suitecommon
 
 XPIDLSRCS = \
-	nsISuiteGlue.idl \
 	nsISessionStartup.idl \
 	nsISessionStore.idl \
+	nsISidebarPanel.idl \
+	nsISuiteGlue.idl \
 	nsISuiteDownloadManagerUI.idl \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
new file mode 100644
--- /dev/null
+++ b/suite/common/public/nsISidebarPanel.idl
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org Code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+
+  The Sidebar API for 3rd parties
+
+*/
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(e0f4c5ee-2b35-4e99-81d2-ab956c4de0d1)]
+interface nsISidebarPanel : nsISupports
+{
+    void addPanel(in DOMString aTitle, in DOMString aContentURL,
+                  in DOMString aCustomizeURL);
+    void addPersistentPanel(in DOMString aTitle, in DOMString aContentURL,
+                            in DOMString aCustomizeURL);
+};
--- a/suite/common/src/nsSidebar.js
+++ b/suite/common/src/nsSidebar.js
@@ -56,16 +56,17 @@ const DEBUG = false; /* set to false to 
 const PANELS_RDF_FILE  = "UPnls"; /* directory services property to find panels.rdf */
 
 const SIDEBAR_CONTRACTID   = "@mozilla.org/sidebar;1";
 const SIDEBAR_CID      = Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}");
 const CONTAINER_CONTRACTID = "@mozilla.org/rdf/container;1";
 const NETSEARCH_CONTRACTID = "@mozilla.org/rdf/datasource;1?name=internetsearch"
 const nsISupports      = Components.interfaces.nsISupports;
 const nsISidebar       = Components.interfaces.nsISidebar;
+const nsISidebarPanel  = Components.interfaces.nsISidebarPanel;
 const nsISidebarExternal = Components.interfaces.nsISidebarExternal;
 const nsIRDFContainer  = Components.interfaces.nsIRDFContainer;
 const nsIProperties    = Components.interfaces.nsIProperties;
 const nsIFileURL       = Components.interfaces.nsIFileURL;
 const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource;
 const nsIClassInfo     = Components.interfaces.nsIClassInfo;
 
 // File extension for Sherlock search plugin description files
@@ -333,21 +334,21 @@ function (aSearchURL)
 {
   return 0;
 }
 
 nsSidebar.prototype.classInfo = XPCOMUtils.generateCI({
     classID: SIDEBAR_CID,
     contractID: SIDEBAR_CONTRACTID,
     classDescription: "Sidebar",
-    interfaces: [nsISidebar, nsISidebarExternal],
+    interfaces: [nsISidebar, nsISidebarPanel, nsISidebarExternal],
     flags: nsIClassInfo.DOM_OBJECT});
 
 nsSidebar.prototype.QueryInterface =
-    XPCOMUtils.generateQI([nsISidebar, nsISidebarExternal]);
+    XPCOMUtils.generateQI([nsISidebar, nsISidebarPanel, nsISidebarExternal]);
 
 nsSidebar.prototype.classID = SIDEBAR_CID;
 
 var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]);
 
 /* static functions */
 if (DEBUG)
     debug = function (s) { dump("-*- sidebar component: " + s + "\n"); }