diff --git a/mozilla/toolkit/components/places/public/nsINavHistoryService.idl b/mozilla/toolkit/components/places/public/nsINavHistoryService.idl index a635f40b781..2171b20d685 100644 --- a/mozilla/toolkit/components/places/public/nsINavHistoryService.idl +++ b/mozilla/toolkit/components/places/public/nsINavHistoryService.idl @@ -1131,7 +1131,7 @@ interface nsINavHistoryQueryOptions : nsISupports nsINavHistoryQueryOptions clone(); }; -[scriptable, uuid(ac992686-b98a-40e1-b104-7b1ff8f0c016)] +[scriptable, uuid(c5846d2c-5340-4cfb-9c0d-c15feca939ce)] interface nsINavHistoryService : nsISupports { /** @@ -1328,23 +1328,12 @@ interface nsINavHistoryService : nsISupports * history is disabled if the browser.history_expire_days pref is 0 */ readonly attribute boolean historyDisabled; -}; -/** - * nsIMorkHistoryImporter is a service which handles importing old - * history files. - */ -[scriptable, uuid(be935aed-6929-4e44-be29-17ec89e5c8bd)] -interface nsIMorkHistoryImporter : nsISupports -{ /** * Import the given Mork history file. * @param file The Mork history file to import - * @param history A reference to the nsINavHistoryService. This is - * supplied since the importer is invoked during - * history service initialization. */ - void importHistory(in nsIFile file, in nsINavHistoryService history); + void importHistory(in nsIFile file); }; /** diff --git a/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp b/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp index 0cbd2dfa218..0fd6be7e14f 100644 --- a/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp +++ b/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.cpp @@ -36,15 +36,13 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsMorkHistoryImporter.h" +#include "nsMorkReader.h" #include "nsNavHistory.h" #include "mozStorageHelper.h" #include "prprf.h" #include "nsNetUtil.h" #include "nsTArray.h" -NS_IMPL_ISUPPORTS1(nsMorkHistoryImporter, nsIMorkHistoryImporter) - // Columns for entry (non-meta) history rows enum { kURLColumn, @@ -95,11 +93,11 @@ SwapBytes(PRUnichar *buffer) } } -// Enumerator callback to add a table row to the NavHistoryService -/* static */ PLDHashOperator PR_CALLBACK -nsMorkHistoryImporter::AddToHistoryCB(const nsCSubstring &aRowID, - const nsTArray *aValues, - void *aData) +// Enumerator callback to add a table row to history +static PLDHashOperator PR_CALLBACK +AddToHistoryCB(const nsCSubstring &aRowID, + const nsTArray *aValues, + void *aData) { TableReadClosure *data = static_cast(aData); const nsMorkReader *reader = data->reader; @@ -166,15 +164,16 @@ nsMorkHistoryImporter::AddToHistoryCB(const nsCSubstring &aRowID, return PL_DHASH_NEXT; } +// nsNavHistory::ImportHistory +// // ImportHistory is the main entry point to the importer. // It sets up the file stream and loops over the lines in the file to // parse them, then adds the resulting row set to history. - +// NS_IMETHODIMP -nsMorkHistoryImporter::ImportHistory(nsIFile *aFile, - nsINavHistoryService *aHistory) +nsNavHistory::ImportHistory(nsIFile* aFile) { - NS_ENSURE_TRUE(aFile && aHistory, NS_ERROR_NULL_POINTER); + NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER); // Check that the file exists before we try to open it PRBool exists; @@ -192,8 +191,7 @@ nsMorkHistoryImporter::ImportHistory(nsIFile *aFile, NS_ENSURE_SUCCESS(rv, rv); // Gather up the column ids so we don't need to find them on each row - nsNavHistory *history = static_cast(aHistory); - TableReadClosure data(&reader, history); + TableReadClosure data(&reader, this); const nsTArray &columns = reader.GetColumns(); for (PRUint32 i = 0; i < columns.Length(); ++i) { const nsCSubstring &name = columns[i].name; @@ -229,18 +227,18 @@ nsMorkHistoryImporter::ImportHistory(nsIFile *aFile, } // Now add the results to history - mozIStorageConnection *conn = history->GetStorageConnection(); + mozIStorageConnection *conn = GetStorageConnection(); NS_ENSURE_TRUE(conn, NS_ERROR_NOT_INITIALIZED); mozStorageTransaction transaction(conn, PR_FALSE); #ifdef IN_MEMORY_LINKS - mozIStorageConnection *memoryConn = history->GetMemoryStorageConnection(); + mozIStorageConnection *memoryConn = GetMemoryStorageConnection(); mozStorageTransaction memTransaction(memoryConn, PR_FALSE); #endif reader.EnumerateRows(AddToHistoryCB, &data); // Make sure we don't have any duplicate items in the database. - rv = history->RemoveDuplicateURIs(); + rv = RemoveDuplicateURIs(); NS_ENSURE_SUCCESS(rv, rv); #ifdef IN_MEMORY_LINKS diff --git a/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.h b/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.h deleted file mode 100644 index 9eb1dedc4da..00000000000 --- a/mozilla/toolkit/components/places/src/nsMorkHistoryImporter.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Places. - * - * The Initial Developer of the Original Code is - * Google Inc. - * Portions created by the Initial Developer are Copyright (C) 2006 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Brian Ryner (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 MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef nsMorkHistoryImporter_h_ -#define nsMorkHistoryImporter_h_ - -#include "nsINavHistoryService.h" -#include "nsMorkReader.h" - -template class nsTArray; - -// The nsMorkHistoryImporter object parses a Mork-format history file and -// adds the history items to the NavHistoryService. It is invoked the first -// time the history service is created for a given profile, if a Mork history -// (history.dat) file exists. - -class nsMorkHistoryImporter : public nsIMorkHistoryImporter -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIMORKHISTORYIMPORTER - -private: - // Enumerator callback to add a single row to the NavHistory. - static PLDHashOperator PR_CALLBACK - AddToHistoryCB(const nsCSubstring &aRowID, - const nsTArray *aValues, - void *aData); -}; - -#endif // nsMorkHistoryImporter_h_ diff --git a/mozilla/toolkit/components/places/src/nsNavHistory.cpp b/mozilla/toolkit/components/places/src/nsNavHistory.cpp index bda9e67d383..1aa25a360e1 100644 --- a/mozilla/toolkit/components/places/src/nsNavHistory.cpp +++ b/mozilla/toolkit/components/places/src/nsNavHistory.cpp @@ -39,7 +39,6 @@ #include #include "nsNavHistory.h" #include "nsNavBookmarks.h" -#include "nsMorkHistoryImporter.h" #include "nsAnnotationService.h" #include "nsIArray.h" @@ -388,14 +387,11 @@ nsNavHistory::Init() observerService->AddObserver(this, gXpcomShutdown, PR_FALSE); if (doImport) { - nsCOMPtr importer = new nsMorkHistoryImporter(); - NS_ENSURE_TRUE(importer, NS_ERROR_OUT_OF_MEMORY); - nsCOMPtr historyFile; rv = NS_GetSpecialDirectory(NS_APP_HISTORY_50_FILE, getter_AddRefs(historyFile)); if (NS_SUCCEEDED(rv) && historyFile) { - importer->ImportHistory(historyFile, this); + ImportHistory(historyFile); } } diff --git a/mozilla/toolkit/components/places/src/nsNavHistory.h b/mozilla/toolkit/components/places/src/nsNavHistory.h index 701e40b8b05..2b75fb479d9 100644 --- a/mozilla/toolkit/components/places/src/nsNavHistory.h +++ b/mozilla/toolkit/components/places/src/nsNavHistory.h @@ -87,7 +87,7 @@ #define QUERYUPDATE_COMPLEX 2 #define QUERYUPDATE_COMPLEX_WITH_BOOKMARKS 3 -class AutoCompleteIntermediateResult; +struct AutoCompleteIntermediateResult; class AutoCompleteResultComparator; class mozIAnnotationService; class nsNavHistory; diff --git a/mozilla/toolkit/components/places/src/nsNavHistoryExpire.cpp b/mozilla/toolkit/components/places/src/nsNavHistoryExpire.cpp index 2d99f0ffc93..7a154f93bf2 100644 --- a/mozilla/toolkit/components/places/src/nsNavHistoryExpire.cpp +++ b/mozilla/toolkit/components/places/src/nsNavHistoryExpire.cpp @@ -88,7 +88,7 @@ struct nsNavHistoryExpireRecord { // Expiration policy amounts (in microseconds) const PRTime EXPIRATION_POLICY_DAYS = (7 * 86400 * PR_MSEC_PER_SEC); const PRTime EXPIRATION_POLICY_WEEKS = (30 * 86400 * PR_MSEC_PER_SEC); -const PRTime EXPIRATION_POLICY_MONTHS = (180 * 86400 * PR_MSEC_PER_SEC); +const PRTime EXPIRATION_POLICY_MONTHS = ((PRTime)180 * 86400 * PR_MSEC_PER_SEC); // nsNavHistoryExpire::nsNavHistoryExpire // diff --git a/mozilla/toolkit/components/places/src/nsNavHistoryExpire.h b/mozilla/toolkit/components/places/src/nsNavHistoryExpire.h index 4f1545b05d3..167761859be 100644 --- a/mozilla/toolkit/components/places/src/nsNavHistoryExpire.h +++ b/mozilla/toolkit/components/places/src/nsNavHistoryExpire.h @@ -44,7 +44,7 @@ class mozIStorageConnection; class nsNavHistory; -class nsNavHistoryExpireRecord; +struct nsNavHistoryExpireRecord; class nsNavHistoryExpire { diff --git a/mozilla/toolkit/components/places/src/nsPlacesModule.cpp b/mozilla/toolkit/components/places/src/nsPlacesModule.cpp index 9c637272c51..2ae5fdd7ae5 100644 --- a/mozilla/toolkit/components/places/src/nsPlacesModule.cpp +++ b/mozilla/toolkit/components/places/src/nsPlacesModule.cpp @@ -5,14 +5,12 @@ #include "nsNavHistory.h" #include "nsNavBookmarks.h" #include "nsFaviconService.h" -#include "nsMorkHistoryImporter.h" NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNavHistory, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAnnoProtocolHandler) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAnnotationService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNavBookmarks, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFaviconService, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsMorkHistoryImporter) static const nsModuleComponentInfo components[] = { @@ -51,11 +49,6 @@ static const nsModuleComponentInfo components[] = NS_FAVICONSERVICE_CONTRACTID, nsFaviconServiceConstructor }, - { "Mork History Importer", - NS_MORKHISTORYIMPORTER_CID, - NS_MORKHISTORYIMPORTER_CONTRACTID, - nsMorkHistoryImporterConstructor }, - }; NS_IMPL_NSGETMODULE(nsPlacesModule, components)