From 349fcd92ec3a8eddbd94ae2ab791a3933f90f4af Mon Sep 17 00:00:00 2001 From: "hewitt%netscape.com" Date: Sat, 28 Sep 2002 21:46:52 +0000 Subject: [PATCH] moving the phoenix history from browser to toolkit git-svn-id: svn://10.0.0.236/trunk@130686 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/browser/components/Makefile.in | 2 +- mozilla/browser/components/build/Makefile.in | 3 - .../components/build/nsBrowserCompsCID.h | 12 - mozilla/browser/components/build/nsModule.cpp | 23 +- mozilla/toolkit/components/Makefile.in | 2 +- mozilla/toolkit/components/build/Makefile.in | 6 + mozilla/toolkit/components/build/nsModule.cpp | 19 +- .../components/build/nsToolkitCompsCID.h | 13 + .../toolkit/components/history/Makefile.in | 32 + .../history/content/MANIFEST-content | 4 + .../components/history/content/findHistory.js | 85 + .../history/content/findHistory.xul | 63 + .../history/content/history-panel.xul | 62 + .../history/content/history-test.js | 60 + .../history/content/history-test.xul | 20 + .../components/history/content/history.js | 425 ++ .../components/history/content/history.xul | 140 + .../history/content/historyTreeOverlay.xul | 144 + mozilla/toolkit/components/history/jar.mn | 16 + .../components/history/locale/MANIFEST | 1 + .../components/history/locale/findHistory.dtd | 12 + .../components/history/locale/history.dtd | 43 + .../history/locale/history.properties | 18 + .../history/locale/historyTreeOverlay.dtd | 15 + .../components/history/public/Makefile.in | 38 + .../history/public/nsIBrowserHistory.idl | 120 + .../history/public/nsIGlobalHistory.idl | 67 + .../components/history/src/Makefile.in | 49 + .../history/src/nsGlobalHistory.cpp | 4297 +++++++++++++++++ .../components/history/src/nsGlobalHistory.h | 427 ++ .../history/src/nsHistoryLoadListener.cpp | 177 + .../history/src/nsHistoryLoadListener.h | 50 + .../toolkit/components/history/src/nsMdbPtr.h | 244 + 33 files changed, 6652 insertions(+), 37 deletions(-) create mode 100644 mozilla/toolkit/components/history/Makefile.in create mode 100644 mozilla/toolkit/components/history/content/MANIFEST-content create mode 100644 mozilla/toolkit/components/history/content/findHistory.js create mode 100644 mozilla/toolkit/components/history/content/findHistory.xul create mode 100644 mozilla/toolkit/components/history/content/history-panel.xul create mode 100644 mozilla/toolkit/components/history/content/history-test.js create mode 100644 mozilla/toolkit/components/history/content/history-test.xul create mode 100644 mozilla/toolkit/components/history/content/history.js create mode 100644 mozilla/toolkit/components/history/content/history.xul create mode 100644 mozilla/toolkit/components/history/content/historyTreeOverlay.xul create mode 100644 mozilla/toolkit/components/history/jar.mn create mode 100644 mozilla/toolkit/components/history/locale/MANIFEST create mode 100644 mozilla/toolkit/components/history/locale/findHistory.dtd create mode 100644 mozilla/toolkit/components/history/locale/history.dtd create mode 100644 mozilla/toolkit/components/history/locale/history.properties create mode 100644 mozilla/toolkit/components/history/locale/historyTreeOverlay.dtd create mode 100644 mozilla/toolkit/components/history/public/Makefile.in create mode 100644 mozilla/toolkit/components/history/public/nsIBrowserHistory.idl create mode 100644 mozilla/toolkit/components/history/public/nsIGlobalHistory.idl create mode 100644 mozilla/toolkit/components/history/src/Makefile.in create mode 100644 mozilla/toolkit/components/history/src/nsGlobalHistory.cpp create mode 100644 mozilla/toolkit/components/history/src/nsGlobalHistory.h create mode 100644 mozilla/toolkit/components/history/src/nsHistoryLoadListener.cpp create mode 100644 mozilla/toolkit/components/history/src/nsHistoryLoadListener.h create mode 100644 mozilla/toolkit/components/history/src/nsMdbPtr.h diff --git a/mozilla/browser/components/Makefile.in b/mozilla/browser/components/Makefile.in index cbebd3299eb..363738b1f5d 100644 --- a/mozilla/browser/components/Makefile.in +++ b/mozilla/browser/components/Makefile.in @@ -42,6 +42,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = prefwindow history bookmarks console downloads build +DIRS = prefwindow bookmarks console downloads build include $(topsrcdir)/config/rules.mk diff --git a/mozilla/browser/components/build/Makefile.in b/mozilla/browser/components/build/Makefile.in index ac2cf0f813f..de114ba8bbc 100644 --- a/mozilla/browser/components/build/Makefile.in +++ b/mozilla/browser/components/build/Makefile.in @@ -14,7 +14,6 @@ IS_COMPONENT = 1 REQUIRES = \ xpcom \ string \ - history \ autocomplete \ mork \ pref \ @@ -35,12 +34,10 @@ CPPSRCS = nsModule.cpp \ $(NULL) LOCAL_INCLUDES = \ - -I$(srcdir)/../history/src \ -I$(srcdir)/../downloads/src \ $(NULL) SHARED_LIBRARY_LIBS = \ - $(DIST)/lib/$(LIB_PREFIX)history_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)download_s.$(LIB_SUFFIX) \ $(NULL) diff --git a/mozilla/browser/components/build/nsBrowserCompsCID.h b/mozilla/browser/components/build/nsBrowserCompsCID.h index 6141a48f5bc..7040dec0a21 100644 --- a/mozilla/browser/components/build/nsBrowserCompsCID.h +++ b/mozilla/browser/components/build/nsBrowserCompsCID.h @@ -35,17 +35,5 @@ * * ***** END LICENSE BLOCK ***** */ -#define NS_GLOBALHISTORY_CONTRACTID \ - "@mozilla.org/browser/global-history;1" - -#define NS_GLOBALHISTORY_DATASOURCE_CONTRACTID \ - "@mozilla.org/rdf/datasource;1?name=history" - -#define NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID \ - "@mozilla.org/autocomplete/search;1?name=history" - ///////////////////////////////////////////////////////////////////////////// -// {9491C382-E3C4-11D2-BDBE-0050040A9B44} -#define NS_GLOBALHISTORY_CID \ -{ 0x9491c382, 0xe3c4, 0x11d2, { 0xbd, 0xbe, 0x0, 0x50, 0x4, 0xa, 0x9b, 0x44} } diff --git a/mozilla/browser/components/build/nsModule.cpp b/mozilla/browser/components/build/nsModule.cpp index 41f8a3ec052..8a3fd954d49 100644 --- a/mozilla/browser/components/build/nsModule.cpp +++ b/mozilla/browser/components/build/nsModule.cpp @@ -39,13 +39,11 @@ #include "nsIGenericFactory.h" #include "nsBrowserCompsCID.h" -#include "nsGlobalHistory.h" #include "nsDownloadManager.h" #include "nsDownloadProxy.h" ///////////////////////////////////////////////////////////////////////////// -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGlobalHistory, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDownloadManager, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy) @@ -53,27 +51,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloadProxy) static const nsModuleComponentInfo components[] = { - { "Global History", - NS_GLOBALHISTORY_CID, - NS_GLOBALHISTORY_CONTRACTID, - nsGlobalHistoryConstructor }, - - { "Global History", - NS_GLOBALHISTORY_CID, - NS_GLOBALHISTORY_DATASOURCE_CONTRACTID, - nsGlobalHistoryConstructor }, - - { "Global History", - NS_GLOBALHISTORY_CID, - NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID, - nsGlobalHistoryConstructor }, - { "Download Manager", - NS_DOWNLOADMANAGER_CID, NS_DOWNLOADMANAGER_CONTRACTID, + NS_DOWNLOADMANAGER_CID, + NS_DOWNLOADMANAGER_CONTRACTID, nsDownloadManagerConstructor }, { "Download", - NS_DOWNLOAD_CID, NS_DOWNLOAD_CONTRACTID, + NS_DOWNLOAD_CID, + NS_DOWNLOAD_CONTRACTID, nsDownloadProxyConstructor } }; diff --git a/mozilla/toolkit/components/Makefile.in b/mozilla/toolkit/components/Makefile.in index 306770fda7f..a8dbde5ad0d 100644 --- a/mozilla/toolkit/components/Makefile.in +++ b/mozilla/toolkit/components/Makefile.in @@ -5,6 +5,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = autocomplete satchel build +DIRS = autocomplete history satchel build include $(topsrcdir)/config/rules.mk diff --git a/mozilla/toolkit/components/build/Makefile.in b/mozilla/toolkit/components/build/Makefile.in index 04b3bfb0d9d..d8a37402594 100644 --- a/mozilla/toolkit/components/build/Makefile.in +++ b/mozilla/toolkit/components/build/Makefile.in @@ -37,8 +37,12 @@ REQUIRES = xpcom \ layout \ dom \ mork \ + pref \ + rdf \ + intl \ docshell \ autocomplete \ + history \ satchel \ $(NULL) @@ -49,10 +53,12 @@ CPPSRCS = nsModule.cpp \ LOCAL_INCLUDES = \ -I$(srcdir)/../autocomplete/src \ + -I$(srcdir)/../history/src \ -I$(srcdir)/../satchel/src \ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)autocomplete_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)history_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)satchel_s.$(LIB_SUFFIX) \ $(NULL) diff --git a/mozilla/toolkit/components/build/nsModule.cpp b/mozilla/toolkit/components/build/nsModule.cpp index e39ef5f454f..538f0cf7f25 100644 --- a/mozilla/toolkit/components/build/nsModule.cpp +++ b/mozilla/toolkit/components/build/nsModule.cpp @@ -42,6 +42,7 @@ #include "nsAutoCompleteMdbResult.h" #include "nsFormHistory.h" #include "nsFormFillController.h" +#include "nsGlobalHistory.h" ///////////////////////////////////////////////////////////////////////////// @@ -49,6 +50,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteController) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteMdbResult) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsFormHistory, nsFormHistory::GetInstance); NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGlobalHistory, Init) ///////////////////////////////////////////////////////////////////////////// //// Module Destructor @@ -85,7 +87,22 @@ static const nsModuleComponentInfo components[] = { "HTML Form History AutoComplete", NS_FORMFILLCONTROLLER_CID, NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID, - nsFormFillControllerConstructor } + nsFormFillControllerConstructor }, + + { "Global History", + NS_GLOBALHISTORY_CID, + NS_GLOBALHISTORY_CONTRACTID, + nsGlobalHistoryConstructor }, + + { "Global History", + NS_GLOBALHISTORY_CID, + NS_GLOBALHISTORY_DATASOURCE_CONTRACTID, + nsGlobalHistoryConstructor }, + + { "Global History", + NS_GLOBALHISTORY_CID, + NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID, + nsGlobalHistoryConstructor }, }; NS_IMPL_NSGETMODULE_WITH_DTOR(nsToolkitCompsModule, components, nsToolkitCompModuleDtor) diff --git a/mozilla/toolkit/components/build/nsToolkitCompsCID.h b/mozilla/toolkit/components/build/nsToolkitCompsCID.h index 09361de6911..bdc8487fda8 100644 --- a/mozilla/toolkit/components/build/nsToolkitCompsCID.h +++ b/mozilla/toolkit/components/build/nsToolkitCompsCID.h @@ -50,6 +50,15 @@ #define NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID \ "@mozilla.org/autocomplete/search;1?name=form-history" +#define NS_GLOBALHISTORY_CONTRACTID \ + "@mozilla.org/browser/global-history;1" + +#define NS_GLOBALHISTORY_DATASOURCE_CONTRACTID \ + "@mozilla.org/rdf/datasource;1?name=history" + +#define NS_GLOBALHISTORY_AUTOCOMPLETE_CONTRACTID \ + "@mozilla.org/autocomplete/search;1?name=history" + ///////////////////////////////////////////////////////////////////////////// // {F6D5EBBD-34F4-487d-9D10-3D34123E3EB9} @@ -67,3 +76,7 @@ // {A2059C0E-5A58-4c55-AB7C-26F0557546EF} #define NS_FORMHISTORY_CID \ { 0xa2059c0e, 0x5a58, 0x4c55, { 0xab, 0x7c, 0x26, 0xf0, 0x55, 0x75, 0x46, 0xef } } + +// {9491C382-E3C4-11D2-BDBE-0050040A9B44} +#define NS_GLOBALHISTORY_CID \ +{ 0x9491c382, 0xe3c4, 0x11d2, { 0xbd, 0xbe, 0x0, 0x50, 0x4, 0xa, 0x9b, 0x44} } diff --git a/mozilla/toolkit/components/history/Makefile.in b/mozilla/toolkit/components/history/Makefile.in new file mode 100644 index 00000000000..ea7298a5866 --- /dev/null +++ b/mozilla/toolkit/components/history/Makefile.in @@ -0,0 +1,32 @@ +# +# The contents of this file are subject to the Netscape 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/NPL/ +# +# 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 Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): +# + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = public src + +include $(topsrcdir)/config/rules.mk + diff --git a/mozilla/toolkit/components/history/content/MANIFEST-content b/mozilla/toolkit/components/history/content/MANIFEST-content new file mode 100644 index 00000000000..725e7be48d1 --- /dev/null +++ b/mozilla/toolkit/components/history/content/MANIFEST-content @@ -0,0 +1,4 @@ +history.xul +history.js +history-test.xul +history-test.js diff --git a/mozilla/toolkit/components/history/content/findHistory.js b/mozilla/toolkit/components/history/content/findHistory.js new file mode 100644 index 00000000000..bbcfb8de59b --- /dev/null +++ b/mozilla/toolkit/components/history/content/findHistory.js @@ -0,0 +1,85 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape 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/NPL/ + * + * 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): + * Ben Goodger (Original Author) + * + * 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 NPL, 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 NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +var gOKButton; +var gSearchField; +function Startup() +{ + var bundle = document.getElementById("historyBundle"); + gOKButton = document.documentElement.getButton("accept"); + gOKButton.label = bundle.getString("search_button_label"); + gOKButton.disabled = true; + gSearchField = document.getElementById("searchField"); + gSearchField.focus(); +} + +function find() +{ + // Build up a find URI from the search fields and open a new window + // rooted on the URI. + var match = document.getElementById("matchList"); + var method = document.getElementById("methodList"); + var searchURI = "find:datasource=history" + searchURI += "&match=" + match.selectedItem.value; + searchURI += "&method=" + method.selectedItem.value; + searchURI += "&text=" + escape(gSearchField.value); + var hstWindow = findMostRecentWindow("history:searchresults", "chrome://communicator/content/history/history.xul", searchURI); + + // Update the root of the tree if we're using an existing search window. + if (!gCreatingNewWindow) + hstWindow.setRoot(searchURI); + + hstWindow.focus(); + return true; +} + +var gCreatingNewWindow = false; +function findMostRecentWindow(aType, aURI, aParam) +{ + var WM = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(); + WM = WM.QueryInterface(Components.interfaces.nsIWindowMediator); + var topWindow = WM.getMostRecentWindow(aType); + if (!topWindow) gCreatingNewWindow = true; + return topWindow || openDialog("chrome://communicator/content/history/history.xul", + "", "chrome,all,dialog=no", aParam); +} + +function doEnabling() +{ + gOKButton.disabled = !gSearchField.value; +} diff --git a/mozilla/toolkit/components/history/content/findHistory.xul b/mozilla/toolkit/components/history/content/findHistory.xul new file mode 100644 index 00000000000..a42566cff87 --- /dev/null +++ b/mozilla/toolkit/components/history/content/findHistory.xul @@ -0,0 +1,63 @@ + + + + + + + + + + + + +