зеркало из https://github.com/mozilla/gecko-dev.git
moving the phoenix history from browser to toolkit
This commit is contained in:
Родитель
583852ca67
Коммит
4690faa702
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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} }
|
||||
|
|
|
@ -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 }
|
||||
};
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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} }
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -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
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
history.xul
|
||||
history.js
|
||||
history-test.xul
|
||||
history-test.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 <ben@netscape.com> (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;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: HTML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
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):
|
||||
Ben Goodger <ben@netscape.com> (Original Author)
|
||||
-->
|
||||
|
||||
<!--
|
||||
"Find in History" window
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/history/findHistory.dtd">
|
||||
|
||||
<dialog id="findHistoryWindow" style="width: 36em;"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&findHistory.title;"
|
||||
onload="Startup();"
|
||||
ondialogaccept="return find();">
|
||||
|
||||
<stringbundle id="historyBundle" src="chrome://communicator/locale/history/history.properties"/>
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/history/findHistory.js"/>
|
||||
|
||||
<label value="&search.for.label;"/>
|
||||
<hbox align="center">
|
||||
<menulist id="matchList">
|
||||
<menupopup>
|
||||
<menuitem value="Name" label="&search.name.label;"/>
|
||||
<menuitem value="URL" label="&search.url.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist id="methodList">
|
||||
<menupopup>
|
||||
<menuitem value="contains" label="&search.contains.label;"/>
|
||||
<menuitem value="startswith" label="&search.startswith.label;"/>
|
||||
<menuitem value="endswith" label="&search.endswith.label;"/>
|
||||
<menuitem value="is" label="&search.is.label;"/>
|
||||
<menuitem value="isnot" label="&search.isnot.label;"/>
|
||||
<menuitem value="doesntcontain" label="&search.doesntcontain.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<textbox id="searchField" flex="1" oninput="doEnabling();"/>
|
||||
</hbox>
|
||||
</dialog>
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
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):
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/sidebar/sidebarListView.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://communicator/content/history/historyTreeOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/history/history.dtd" >
|
||||
|
||||
<page id="history-panel" orient="vertical"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="HistoryCommonInit();" elementtofocus="historyTree">
|
||||
<commandset id="selectEditMenuItems">
|
||||
<command id="cmd_delete"/>
|
||||
<command id="cmd_copy"/>
|
||||
</commandset>
|
||||
<keyset id="historyKeys">
|
||||
<key id="key_delete"/>
|
||||
<key id="key_copy"/>
|
||||
</keyset>
|
||||
<popupset id="historyContextMenu"/>
|
||||
<!-- use deep merging to hide certain columns by default -->
|
||||
<tree id="historyTree">
|
||||
<treecols id="historyTreeCols">
|
||||
<treecol id="Name"/>
|
||||
<splitter id="pre-URL-splitter"/>
|
||||
<treecol id="URL" hidden="true"/>
|
||||
<splitter id="pre-Date-splitter"/>
|
||||
<treecol id="Date" hidden="true"/>
|
||||
<splitter id="pre-FirstVisitDate-splitter"/>
|
||||
<treecol id="FirstVisitDate" hidden="true"/>
|
||||
<splitter id="pre-Hostname-splitter"/>
|
||||
<treecol id="Hostname" hidden="true"/>
|
||||
<splitter id="pre-Referrer-splitter"/>
|
||||
<treecol id="Referrer" hidden="true"/>
|
||||
<splitter id="pre-VisitCount-splitter"/>
|
||||
<treecol id="VisitCount" hidden="true"/>
|
||||
</treecols>
|
||||
</tree>
|
||||
</page>
|
|
@ -0,0 +1,60 @@
|
|||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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):
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
function ShowLastPageVisited() {
|
||||
dump("start of ShowLastPageVisited()\n");
|
||||
|
||||
var lastpagevisited = "failure...not set";
|
||||
|
||||
var history = Components.classes['@mozilla.org/browser/global-history;1'];
|
||||
if (history) {
|
||||
history = history.getService();
|
||||
}
|
||||
if (history) {
|
||||
history = history.QueryInterface(Components.interfaces.nsIGlobalHistory);
|
||||
}
|
||||
if (history) {
|
||||
try {
|
||||
lastpagevisited = history.lastPageVisited;
|
||||
document.getElementById('result').value = lastpagevisited;
|
||||
}
|
||||
catch (ex) {
|
||||
dump(ex + "\n");
|
||||
document.getElementById('result').value = "Error check console";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://navigator/skin/navigator.css" type="text/css"?>
|
||||
|
||||
<window title="history test"
|
||||
id="history-test-window" xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript" src="history-test.js"/>
|
||||
|
||||
<html:b>history test</html:b>
|
||||
<html:hr/>
|
||||
|
||||
<hbox flex="100%">
|
||||
<html:input id="result" type="text" style="min-width: 400px; min-height: 27px" flex="100%"/>
|
||||
</hbox>
|
||||
<html:hr/>
|
||||
<html:button onclick="ShowLastPageVisited();">Show Last Page Visited</html:button>
|
||||
</window>
|
|
@ -0,0 +1,425 @@
|
|||
/* -*- 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):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
// The history window uses JavaScript in bookmarksManager.js too.
|
||||
|
||||
var gHistoryTree;
|
||||
var gLastHostname;
|
||||
var gLastDomain;
|
||||
var gGlobalHistory;
|
||||
var gPrefService;
|
||||
var gDeleteByHostname;
|
||||
var gDeleteByDomain;
|
||||
var gHistoryBundle;
|
||||
var gHistoryStatus;
|
||||
var gSearchBox;
|
||||
var gHistoryGrouping = "";
|
||||
var gWindowManager = null;
|
||||
|
||||
function HistoryWindowInit()
|
||||
{
|
||||
gSearchBox = document.getElementById("search-box");
|
||||
HistoryCommonInit();
|
||||
gHistoryTree.focus();
|
||||
}
|
||||
|
||||
function HistoryCommonInit()
|
||||
{
|
||||
gHistoryTree = document.getElementById("historyTree");
|
||||
gDeleteByHostname = document.getElementById("menu_deleteByHostname");
|
||||
gDeleteByDomain = document.getElementById("menu_deleteByDomain");
|
||||
gHistoryBundle = document.getElementById("historyBundle");
|
||||
gHistoryStatus = document.getElementById("statusbar-display");
|
||||
|
||||
var treeController = new nsTreeController(gHistoryTree);
|
||||
|
||||
if ("arguments" in window && window.arguments[0] && window.arguments.length >= 1) {
|
||||
// We have been supplied a resource URI to root the tree on
|
||||
var uri = window.arguments[0];
|
||||
gHistoryTree.setAttribute("ref", uri);
|
||||
if (uri.substring(0,5) == "find:" &&
|
||||
!(window.arguments.length > 1 && window.arguments[1] == "newWindow")) {
|
||||
// Update the windowtype so that future searches are directed
|
||||
// there and the window is not re-used for bookmarks.
|
||||
var windowNode = document.getElementById("history-window");
|
||||
windowNode.setAttribute("windowtype", "history:searchresults");
|
||||
windowNode.setAttribute("title", gHistoryBundle.getString("search_results_title"));
|
||||
|
||||
}
|
||||
document.getElementById("groupingMenu").setAttribute("hidden", "true");
|
||||
}
|
||||
else {
|
||||
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
try {
|
||||
gHistoryGrouping = gPrefService.getCharPref("browser.history.grouping");
|
||||
}
|
||||
catch(e) {
|
||||
gHistoryGrouping = "day";
|
||||
}
|
||||
GroupBy(gHistoryGrouping);
|
||||
if (gHistoryStatus) { // must be the window
|
||||
switch(gHistoryGrouping) {
|
||||
case "none":
|
||||
document.getElementById("groupByNone").setAttribute("checked", "true");
|
||||
break;
|
||||
case "day":
|
||||
default:
|
||||
document.getElementById("groupByDay").setAttribute("checked", "true");
|
||||
}
|
||||
}
|
||||
else { // must be the sidebar panel
|
||||
var pb = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
var pbi = pb.QueryInterface(Components.interfaces.nsIPrefBranchInternal);
|
||||
pbi.addObserver("browser.history.grouping", groupObserver, false);
|
||||
}
|
||||
}
|
||||
|
||||
gHistoryTree.treeBoxObject.view.selection.select(0);
|
||||
}
|
||||
|
||||
function historyOnClick(aEvent)
|
||||
{
|
||||
// This is kind of a hack but matches the currently implemented behaviour.
|
||||
// If a status bar is not present, assume we're in sidebar mode, and thus single clicks on containers
|
||||
// will open the container. Single clicks on non-containers are handled below in historyOnSelect.
|
||||
if (!gHistoryStatus && aEvent.button == 0) {
|
||||
var row = { };
|
||||
var col = { };
|
||||
var elt = { };
|
||||
gHistoryTree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, elt);
|
||||
if (row.value >= 0 && col.value) {
|
||||
if (!isContainer(gHistoryTree, row.value))
|
||||
OpenURL(false);
|
||||
else if (elt.value != "twisty")
|
||||
gHistoryTree.treeBoxObject.view.toggleOpenState(row.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function historyOnSelect()
|
||||
{
|
||||
// every time selection changes, save the last hostname
|
||||
gLastHostname = "";
|
||||
gLastDomain = "";
|
||||
var match;
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
var rowIsContainer = gHistoryGrouping == "day" ? isContainer(gHistoryTree, currentIndex) : false;
|
||||
var url = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder).getResourceAtIndex(currentIndex).Value;
|
||||
|
||||
if (url && !rowIsContainer) {
|
||||
// matches scheme://(hostname)...
|
||||
match = url.match(/^.*?:\/\/(?:([^\/:]*)(?::([^\/:]*))?@)?([^\/:]*)(?::([^\/:]*))?(.*)$/);
|
||||
|
||||
if (match && match.length>1)
|
||||
gLastHostname = match[3];
|
||||
|
||||
gHistoryStatus.label = url;
|
||||
}
|
||||
else {
|
||||
gHistoryStatus.label = "";
|
||||
}
|
||||
|
||||
if (gLastHostname) {
|
||||
// matches the last foo.bar in foo.bar or baz.foo.bar
|
||||
match = gLastHostname.match(/([^.]+\.[^.]+$)/);
|
||||
if (match)
|
||||
gLastDomain = match[1];
|
||||
}
|
||||
document.commandDispatcher.updateCommands("select");
|
||||
}
|
||||
|
||||
function updateEditMenuitems() {
|
||||
var enabled = false, stringId;
|
||||
if (gLastHostname) {
|
||||
stringId = "deleteHost";
|
||||
enabled = true;
|
||||
} else {
|
||||
stringId = "deleteHostNoSelection";
|
||||
}
|
||||
var text = gHistoryBundle.getFormattedString(stringId, [ gLastHostname ]);
|
||||
gDeleteByHostname.setAttribute("label", text);
|
||||
gDeleteByHostname.setAttribute("disabled", enabled ? "false" : "true");
|
||||
|
||||
enabled = false;
|
||||
if (gLastDomain) {
|
||||
stringId = "deleteDomain";
|
||||
enabled = true;
|
||||
} else {
|
||||
stringId = "deleteDomainNoSelection";
|
||||
}
|
||||
text = gHistoryBundle.getFormattedString(stringId, [ gLastDomain ]);
|
||||
gDeleteByDomain.setAttribute("label", text);
|
||||
gDeleteByDomain.setAttribute("disabled", enabled ? "false" : "true");
|
||||
}
|
||||
|
||||
function deleteByHostname() {
|
||||
if (!gGlobalHistory)
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIBrowserHistory);
|
||||
gGlobalHistory.removePagesFromHost(gLastHostname, false)
|
||||
gHistoryTree.builder.rebuild();
|
||||
}
|
||||
|
||||
function deleteByDomain() {
|
||||
if (!gGlobalHistory)
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIBrowserHistory);
|
||||
gGlobalHistory.removePagesFromHost(gLastDomain, true)
|
||||
gHistoryTree.builder.rebuild();
|
||||
}
|
||||
|
||||
var historyDNDObserver = {
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
if (isContainer(gHistoryTree, currentIndex))
|
||||
return false;
|
||||
var url = gHistoryTree.treeBoxObject.view.getCellText(currentIndex, "URL");
|
||||
var title = gHistoryTree.treeBoxObject.view.getCellText(currentIndex, "Name");
|
||||
|
||||
var htmlString = "<A HREF='" + url + "'>" + title + "</A>";
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("text/unicode", url);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlString);
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", url + "\n" + title);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
function validClickConditions(event)
|
||||
{
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
if (currentIndex == -1) return false;
|
||||
var container = isContainer(gHistoryTree, currentIndex);
|
||||
return (event.button == 0 &&
|
||||
event.originalTarget.localName == 'treechildren' &&
|
||||
!container && gHistoryStatus);
|
||||
}
|
||||
|
||||
function collapseExpand()
|
||||
{
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
gHistoryTree.treeBoxObject.view.toggleOpenState(currentIndex);
|
||||
}
|
||||
|
||||
function OpenURL(aInNewWindow)
|
||||
{
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
|
||||
var url = builder.getResourceAtIndex(currentIndex).Value;
|
||||
|
||||
if (aInNewWindow) {
|
||||
var count = gHistoryTree.treeBoxObject.view.selection.count;
|
||||
if (count == 1) {
|
||||
if (isContainer(gHistoryTree, currentIndex))
|
||||
openDialog("chrome://communicator/content/history/history.xul",
|
||||
"", "chrome,all,dialog=no", url, "newWindow");
|
||||
else
|
||||
openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
|
||||
}
|
||||
else {
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
var rangeCount = gHistoryTree.treeBoxObject.view.selection.getRangeCount();
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
gHistoryTree.treeBoxObject.view.selection.getRangeAt(i, min, max);
|
||||
for (var k = max.value; k >= min.value; --k) {
|
||||
url = gHistoryTree.treeBoxObject.view.getCellText(k, "URL");
|
||||
window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!isContainer(gHistoryTree, currentIndex))
|
||||
openTopWin(url);
|
||||
return true;
|
||||
}
|
||||
|
||||
function GroupBy(groupingType)
|
||||
{
|
||||
gHistoryGrouping = groupingType;
|
||||
switch(groupingType) {
|
||||
case "none":
|
||||
gHistoryTree.setAttribute("ref", "NC:HistoryRoot");
|
||||
break;
|
||||
case "site":
|
||||
// xxx for now
|
||||
gHistoryTree.setAttribute("ref", "NC:HistoryByDate");
|
||||
break;
|
||||
case "day":
|
||||
default:
|
||||
gHistoryTree.setAttribute("ref", "NC:HistoryByDate");
|
||||
break;
|
||||
}
|
||||
gPrefService.setCharPref("browser.history.grouping", groupingType);
|
||||
}
|
||||
|
||||
var groupObserver = {
|
||||
observe: function(aPrefBranch, aTopic, aPrefName) {
|
||||
try {
|
||||
gHistoryGrouping = aPrefBranch.QueryInterface(Components.interfaces.nsIPrefBranch).getCharPref(aPrefName);
|
||||
GroupBy(gHistoryGrouping);
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function historyAddBookmarks()
|
||||
{
|
||||
var count = gHistoryTree.treeBoxObject.view.selection.count;
|
||||
var url;
|
||||
var title;
|
||||
if (count == 1) {
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
url = gHistoryTree.treeBoxObject.view.getCellText(currentIndex, "URL");
|
||||
title = gHistoryTree.treeBoxObject.view.getCellText(currentIndex, "Name");
|
||||
BookmarksUtils.addBookmark(url, title, undefined, true);
|
||||
}
|
||||
else if (count > 1) {
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
var rangeCount = gHistoryTree.treeBoxObject.view.selection.getRangeCount();
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
gHistoryTree.treeBoxObject.view.selection.getRangeAt(i, min, max);
|
||||
for (var k = max.value; k >= min.value; --k) {
|
||||
url = gHistoryTree.treeBoxObject.view.getCellText(k, "URL");
|
||||
title = gHistoryTree.treeBoxObject.view.getCellText(k, "Name");
|
||||
BookmarksUtils.addBookmark(url, title, undefined, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function updateItems()
|
||||
{
|
||||
var count = gHistoryTree.treeBoxObject.view.selection.count;
|
||||
var openItem = document.getElementById("miOpen");
|
||||
var bookmarkItem = document.getElementById("miAddBookmark");
|
||||
var copyLocationItem = document.getElementById("miCopyLinkLocation");
|
||||
var sep1 = document.getElementById("pre-bookmarks-separator");
|
||||
var openItemInNewWindow = document.getElementById("miOpenInNewWindow");
|
||||
var collapseExpandItem = document.getElementById("miCollapseExpand");
|
||||
if (count > 1) {
|
||||
var hasContainer = false;
|
||||
if (gHistoryGrouping == "day") {
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
var rangeCount = gHistoryTree.treeBoxObject.view.selection.getRangeCount();
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
gHistoryTree.treeBoxObject.view.selection.getRangeAt(i, min, max);
|
||||
for (var k = max.value; k >= min.value; --k) {
|
||||
if (isContainer(gHistoryTree, k)) {
|
||||
hasContainer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hasContainer) {
|
||||
bookmarkItem.setAttribute("hidden", "true");
|
||||
copyLocationItem.setAttribute("hidden", "true");
|
||||
sep1.setAttribute("hidden", "true");
|
||||
document.getElementById("post-bookmarks-separator").setAttribute("hidden", "true");
|
||||
openItem.setAttribute("hidden", "true");
|
||||
openItemInNewWindow.setAttribute("hidden", "true");
|
||||
collapseExpandItem.setAttribute("hidden", "true");
|
||||
}
|
||||
else {
|
||||
bookmarkItem.removeAttribute("hidden");
|
||||
copyLocationItem.removeAttribute("hidden");
|
||||
sep1.removeAttribute("hidden");
|
||||
bookmarkItem.setAttribute("label", document.getElementById('multipleBookmarks').getAttribute("label"));
|
||||
openItem.setAttribute("hidden", "true");
|
||||
openItem.removeAttribute("default");
|
||||
openItemInNewWindow.setAttribute("default", "true");
|
||||
}
|
||||
}
|
||||
else {
|
||||
bookmarkItem.setAttribute("label", document.getElementById('oneBookmark').getAttribute("label"));
|
||||
var currentIndex = gHistoryTree.currentIndex;
|
||||
if (isContainer(gHistoryTree, currentIndex)) {
|
||||
openItem.setAttribute("hidden", "true");
|
||||
openItem.removeAttribute("default");
|
||||
collapseExpandItem.removeAttribute("hidden");
|
||||
collapseExpandItem.setAttribute("default", "true");
|
||||
bookmarkItem.setAttribute("hidden", "true");
|
||||
copyLocationItem.setAttribute("hidden", "true");
|
||||
sep1.setAttribute("hidden", "true");
|
||||
if (isContainerOpen(gHistoryTree, currentIndex))
|
||||
collapseExpandItem.setAttribute("label", gHistoryBundle.getString("collapseLabel"));
|
||||
else
|
||||
collapseExpandItem.setAttribute("label", gHistoryBundle.getString("expandLabel"));
|
||||
return true;
|
||||
}
|
||||
collapseExpandItem.setAttribute("hidden", "true");
|
||||
bookmarkItem.removeAttribute("hidden");
|
||||
copyLocationItem.removeAttribute("hidden");
|
||||
sep1.removeAttribute("hidden");
|
||||
if (!gWindowManager) {
|
||||
gWindowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
|
||||
gWindowManager = gWindowManager.QueryInterface( Components.interfaces.nsIWindowMediator);
|
||||
}
|
||||
var topWindowOfType = gWindowManager.getMostRecentWindow("navigator:browser");
|
||||
if (!topWindowOfType) {
|
||||
openItem.setAttribute("hidden", "true");
|
||||
openItem.removeAttribute("default");
|
||||
openItemInNewWindow.setAttribute("default", "true");
|
||||
}
|
||||
else {
|
||||
openItem.removeAttribute("hidden");
|
||||
if (!openItem.getAttribute("default"))
|
||||
openItem.setAttribute("default", "true");
|
||||
openItemInNewWindow.removeAttribute("default");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function searchHistory(aInput)
|
||||
{
|
||||
if (!aInput)
|
||||
GroupBy(gHistoryGrouping);
|
||||
else
|
||||
gHistoryTree.setAttribute("ref",
|
||||
"find:datasource=history&match=Name&method=contains&text=" + escape(aInput));
|
||||
}
|
||||
|
||||
function openAboutDialog()
|
||||
{
|
||||
window.openDialog("chrome://browser/content/aboutDialog.xul", "About", "modal,centerscreen,chrome,resizable=no");
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
<?xml version="1.0"?> <!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
|
||||
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):
|
||||
Blake Ross <blaker@netscape.com>
|
||||
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://browser/content/history/historyTreeOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
|
||||
%brandDTD;
|
||||
<!ENTITY % historyDTD SYSTEM "chrome://browser/locale/history/history.dtd" >
|
||||
%historyDTD;
|
||||
]>
|
||||
|
||||
<window title="&historyWindowTitle.label;" id="history-window"
|
||||
onload="HistoryWindowInit();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="500" height="400"
|
||||
persist="width height screenX screenY sizemode"
|
||||
windowtype="history:manager">
|
||||
|
||||
<stringbundle id="historyBundle"
|
||||
src="chrome://browser/locale/history/history.properties"/>
|
||||
<stringbundle id="sortBundle" src="chrome://global/locale/nsTreeSorting.properties"/>
|
||||
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
<commandset id="globalEditMenuItems"/>
|
||||
|
||||
<!-- File Menu -->
|
||||
<command id="cmd_close" oncommand="window.close()"/>
|
||||
<command id="bm_cmd_saveas"/>
|
||||
|
||||
<keyset>
|
||||
<!-- File Menu -->
|
||||
<key id="key_close"/>
|
||||
<!-- Edit Menu -->
|
||||
<key id="key_cut"/>
|
||||
<key id="key_copy"/>
|
||||
<key id="key_delete"/>
|
||||
<key id="key_selectAll"/>
|
||||
</keyset>
|
||||
|
||||
<popupset id="historyContextMenu"/>
|
||||
|
||||
<toolbox>
|
||||
<menubar>
|
||||
<menu label="&fileMenu.label;" accesskey="&fileMenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem id="menu_close"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
|
||||
<menu id="menu_Edit">
|
||||
<menupopup onpopupshowing="updateEditMenuitems();">
|
||||
<menuitem id="menu_cut"/>
|
||||
<menuitem id="menu_copy"/>
|
||||
<menuitem id="menu_delete"/>
|
||||
<menuitem id="menu_deleteByHostname" oncommand="deleteByHostname();"
|
||||
accesskey="&deleteHostnameCmd.accesskey;"/>
|
||||
<menuitem id="menu_deleteByDomain" oncommand="deleteByDomain();"
|
||||
accesskey="&deleteDomainCmd.accesskey;"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_selectAll"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="menu_View">
|
||||
<menupopup onpopupshowing="fillViewMenu(this)">
|
||||
<menu id="groupingMenu" label="&groupBy.label;" accesskey="&groupBy.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem id="groupByDay" label="&groupByDay.label;" accesskey="&groupByDay.accesskey;" type="radio" oncommand="GroupBy('day');"/>
|
||||
<menuitem id="groupByNone" label="&groupByNone.label;" accesskey="&groupByNone.accesskey;" type="radio" oncommand="GroupBy('none');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem type="radio" name="sort_column" id="unsorted_menuitem"
|
||||
label="&menuitem.view.unsorted.label;"
|
||||
accesskey="&menuitem.view.unsorted.accesskey;"
|
||||
oncommand="return SortInNewDirection('natural');"/>
|
||||
<menuseparator id="fill_after_this_node"/>
|
||||
<menuseparator id="fill_before_this_node"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_ascending"
|
||||
label="&menuitem.view.ascending.label;"
|
||||
accesskey="&menuitem.view.ascending.accesskey;"
|
||||
oncommand="return SortInNewDirection('ascending');"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_descending"
|
||||
label="&menuitem.view.descending.label;"
|
||||
accesskey="&menuitem.view.descending.accesskey;"
|
||||
oncommand="return SortInNewDirection('descending');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu label="&helpMenu.label;"
|
||||
accesskey="&helpMenu.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem accesskey="&releaseCmd.accesskey;"
|
||||
label="&releaseCmd.label;"
|
||||
oncommand="openTopWin('&releaseURL;');"/>
|
||||
<menuseparator/>
|
||||
<menuitem accesskey="&aboutCmd.accesskey;"
|
||||
label="&aboutCmd.label;"
|
||||
oncommand="openAboutDialog();"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
</menubar>
|
||||
<toolbar>
|
||||
<hbox align="center" pack="center">
|
||||
<label value="&find.label;" accesskey="&find.accesskey;" control="search-box"/>
|
||||
</hbox>
|
||||
<textbox id="search-box" flex="1"
|
||||
type="timed" timeout="500"
|
||||
callback="searchHistory(gSearchBox.value);"/>
|
||||
</toolbar>
|
||||
</toolbox>
|
||||
<tree id="historyTree"/>
|
||||
<statusbar id="status-bar" class="chromeclass-status">
|
||||
<statusbarpanel id="statusbar-display" flex="1"/>
|
||||
</statusbar>
|
||||
|
||||
</window>
|
|
@ -0,0 +1,144 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
|
||||
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):
|
||||
Ben Goodger <ben@netscape.com>
|
||||
Blake Ross <blakeross@telocity.com>
|
||||
Alec Flett <alecf@netscape.com>
|
||||
-->
|
||||
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % historyDTD SYSTEM "chrome://communicator/locale/history/historyTreeOverlay.dtd" >
|
||||
%historyDTD;
|
||||
<!ENTITY % contentAreaCommandsDTD SYSTEM "chrome://communicator/locale/contentAreaCommands.dtd" >
|
||||
%contentAreaCommandsDTD;
|
||||
]>
|
||||
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
<overlay id="historyTreeOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:web="http://home.netscape.com/WEB-rdf#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTreeController.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTreeSorting.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/history/history.js"/>
|
||||
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
|
||||
|
||||
<popupset id="historyContextMenu">
|
||||
<command id="cmd_selectAll"/>
|
||||
<command id="cmd_cut"/>
|
||||
<command id="cmd_copy"/>
|
||||
<command id="cmd_delete"/>
|
||||
<command id="cmd_selectAll"/>
|
||||
<popup id="historyMenu" onpopupshowing="return updateItems();">
|
||||
<menuitem id="miCollapseExpand" accesskey="&collapseExpand.accesskey;" oncommand="collapseExpand();"/>
|
||||
<menuitem id="miOpen" label="&openLinkInWindowCmd.label;" accesskey="&openLinkInWindowCmd.accesskey;" default="true"
|
||||
oncommand="OpenURL(false);"/>
|
||||
<menuitem id="miOpenInNewWindow" label="&openLinkCmd.label;" accesskey="&openLinkCmd.accesskey;"
|
||||
oncommand="OpenURL(true);"/>
|
||||
<menuseparator id="pre-bookmarks-separator"/>
|
||||
<menuitem id="miAddBookmark" label="&bookmarkLinkCmd.label;" accesskey="&bookmarkLinkCmd.accesskey;" oncommand="historyAddBookmarks();"/>
|
||||
<menuitem id="miCopyLinkLocation" label="©LinkCmd.label;" accesskey="©LinkCmd.accesskey;"
|
||||
command="cmd_copy"/>
|
||||
<menuseparator id="post-bookmarks-separator"/>
|
||||
<menuitem id="miDelete" label="&deleteCmd.label;" accesskey="&deleteCmd.accesskey;"
|
||||
command="cmd_delete"/>
|
||||
<menuitem id="miSelectAll" label="&selectAllCmd.label;" accesskey="&selectAllCmd.accesskey;"
|
||||
command="cmd_selectAll"/>
|
||||
</popup>
|
||||
<data id="multipleBookmarks" label="&addToBookmarksCmd.label;" accesskey="&addToBookmarksCmd.accesskey;"/>
|
||||
<data id="oneBookmark" label="&bookmarkLinkCmd.label;" accesskey="&bookmarkLinkCmd.accesskey;"/>
|
||||
</popupset>
|
||||
<tree id="historyTree" flex="1" enableColumnDrag="true" class="plain"
|
||||
context="historyMenu"
|
||||
datasources="rdf:history" ref="NC:HistoryByDate" flags="dont-build-content"
|
||||
onkeypress="if (event.keyCode == 13) OpenURL(event.ctrlKey || event.metaKey);"
|
||||
onselect="this.treeBoxObject.view.selectionChanged();
|
||||
historyOnSelect();"
|
||||
onclick="historyOnClick(event);"
|
||||
ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, historyDNDObserver);"
|
||||
ondblclick="if (validClickConditions(event)) OpenURL(event.ctrlKey || event.metaKey);">
|
||||
<template>
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*" rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Date"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Hostname" />
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Referrer"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#VisitCount"/>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
<treecols id="historyTreeCols">
|
||||
<treecol flex="4" id="Name" persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.name.label;" primary="true"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
accesskey="&tree.header.name.akey;"
|
||||
class="sortDirectionIndicator"/>
|
||||
<splitter class="tree-splitter" id="pre-URL-splitter"/>
|
||||
<treecol flex="4" id="URL"
|
||||
persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.url.label;" class="sortDirectionIndicator"
|
||||
accesskey="&tree.header.url.akey;"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
<splitter class="tree-splitter" id="pre-Date-splitter"/>
|
||||
<treecol flex="1" id="Date"
|
||||
persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.date.label;" class="sortDirectionIndicator"
|
||||
accesskey="&tree.header.date.akey;"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Date"/>
|
||||
<splitter class="tree-splitter" id="pre-FirstVisitDate-splitter"/>
|
||||
<treecol flex="1" id="FirstVisitDate" hidden="true"
|
||||
persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.firstvisitdate.label;" class="sortDirectionIndicator"
|
||||
accesskey="&tree.header.firstvisitdate.akey;"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate"/>
|
||||
<splitter class="tree-splitter" id="pre-Hostname-splitter"/>
|
||||
<treecol flex="1" id="Hostname" hidden="true"
|
||||
persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.hostname.label;" class="sortDirectionIndicator"
|
||||
accesskey="&tree.header.hostname.akey;"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Hostname"/>
|
||||
<splitter class="tree-splitter" id="pre-Referrer-splitter"/>
|
||||
<treecol flex="1" id="Referrer" hidden="true"
|
||||
persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.referrer.label;" class="sortDirectionIndicator"
|
||||
accesskey="&tree.header.referrer.akey;"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Referrer"/>
|
||||
<splitter class="tree-splitter" id="pre-VisitCount-splitter"/>
|
||||
<treecol flex="1" id="VisitCount" hidden="true"
|
||||
persist="hidden width sortActive sortDirection ordinal"
|
||||
label="&tree.header.visitcount.label;" class="sortDirectionIndicator"
|
||||
accesskey="&tree.header.visitcount.akey;"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#VisitCount"/>
|
||||
</treecols>
|
||||
</tree>
|
||||
</overlay>
|
|
@ -0,0 +1,16 @@
|
|||
browser.jar:
|
||||
content/browser/history/history.xul (content/history.xul)
|
||||
content/browser/history/historyTreeOverlay.xul (content/historyTreeOverlay.xul)
|
||||
content/browser/history/history-panel.xul (content/history-panel.xul)
|
||||
content/browser/history/history.js (content/history.js)
|
||||
content/browser/history/history-test.xul (content/history-test.xul)
|
||||
content/browser/history/history-test.js (content/history-test.js)
|
||||
content/browser/history/findHistory.js (content/findHistory.js)
|
||||
content/browser/history/findHistory.xul (content/findHistory.xul)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/browser/history/history.dtd (locale/history.dtd)
|
||||
locale/en-US/browser/history/historyTreeOverlay.dtd (locale/historyTreeOverlay.dtd)
|
||||
locale/en-US/browser/history/history.properties (locale/history.properties)
|
||||
locale/en-US/browser/history/findHistory.dtd (locale/findHistory.dtd)
|
||||
|
|
@ -0,0 +1 @@
|
|||
history.dtd
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
<!ENTITY search.name.label "title">
|
||||
<!ENTITY search.url.label "location">
|
||||
<!ENTITY search.startswith.label "starts with">
|
||||
<!ENTITY search.endswith.label "ends with">
|
||||
<!ENTITY search.is.label "is">
|
||||
<!ENTITY search.isnot.label "is not">
|
||||
<!ENTITY search.contains.label "contains">
|
||||
<!ENTITY search.doesntcontain.label "doesn't contain">
|
||||
<!ENTITY search.for.label "Find visited documents whose">
|
||||
<!ENTITY findHistory.title "Find in History">
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<!-- extracted from ./history.xul -->
|
||||
|
||||
<!ENTITY menuBar.tooltip "Menu Bar">
|
||||
<!ENTITY fileMenu.label "File">
|
||||
<!ENTITY closeCmd.label "Close">
|
||||
<!ENTITY editMenu.label "Edit">
|
||||
<!ENTITY undoCmd.label "Undo">
|
||||
<!ENTITY redoCmd.label "Redo">
|
||||
<!ENTITY cutCmd.label "Cut">
|
||||
<!ENTITY copyCmd.label "Copy">
|
||||
<!ENTITY pasteCmd.label "Paste">
|
||||
<!ENTITY deleteCmd.label "Delete">
|
||||
<!ENTITY deleteHostnameCmd.accesskey "l">
|
||||
<!ENTITY deleteDomainCmd.accesskey "o">
|
||||
<!ENTITY selAllCmd.label "Select All">
|
||||
<!ENTITY findHisCmd.label "Search History...">
|
||||
<!ENTITY findHisCmd.commandkey "f">
|
||||
<!ENTITY findHisCmd.accesskey "S">
|
||||
<!ENTITY groupBy.label "Group By">
|
||||
<!ENTITY groupBy.accesskey "G">
|
||||
<!ENTITY groupByDay.label "Day">
|
||||
<!ENTITY groupByDay.accesskey "D">
|
||||
<!ENTITY groupByNone.label "None">
|
||||
<!ENTITY groupByNone.accesskey "N">
|
||||
<!ENTITY historyWindowTitle.label "History">
|
||||
<!ENTITY menuitem.view.unsorted.label "Unsorted">
|
||||
<!ENTITY menuitem.view.unsorted.accesskey "u">
|
||||
<!ENTITY menuitem.view.ascending.label "A > Z Sort Order">
|
||||
<!ENTITY menuitem.view.ascending.accesskey "a">
|
||||
<!ENTITY menuitem.view.descending.label "Z > A Sort Order">
|
||||
<!ENTITY menuitem.view.descending.accesskey "z">
|
||||
<!ENTITY menuitem.view.show_columns.label "Show columns">
|
||||
<!ENTITY menuitem.view.show_columns.accesskey "S">
|
||||
<!ENTITY fileMenu.label "File">
|
||||
<!ENTITY fileMenu.accesskey "F">
|
||||
<!ENTITY find.label "Find:">
|
||||
<!ENTITY find.accesskey "n">
|
||||
<!ENTITY helpMenu.label "Help">
|
||||
<!ENTITY helpMenu.accesskey "H">
|
||||
<!ENTITY releaseCmd.label "Release Notes">
|
||||
<!ENTITY releaseCmd.accesskey "R">
|
||||
<!ENTITY aboutCmd.label "About &brandShortName;">
|
||||
<!ENTITY aboutCmd.accesskey "A">
|
|
@ -0,0 +1,18 @@
|
|||
deleteHost=Delete all from %S
|
||||
deleteDomain=Delete entire domain %S
|
||||
deleteHostNoSelection=Delete host
|
||||
deleteDomainNoSelection=Delete domain
|
||||
|
||||
finduri-AgeInDays-is-0=Today
|
||||
finduri-AgeInDays-is-1=Yesterday
|
||||
finduri-AgeInDays-is=%S days ago
|
||||
finduri-AgeInDays-isgreater=Older than %S days
|
||||
|
||||
finduri-Hostname-is-=(no host)
|
||||
|
||||
search_button_label=Find
|
||||
search_results_title=Search Results
|
||||
|
||||
collapseLabel=Collapse
|
||||
expandLabel=Expand
|
||||
collapseExpandAccesskey=e
|
|
@ -0,0 +1,15 @@
|
|||
<!ENTITY tree.header.name.label "Title">
|
||||
<!ENTITY tree.header.name.akey "T">
|
||||
<!ENTITY tree.header.url.label "Location">
|
||||
<!ENTITY tree.header.url.akey "L">
|
||||
<!ENTITY tree.header.date.label "Last Visited">
|
||||
<!ENTITY tree.header.date.akey "a">
|
||||
<!ENTITY tree.header.firstvisitdate.label "First Visited">
|
||||
<!ENTITY tree.header.firstvisitdate.akey "F">
|
||||
<!ENTITY tree.header.referrer.label "Referrer">
|
||||
<!ENTITY tree.header.referrer.akey "R">
|
||||
<!ENTITY tree.header.hostname.label "Hostname">
|
||||
<!ENTITY tree.header.hostname.akey "H">
|
||||
<!ENTITY tree.header.visitcount.label "Visit Count">
|
||||
<!ENTITY tree.header.visitcount.akey "V">
|
||||
<!ENTITY collapseExpand.accesskey "e">
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# 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):
|
||||
# Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = history
|
||||
XPIDL_MODULE = history
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIGlobalHistory.idl \
|
||||
nsIBrowserHistory.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -0,0 +1,120 @@
|
|||
/* -*- Mode: C++; 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):
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/*
|
||||
* browser-specific interface to global history
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(1a9129f7-2490-49d1-ba54-196ddb848ddb)]
|
||||
interface nsIBrowserHistory : nsISupports
|
||||
{
|
||||
/**
|
||||
* count
|
||||
* The number of entries in global history
|
||||
*/
|
||||
readonly attribute PRUint32 count;
|
||||
|
||||
/**
|
||||
* setPageTitle
|
||||
* set the page title for the given url. Ignores urls that are not
|
||||
* already in the history
|
||||
*/
|
||||
void setPageTitle(in string aURL, in wstring aTitle);
|
||||
|
||||
/**
|
||||
* removePage
|
||||
* Remove the specified page from the global history
|
||||
*/
|
||||
void removePage(in string aURL);
|
||||
|
||||
/**
|
||||
* startBatchUpdate
|
||||
* Signals the beginning of some kind of batch update (e.g. delete).
|
||||
* Observers won't be notified until there are no batches in progress
|
||||
* (a startBatchUpdate call should always be followed by one to
|
||||
* endBatchUpdate).
|
||||
*/
|
||||
void startBatchUpdate();
|
||||
|
||||
/**
|
||||
* endBatchUpdate
|
||||
* Signals the end of a batch update.
|
||||
*/
|
||||
void endBatchUpdate();
|
||||
|
||||
/**
|
||||
* removePagesFromHost
|
||||
* Remove all pages from the given host.
|
||||
* If aEntireDomain is true, will assume aHost is a domain,
|
||||
* and remove all pages from the entire domain.
|
||||
*/
|
||||
void removePagesFromHost(in string aHost, in boolean aEntireDomain);
|
||||
|
||||
/**
|
||||
* removeAllPages
|
||||
* Remove all pages from global history
|
||||
*/
|
||||
void removeAllPages();
|
||||
|
||||
/**
|
||||
* lastPageVisited
|
||||
* the most recently visited page
|
||||
*/
|
||||
readonly attribute string lastPageVisited;
|
||||
|
||||
|
||||
/**
|
||||
* hidePage
|
||||
* Hide the specified URL from being enumerated (and thus
|
||||
* displayed in the UI)
|
||||
*
|
||||
* if the page hasn't been visited yet, then it will be added
|
||||
* as if it was visited, and then marked as hidden
|
||||
*/
|
||||
|
||||
void hidePage(in string url);
|
||||
|
||||
/**
|
||||
* markPageAsTyped
|
||||
* Designate the url as having been explicitly typed in by
|
||||
* the user, so it's okay to be an autocomplete result.
|
||||
*/
|
||||
|
||||
void markPageAsTyped(in string url);
|
||||
};
|
|
@ -0,0 +1,67 @@
|
|||
/* -*- Mode: C++; 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):
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
/**
|
||||
* The interface to global history.
|
||||
*
|
||||
* @status FROZEN
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(9491C383-E3C4-11d2-BDBE-0050040A9B44)]
|
||||
interface nsIGlobalHistory : nsISupports
|
||||
{
|
||||
/**
|
||||
* addPage
|
||||
* Add a page to the history
|
||||
*
|
||||
* @param aURL the url to the page
|
||||
*/
|
||||
|
||||
void addPage(in string aURL);
|
||||
|
||||
/**
|
||||
* isVisited
|
||||
* Checks to see if the given page is in history
|
||||
*
|
||||
* @return true if a page has been passed into addPage().
|
||||
* @param aURL the url to the page
|
||||
*/
|
||||
boolean isVisited(in string aURL);
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1,49 @@
|
|||
#
|
||||
# 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):
|
||||
# Joe Hewitt <hewitt@netscape.com> (Original Author)
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = history
|
||||
LIBRARY_NAME = history_s
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
rdf \
|
||||
mork \
|
||||
pref \
|
||||
necko \
|
||||
intl \
|
||||
unicharutil \
|
||||
autocomplete \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = nsGlobalHistory.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,427 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** 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 Communicator client 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):
|
||||
* Chris Waterson <waterson@netscape.com>
|
||||
* Blake Ross <blaker@netscape.com>
|
||||
* Joe Hewitt <hewitt@netscape.com>
|
||||
*
|
||||
* 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 ***** */
|
||||
|
||||
#ifndef nsglobalhistory__h____
|
||||
#define nsglobalhistory__h____
|
||||
|
||||
#include "nsIGlobalHistory.h"
|
||||
#include "nsIBrowserHistory.h"
|
||||
|
||||
#include "mdb.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFRemoteDataSource.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsSharableString.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIAutoCompleteSearch.h"
|
||||
#include "nsIAutoCompleteResult.h"
|
||||
#include "nsIAutoCompleteResultTypes.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsMdbTableEnumerator
|
||||
//
|
||||
// An nsISimpleEnumerator implementation that returns the value of
|
||||
// a column as an nsISupports. Allows for some simple selection.
|
||||
//
|
||||
|
||||
class nsMdbTableEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
protected:
|
||||
nsMdbTableEnumerator();
|
||||
virtual ~nsMdbTableEnumerator();
|
||||
|
||||
nsIMdbEnv* mEnv;
|
||||
|
||||
private:
|
||||
// subclasses should not tweak these
|
||||
nsIMdbTable* mTable;
|
||||
nsIMdbTableRowCursor* mCursor;
|
||||
nsIMdbRow* mCurrent;
|
||||
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsISimpleEnumeratorMethods
|
||||
NS_IMETHOD HasMoreElements(PRBool* _result);
|
||||
NS_IMETHOD GetNext(nsISupports** _result);
|
||||
|
||||
// Implementation methods
|
||||
virtual nsresult Init(nsIMdbEnv* aEnv, nsIMdbTable* aTable);
|
||||
|
||||
protected:
|
||||
virtual PRBool IsResult(nsIMdbRow* aRow) = 0;
|
||||
virtual nsresult ConvertToISupports(nsIMdbRow* aRow, nsISupports** aResult) = 0;
|
||||
};
|
||||
|
||||
typedef PRBool (*rowMatchCallback)(nsIMdbRow *aRow, void *closure);
|
||||
|
||||
struct matchHost_t;
|
||||
struct searchQuery;
|
||||
class searchTerm;
|
||||
|
||||
// Number of prefixes used in the autocomplete sort comparison function
|
||||
#define AUTOCOMPLETE_PREFIX_LIST_COUNT 6
|
||||
// Size of visit count boost to give to urls which are sites or paths
|
||||
#define AUTOCOMPLETE_NONPAGE_VISIT_COUNT_BOOST 5
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
//
|
||||
// nsGlobalHistory
|
||||
//
|
||||
// This class is the browser's implementation of the
|
||||
// nsIGlobalHistory interface.
|
||||
//
|
||||
|
||||
|
||||
// Used to describe what prefixes shouldn't be cut from
|
||||
// history urls when doing an autocomplete url comparison.
|
||||
struct AutocompleteExclude {
|
||||
PRInt32 schemePrefix;
|
||||
PRInt32 hostnamePrefix;
|
||||
};
|
||||
|
||||
class nsGlobalHistory : nsSupportsWeakReference,
|
||||
public nsIGlobalHistory,
|
||||
public nsIBrowserHistory,
|
||||
public nsIObserver,
|
||||
public nsIRDFDataSource,
|
||||
public nsIRDFRemoteDataSource,
|
||||
public nsIAutoCompleteSearch
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_DECL_NSIGLOBALHISTORY
|
||||
NS_DECL_NSIBROWSERHISTORY
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSIRDFDATASOURCE
|
||||
NS_DECL_NSIRDFREMOTEDATASOURCE
|
||||
NS_DECL_NSIAUTOCOMPLETESEARCH
|
||||
|
||||
NS_METHOD Init();
|
||||
|
||||
nsGlobalHistory(void);
|
||||
virtual ~nsGlobalHistory();
|
||||
|
||||
// these must be public so that the callbacks can call them
|
||||
PRBool MatchExpiration(nsIMdbRow *row, PRInt64* expirationDate);
|
||||
PRBool MatchHost(nsIMdbRow *row, matchHost_t *hostInfo);
|
||||
PRBool RowMatches(nsIMdbRow* aRow, searchQuery *aQuery);
|
||||
|
||||
protected:
|
||||
|
||||
//
|
||||
// database junk
|
||||
//
|
||||
enum eCommitType
|
||||
{
|
||||
kLargeCommit = 0,
|
||||
kSessionCommit = 1,
|
||||
kCompressCommit = 2
|
||||
};
|
||||
|
||||
PRInt64 mFileSizeOnDisk;
|
||||
nsresult OpenDB();
|
||||
nsresult OpenExistingFile(nsIMdbFactory *factory, const char *filePath);
|
||||
nsresult OpenNewFile(nsIMdbFactory *factory, const char *filePath);
|
||||
nsresult CreateTokens();
|
||||
nsresult CloseDB();
|
||||
nsresult CheckHostnameEntries();
|
||||
nsresult Commit(eCommitType commitType);
|
||||
|
||||
//
|
||||
// expiration/removal stuff
|
||||
//
|
||||
PRInt32 mExpireDays;
|
||||
nsresult ExpireEntries(PRBool notify);
|
||||
nsresult RemoveMatchingRows(rowMatchCallback aMatchFunc,
|
||||
void *aClosure, PRBool notify);
|
||||
|
||||
//
|
||||
// search stuff - find URL stuff, etc
|
||||
//
|
||||
nsresult GetRootDayQueries(nsISimpleEnumerator **aResult);
|
||||
nsresult GetFindUriName(const char *aURL, nsIRDFNode **aResult);
|
||||
nsresult CreateFindEnumerator(nsIRDFResource *aSource,
|
||||
nsISimpleEnumerator **aResult);
|
||||
|
||||
static nsresult FindUrlToTokenList(const char *aURL, nsVoidArray& aResult);
|
||||
static void FreeTokenList(nsVoidArray& tokens);
|
||||
static void FreeSearchQuery(searchQuery& aQuery);
|
||||
static PRBool IsFindResource(nsIRDFResource *aResource);
|
||||
void GetFindUriPrefix(const searchQuery& aQuery,
|
||||
const PRBool aDoGroupBy,
|
||||
nsACString& aResult);
|
||||
|
||||
nsresult TokenListToSearchQuery(const nsVoidArray& tokens,
|
||||
searchQuery& aResult);
|
||||
nsresult FindUrlToSearchQuery(const char *aURL, searchQuery& aResult);
|
||||
nsresult NotifyFindAssertions(nsIRDFResource *aSource, nsIMdbRow *aRow);
|
||||
nsresult NotifyFindUnassertions(nsIRDFResource *aSource, nsIMdbRow *aRow);
|
||||
|
||||
//
|
||||
// autocomplete stuff
|
||||
//
|
||||
PRBool mAutocompleteOnlyTyped;
|
||||
nsStringArray mIgnoreSchemes;
|
||||
nsStringArray mIgnoreHostnames;
|
||||
|
||||
nsresult AutoCompleteTypedSearch(nsIAutoCompleteMdbResult **aResult);
|
||||
nsresult AutoCompleteSearch(const nsAString& aSearchString,
|
||||
AutocompleteExclude* aExclude,
|
||||
nsIAutoCompleteMdbResult* aPrevResult,
|
||||
nsIAutoCompleteMdbResult** aResult);
|
||||
void AutoCompleteCutPrefix(nsAString& aURL, AutocompleteExclude* aExclude);
|
||||
void AutoCompleteGetExcludeInfo(const nsAString& aURL, AutocompleteExclude* aExclude);
|
||||
nsSharableString AutoCompletePrefilter(const nsAString& aSearchString);
|
||||
PRBool AutoCompleteCompare(nsAString& aHistoryURL,
|
||||
const nsAString& aUserURL,
|
||||
AutocompleteExclude* aExclude);
|
||||
PR_STATIC_CALLBACK(int)
|
||||
AutoCompleteSortComparison(const void *v1, const void *v2, void *closureVoid);
|
||||
|
||||
// AutoCompleteSortClosure - used to pass info into
|
||||
// AutoCompleteSortComparison from the NS_QuickSort() function
|
||||
struct AutoCompleteSortClosure
|
||||
{
|
||||
nsGlobalHistory* history;
|
||||
size_t prefixCount;
|
||||
nsAFlatString* prefixes[AUTOCOMPLETE_PREFIX_LIST_COUNT];
|
||||
};
|
||||
|
||||
// caching of PR_Now() so we don't call it every time we do
|
||||
// a history query
|
||||
PRInt64 mLastNow; // cache the last PR_Now()
|
||||
PRInt32 mBatchesInProgress;
|
||||
PRBool mNowValid; // is mLastNow valid?
|
||||
nsCOMPtr<nsITimer> mExpireNowTimer;
|
||||
|
||||
PRInt64 GetNow();
|
||||
void ExpireNow();
|
||||
|
||||
static void expireNowTimer(nsITimer *aTimer, void *aClosure)
|
||||
{((nsGlobalHistory *)aClosure)->ExpireNow(); }
|
||||
|
||||
//
|
||||
// sync stuff to write the db to disk every so often
|
||||
//
|
||||
PRBool mDirty; // if we've changed history
|
||||
nsCOMPtr<nsITimer> mSyncTimer;
|
||||
|
||||
void Sync();
|
||||
nsresult SetDirty();
|
||||
|
||||
static void fireSyncTimer(nsITimer *aTimer, void *aClosure)
|
||||
{((nsGlobalHistory *)aClosure)->Sync(); }
|
||||
|
||||
//
|
||||
// RDF stuff
|
||||
//
|
||||
nsCOMPtr<nsISupportsArray> mObservers;
|
||||
|
||||
PRBool IsURLInHistory(nsIRDFResource* aResource);
|
||||
|
||||
nsresult NotifyAssert(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aValue);
|
||||
nsresult NotifyUnassert(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aValue);
|
||||
nsresult NotifyChange(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aOldValue, nsIRDFNode* aNewValue);
|
||||
|
||||
//
|
||||
// row-oriented stuff
|
||||
//
|
||||
|
||||
// N.B., these are MDB interfaces, _not_ XPCOM interfaces.
|
||||
nsIMdbEnv* mEnv; // OWNER
|
||||
nsIMdbStore* mStore; // OWNER
|
||||
nsIMdbTable* mTable; // OWNER
|
||||
|
||||
nsCOMPtr<nsIMdbRow> mMetaRow;
|
||||
|
||||
mdb_scope kToken_HistoryRowScope;
|
||||
mdb_kind kToken_HistoryKind;
|
||||
|
||||
mdb_column kToken_URLColumn;
|
||||
mdb_column kToken_ReferrerColumn;
|
||||
mdb_column kToken_LastVisitDateColumn;
|
||||
mdb_column kToken_FirstVisitDateColumn;
|
||||
mdb_column kToken_VisitCountColumn;
|
||||
mdb_column kToken_NameColumn;
|
||||
mdb_column kToken_HostnameColumn;
|
||||
mdb_column kToken_HiddenColumn;
|
||||
mdb_column kToken_TypedColumn;
|
||||
|
||||
// meta-data tokens
|
||||
mdb_column kToken_LastPageVisited;
|
||||
|
||||
//
|
||||
// AddPage-oriented stuff
|
||||
//
|
||||
nsresult AddPageToDatabase(const char *aURL,
|
||||
PRInt64 aDate);
|
||||
nsresult AddExistingPageToDatabase(nsIMdbRow *row,
|
||||
PRInt64 aDate,
|
||||
PRInt64 *aOldDate,
|
||||
PRInt32 *aOldCount);
|
||||
nsresult AddNewPageToDatabase(const char *aURL,
|
||||
PRInt64 aDate,
|
||||
nsIMdbRow **aResult);
|
||||
//
|
||||
// generic routines for setting/retrieving various datatypes
|
||||
//
|
||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRInt64& aValue);
|
||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRInt32 aValue);
|
||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const char *aValue);
|
||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRUnichar *aValue);
|
||||
|
||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsAString& aResult);
|
||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACString& aResult);
|
||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt64* aResult);
|
||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt32* aResult);
|
||||
|
||||
nsresult FindRow(mdb_column aCol, const char *aURL, nsIMdbRow **aResult);
|
||||
|
||||
//
|
||||
// misc unrelated stuff
|
||||
//
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
nsresult SaveLastPageVisited(const char *);
|
||||
|
||||
// pseudo-constants. although the global history really is a
|
||||
// singleton, we'll use this metaphor to be consistent.
|
||||
static PRInt32 gRefCnt;
|
||||
static nsIRDFService* gRDFService;
|
||||
static nsIRDFResource* kNC_Page; // XXX do we need?
|
||||
static nsIRDFResource* kNC_Date;
|
||||
static nsIRDFResource* kNC_FirstVisitDate;
|
||||
static nsIRDFResource* kNC_VisitCount;
|
||||
static nsIRDFResource* kNC_AgeInDays;
|
||||
static nsIRDFResource* kNC_Name;
|
||||
static nsIRDFResource* kNC_NameSort;
|
||||
static nsIRDFResource* kNC_Hostname;
|
||||
static nsIRDFResource* kNC_Referrer;
|
||||
static nsIRDFResource* kNC_child;
|
||||
static nsIRDFResource* kNC_URL; // XXX do we need?
|
||||
static nsIRDFResource* kNC_HistoryRoot;
|
||||
static nsIRDFResource* kNC_HistoryByDate;
|
||||
|
||||
static nsIMdbFactory* gMdbFactory;
|
||||
static nsIPrefBranch* gPrefBranch;
|
||||
//
|
||||
// custom enumerators
|
||||
//
|
||||
|
||||
// URLEnumerator - for searching for a specific set of rows which
|
||||
// match a particular column
|
||||
class URLEnumerator : public nsMdbTableEnumerator
|
||||
{
|
||||
protected:
|
||||
mdb_column mURLColumn;
|
||||
mdb_column mHiddenColumn;
|
||||
mdb_column mSelectColumn;
|
||||
void* mSelectValue;
|
||||
PRInt32 mSelectValueLen;
|
||||
|
||||
virtual ~URLEnumerator();
|
||||
|
||||
public:
|
||||
URLEnumerator(mdb_column aURLColumn,
|
||||
mdb_column aHiddenColumn,
|
||||
mdb_column aSelectColumn = mdb_column(0),
|
||||
void* aSelectValue = nsnull,
|
||||
PRInt32 aSelectValueLen = 0) :
|
||||
mURLColumn(aURLColumn),
|
||||
mHiddenColumn(aHiddenColumn),
|
||||
mSelectColumn(aSelectColumn),
|
||||
mSelectValue(aSelectValue),
|
||||
mSelectValueLen(aSelectValueLen)
|
||||
{}
|
||||
|
||||
protected:
|
||||
virtual PRBool IsResult(nsIMdbRow* aRow);
|
||||
virtual nsresult ConvertToISupports(nsIMdbRow* aRow, nsISupports** aResult);
|
||||
};
|
||||
|
||||
// SearchEnumerator - for matching a set of rows based on a search query
|
||||
class SearchEnumerator : public nsMdbTableEnumerator
|
||||
{
|
||||
public:
|
||||
SearchEnumerator(searchQuery *aQuery,
|
||||
mdb_column aHiddenColumn,
|
||||
nsGlobalHistory *aHistory) :
|
||||
mQuery(aQuery),
|
||||
mHiddenColumn(aHiddenColumn),
|
||||
mHistory(aHistory)
|
||||
{}
|
||||
|
||||
virtual ~SearchEnumerator();
|
||||
|
||||
protected:
|
||||
searchQuery *mQuery;
|
||||
mdb_column mHiddenColumn;
|
||||
nsGlobalHistory *mHistory;
|
||||
nsHashtable mUniqueRows;
|
||||
|
||||
nsCString mFindUriPrefix;
|
||||
|
||||
virtual PRBool IsResult(nsIMdbRow* aRow);
|
||||
virtual nsresult ConvertToISupports(nsIMdbRow* aRow,
|
||||
nsISupports** aResult);
|
||||
|
||||
PRBool RowMatches(nsIMdbRow* aRow, searchQuery *aQuery);
|
||||
};
|
||||
|
||||
|
||||
friend class URLEnumerator;
|
||||
friend class SearchEnumerator;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsglobalhistory__h____
|
|
@ -0,0 +1,177 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 Communicator client 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.
|
||||
*
|
||||
* Original Author(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsHistoryLoadListener.h"
|
||||
#include "nsIGlobalHistory.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIWebProgress.h"
|
||||
#include "nsIRequestObserver.h"
|
||||
#include "nsCURILoader.h"
|
||||
|
||||
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
|
||||
|
||||
nsHistoryLoadListener::nsHistoryLoadListener(nsIBrowserHistory *aHistory)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
mHistory = aHistory;
|
||||
printf("Creating nsHistoryLoadListener\n");
|
||||
}
|
||||
|
||||
nsHistoryLoadListener::~nsHistoryLoadListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHistoryLoadListener::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// the global docloader
|
||||
nsCOMPtr<nsIDocumentLoader> docLoaderService =
|
||||
do_GetService(kDocLoaderServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
printf("Have docloader\n");
|
||||
|
||||
nsCOMPtr<nsIWebProgress> progress =
|
||||
do_QueryInterface(docLoaderService, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
printf("have web progress\n");
|
||||
|
||||
NS_ADDREF_THIS();
|
||||
rv = progress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*,
|
||||
this),
|
||||
nsIWebProgress::NOTIFY_STATE_DOCUMENT);
|
||||
printf("\tSuccess: %8.8X\n", rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsHistoryLoadListener,
|
||||
nsIWebProgressListener,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aStateFlags, in nsresult aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsHistoryLoadListener::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRUint32 aStateFlags, nsresult aStatus)
|
||||
{
|
||||
// we only care about finishing up documents
|
||||
if (! (aStateFlags & nsIWebProgressListener::STATE_STOP))
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window;
|
||||
rv = aWebProgress->GetDOMWindow(getter_AddRefs(window));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
rv = window->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (!doc) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = doc->GetDocumentURL(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString urlString;
|
||||
uri->GetSpec(getter_Copies(urlString));
|
||||
|
||||
if (aStatus == NS_BINDING_REDIRECTED) {
|
||||
|
||||
mHistory->HidePage(urlString);
|
||||
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
|
||||
|
||||
// there should be a better way to handle non-html docs
|
||||
if (!htmlDoc) return NS_OK;
|
||||
// somehow get the title, and store it in history
|
||||
nsAutoString title;
|
||||
htmlDoc->GetTitle(title);
|
||||
|
||||
mHistory->SetPageTitle(urlString, title.get());
|
||||
|
||||
#if 0
|
||||
nsAutoString referrer;
|
||||
htmlDoc->GetReferrer(referrer);
|
||||
mHistory->SetReferrer(urlString, referrer.get());
|
||||
#endif
|
||||
}
|
||||
printf("nsHistoryLoadListener::OnStateChange(w,r, %8.8X, %d)\n", aStateFlags, aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
|
||||
NS_IMETHODIMP
|
||||
nsHistoryLoadListener::OnProgressChange(nsIWebProgress *aWebProgress,
|
||||
nsIRequest *aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location); */
|
||||
NS_IMETHODIMP nsHistoryLoadListener::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
|
||||
NS_IMETHODIMP nsHistoryLoadListener::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const PRUnichar *aMessage)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
|
||||
NS_IMETHODIMP nsHistoryLoadListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state)
|
||||
{
|
||||
NS_NOTREACHED("notification excluded in AddProgressListener(...)");
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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 Communicator client 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.
|
||||
*
|
||||
* Original Author(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIBrowserHistory.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
class nsHistoryLoadListener : public nsIWebProgressListener,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
nsHistoryLoadListener(nsIBrowserHistory *);
|
||||
virtual ~nsHistoryLoadListener();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIBrowserHistory> mHistory;
|
||||
|
||||
};
|
||||
|
|
@ -0,0 +1,244 @@
|
|||
/* -*- Mode: C++; 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 Communicator client 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 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 ***** */
|
||||
|
||||
/*
|
||||
|
||||
DO NOT USE THIS. IT IS INTENDED FOR TEMPORARY USE BY GLOBAL HISTORY,
|
||||
PENDING CONVERSION OF THE MDB INTERFACES TO XPCOM.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsMdbPtr_h__
|
||||
#define nsMdbPtr_h__
|
||||
|
||||
#include "mdb.h"
|
||||
|
||||
template <class T>
|
||||
class nsMdbDerivedSafe : public T
|
||||
{
|
||||
private:
|
||||
virtual mdb_err AddStrongRef(nsIMdbEnv* aEnv) { return 0; } // NOT TO BE IMPLEMENTED
|
||||
virtual mdb_err CutStrongRef(nsIMdbEnv* aEnv) { return 0; } // NOT TO BE IMPLEMENTED
|
||||
virtual nsMdbDerivedSafe<T>& operator=(const T&) { return *this; } // NOT TO BE IMPLEMENTED
|
||||
void operator delete(void*, size_t) {} // NOT TO BE IMPLEMENTED
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsMdbPtr
|
||||
{
|
||||
private:
|
||||
nsIMdbEnv* mEnv;
|
||||
T* mRawPtr;
|
||||
|
||||
public:
|
||||
nsMdbPtr(nsIMdbEnv* aEnv) : mEnv(aEnv), mRawPtr(0)
|
||||
{
|
||||
NS_PRECONDITION(aEnv != 0, "null ptr");
|
||||
}
|
||||
|
||||
nsMdbPtr(nsIMdbEnv* aEnv, T* aRawPtr) : mEnv(aEnv), mRawPtr(0)
|
||||
{
|
||||
NS_PRECONDITION(aEnv != 0, "null ptr");
|
||||
if (mEnv) {
|
||||
if (aRawPtr) {
|
||||
mRawPtr = aRawPtr;
|
||||
mRawPtr->AddStrongRef(mEnv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsMdbPtr(const nsMdbPtr<T>& aSmartPtr) : mEnv(aSmartPtr.mEnv), mRawPtr(0)
|
||||
{
|
||||
if (mEnv) {
|
||||
if (aSmartPtr) {
|
||||
mRawPtr = aSmartPtr;
|
||||
mRawPtr->AddStrongRef(mEnv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsMdbPtr<T>&
|
||||
operator=(const nsMdbPtr<T>& aSmartPtr)
|
||||
{
|
||||
if (mEnv) {
|
||||
if (mRawPtr) {
|
||||
mRawPtr->CutStrongRef(mEnv);
|
||||
mRawPtr = 0;
|
||||
}
|
||||
}
|
||||
mEnv = aSmartPtr.mEnv;
|
||||
if (mEnv) {
|
||||
mRawPtr = aSmartPtr.mRawPtr;
|
||||
if (mRawPtr)
|
||||
mRawPtr->AddStrongRef(mEnv);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
~nsMdbPtr()
|
||||
{
|
||||
if (mEnv) {
|
||||
if (mRawPtr)
|
||||
mRawPtr->CutStrongRef(mEnv);
|
||||
}
|
||||
}
|
||||
|
||||
nsMdbDerivedSafe<T>*
|
||||
get() const
|
||||
{
|
||||
return NS_REINTERPRET_CAST(nsMdbDerivedSafe<T>*, mRawPtr);
|
||||
}
|
||||
|
||||
nsMdbDerivedSafe<T>*
|
||||
operator->() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
|
||||
nsMdbDerivedSafe<T>&
|
||||
operator*() const
|
||||
{
|
||||
return *get();
|
||||
}
|
||||
|
||||
operator nsMdbDerivedSafe<T>*() const
|
||||
{
|
||||
return get();
|
||||
}
|
||||
|
||||
|
||||
T**
|
||||
StartAssignment()
|
||||
{
|
||||
if (mRawPtr) {
|
||||
mRawPtr->CutStrongRef(mEnv);
|
||||
mRawPtr = 0;
|
||||
}
|
||||
return &mRawPtr;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
PRBool
|
||||
operator==(const nsMdbPtr<T>& lhs, const nsMdbPtr<U>& rhs)
|
||||
{
|
||||
return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs.get());
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
PRBool
|
||||
operator==(const nsMdbPtr<T>& lhs, const U* rhs)
|
||||
{
|
||||
return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
PRBool
|
||||
operator==(const U* lhs, const nsMdbPtr<T>& rhs)
|
||||
{
|
||||
return NS_STATIC_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
PRBool
|
||||
operator!=(const nsMdbPtr<T>& lhs, const nsMdbPtr<U>& rhs)
|
||||
{
|
||||
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
PRBool
|
||||
operator!=(const nsMdbPtr<T>& lhs, const U* rhs)
|
||||
{
|
||||
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs);
|
||||
}
|
||||
|
||||
|
||||
template <class T, class U>
|
||||
inline
|
||||
PRBool
|
||||
operator!=(const U* lhs, const nsMdbPtr<T>& rhs)
|
||||
{
|
||||
return NS_STATIC_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
class nsGetterAcquires
|
||||
{
|
||||
private:
|
||||
nsMdbPtr<T>& mTargetSmartPtr;
|
||||
|
||||
public:
|
||||
explicit
|
||||
nsGetterAcquires(nsMdbPtr<T>& aSmartPtr) : mTargetSmartPtr(aSmartPtr)
|
||||
{
|
||||
// nothing else to do
|
||||
}
|
||||
|
||||
operator T**()
|
||||
{
|
||||
return mTargetSmartPtr.StartAssignment();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
nsGetterAcquires<T>
|
||||
getter_Acquires(nsMdbPtr<T>& aSmartPtr)
|
||||
{
|
||||
return nsGetterAcquires<T>(aSmartPtr);
|
||||
}
|
||||
|
||||
|
||||
#endif // nsMdbPtr_h__
|
||||
|
Загрузка…
Ссылка в новой задаче