Bug 386392 - Drop pre places/places-bookmarks support from browser/. r=gavin.

This commit is contained in:
mozilla.mano@sent.com 2007-07-17 14:08:24 -07:00
Родитель 9bdc719073
Коммит 365ac374df
49 изменённых файлов: 23 добавлений и 2227 удалений

Просмотреть файл

@ -15,10 +15,8 @@
<!ENTITY % customizeToolbarDTD SYSTEM "chrome://global/locale/customizeToolbar.dtd">
%customizeToolbarDTD;
#endif
#ifdef MOZ_PLACES
<!ENTITY % placesDTD SYSTEM "chrome://browser/locale/places/places.dtd">
%placesDTD;
#endif
#ifdef MOZ_SAFE_BROWSING
<!ENTITY % safebrowsingDTD SYSTEM "chrome://browser/locale/safebrowsing/phishing-afterload-warning-message.dtd">
%safebrowsingDTD;

Просмотреть файл

@ -1,23 +0,0 @@
<!-- Total hack. Used by the Go menu to build up items. -->
<tree id="hiddenHistoryTree" hidden="true" collapsed="true" datasources="rdf:null"
flags="dont-build-content"
hidecolumnpicker="true">
<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#Date" hidden="true"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecols id="hiddenHistoryTreeCols">
<treecol flex="1" id="Name"
hideheader="true" primary="true"/>
<treecol id="Date" hidden="true" hideheader="true"
sort="rdf:http://home.netscape.com/NC-rdf#Date" sortActive="true" sortDirection="descending"/>
</treecols>
</tree>

Просмотреть файл

@ -323,7 +323,6 @@
</menupopup>
</menu>
#ifdef MOZ_PLACES
<menu id="history-menu"
oncommand="var url = event.target.getAttribute('statustext'); if (url) openUILink(url, event, false, true);"
onclick="checkForMiddleClick(this, event);"
@ -367,94 +366,7 @@
key="key_gotoHistory"/>
</menupopup>
</menu>
#else
<menu id="go-menu" label="&historyMenu.label;" accesskey="&historyMenu.accesskey;"
oncommand="var url = event.target.getAttribute('statustext'); if (url) openUILink(url, event, false, true);"
onclick="checkForMiddleClick(this, event);">
<menupopup id="goPopup" onpopupshowing="updateGoMenu(event, this);" onpopuphiding="onGoMenuHidden(event);">
<menuitem label="&backCmd.label;"
#ifdef XP_MACOSX
key="goBackKb2"
#else
key="goBackKb"
#endif
oncommand="BrowserBack(event, true)"
onclick="checkForMiddleClick(this, event);">
<observes element="Browser:Back" attribute="disabled" />
</menuitem>
<menuitem label="&forwardCmd.label;"
#ifdef XP_MACOSX
key="goForwardKb2"
#else
key="goForwardKb"
#endif
oncommand="BrowserForward(event, true)"
onclick="checkForMiddleClick(this, event);">
<observes element="Browser:Forward" attribute="disabled" />
</menuitem>
<menuitem label="&goHomeCmd.label;"
command="Browser:Home"
key="goHome"/>
<menuseparator id="startHistorySeparator"/>
<menuseparator hidden="true" id="endHistorySeparator"/>
<menu id="historyUndoMenu" label="&historyUndoMenu.label;" disabled="true">
<menupopup id="historyUndoPopup" onpopupshowing="HistoryMenu.populateUndoSubmenu();"/>
</menu>
<menuseparator id="endUndoSeparator"/>
<menuitem observes="viewHistorySidebar" label="&historyShowSidebarCmd.label;"
key="key_gotoHistory"/>
</menupopup>
</menu>
#endif
#ifndef MOZ_PLACES_BOOKMARKS
<menu id="bookmarks-menu" label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
datasources="rdf:bookmarks rdf:files"
ref="NC:BookmarksRoot" flags="dont-test-empty"
template='bookmarks-template'
infer="forward-proxy"
onpopupshowing="BookmarksMenu.onShowMenu(event.target)"
onpopuphidden="BookmarksMenu.onHideMenu(event.target)"
oncommand="BookmarksMenu.loadBookmark(event, event.target, this.database)"
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"
ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)"
ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.stopPropagation()">
<menupopup id="menu_BookmarksPopup" contextmenu='bookmarks-context-menu'>
<menuitem key="addBookmarkAsKb"
label="&addCurPageAsCmd.label;"
command="Browser:AddBookmarkAs"/>
<menuitem id="subscribeToPageMenuitem"
label="&subscribeToPageMenuitem.label;"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"
disabled="true"/>
<menu id="subscribeToPageMenupopup"
label="&subscribeToPageMenupopup.label;"
hidden="true">
<menupopup id="subscribeToPageSubmenuMenupopup"
onpopupshowing="return FeedHandler.buildFeedList(event.target);"
oncommand="return FeedHandler.subscribeToFeed(null, event);"
onclick="checkForMiddleClick(this, event);"/>
</menu>
<menuitem id="bookmarkAllCmd"
# Accel+Shift+A-F are reserved on GTK2
#ifndef MOZ_WIDGET_GTK2
key="bookmarkAllTabsKb"
#endif
label="&bookmarkAllCmd.label;"
command="Browser:BookmarkAllTabs"/>
<menuitem key="manBookmarkKb"
label="&manBookmarksCmd.label;"
oncommand="toOpenWindowByType('bookmarks:manager', 'chrome://browser/content/bookmarks/bookmarksManager.xul');"/>
<menuseparator/>
</menupopup>
</menu>
#else
<menu id="bookmarksMenu"
label="&bookmarksMenu.label;" accesskey="&bookmarksMenu.accesskey;"
ondragenter="PlacesMenuDNDController.onBookmarksMenuDragEnter(event);"
@ -491,7 +403,6 @@
<menuseparator builder="start"/>
</menupopup>
</menu>
#endif
<menu id="tools-menu" label="&toolsMenu.label;" accesskey="&toolsMenu.accesskey;">
<menupopup id="menu_ToolsPopup">
@ -534,106 +445,3 @@
#endif
<menu id="helpMenu" />
</menubar>
#ifndef MOZ_PLACES_BOOKMARKS
<template id='bookmarks-template' xmlns:nc="http://home.netscape.com/NC-rdf#">
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<toolbarseparator uri="rdf:*"
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
</rule>
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#Livemark">
<toolbarbutton type="menu" class="bookmark-item" uri="rdf:*" editable="true"
rdf:type="http://home.netscape.com/NC-rdf#Folder"
label="rdf:http://home.netscape.com/NC-rdf#Name"
livemark="true"
chromedir="&locale.dir;">
#ifdef XP_MACOSX
<menupopup/>
#else
<menupopup contextmenu="bookmarks-context-menu"/>
#endif
</toolbarbutton>
</rule>
<rule parent="hbox" iscontainer="true">
<toolbarbutton type="menu" class="bookmark-item" uri="rdf:*" editable="true"
rdf:type="http://home.netscape.com/NC-rdf#Folder"
label="rdf:http://home.netscape.com/NC-rdf#Name">
#ifdef XP_MACOSX
<menupopup/>
#else
<menupopup contextmenu="bookmarks-context-menu"/>
#endif
</toolbarbutton>
</rule>
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#MicsumBookmark">
<toolbarbutton class="bookmark-item-microsummarized bookmark-item"
uri="rdf:*" editable="true"
status="rdf:http://home.netscape.com/WEB-rdf#status"
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
image="rdf:http://home.netscape.com/NC-rdf#Icon"
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
tooltip="btTooltip"
label="rdf:http://home.netscape.com/NC-rdf#GeneratedTitle"/>
</rule>
<rule parent="hbox">
<toolbarbutton class="bookmark-item" uri="rdf:*" editable="true"
status="rdf:http://home.netscape.com/WEB-rdf#status"
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
image="rdf:http://home.netscape.com/NC-rdf#Icon"
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
tooltip="btTooltip"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<menupopup>
<menuseparator uri="rdf:*" />
</menupopup>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#Livemark">
<menupopup>
<menu class="menu-iconic bookmark-item" uri="rdf:*"
label="rdf:http://home.netscape.com/NC-rdf#Name"
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
livemark="true">
#ifdef XP_MACOSX
<menupopup/>
#else
<menupopup contextmenu="bookmarks-context-menu"/>
#endif
</menu>
</menupopup>
</rule>
<rule iscontainer="true">
<menupopup>
<menu class="menu-iconic bookmark-item" uri="rdf:*"
label="rdf:http://home.netscape.com/NC-rdf#Name"
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
#ifdef XP_MACOSX
<menupopup/>
#else
<menupopup contextmenu="bookmarks-context-menu"/>
#endif
</menu>
</menupopup>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#MicsumBookmark">
<menupopup>
<menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
label="rdf:http://home.netscape.com/NC-rdf#GeneratedTitle"
image="rdf:http://home.netscape.com/NC-rdf#Icon"
status="rdf:http://home.netscape.com/WEB-rdf#status"
statustext="rdf:http://home.netscape.com/NC-rdf#URL"/>
</menupopup>
</rule>
<rule>
<menupopup>
<menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
label="rdf:http://home.netscape.com/NC-rdf#Name"
image="rdf:http://home.netscape.com/NC-rdf#Icon"
status="rdf:http://home.netscape.com/WEB-rdf#status"
statustext="rdf:http://home.netscape.com/NC-rdf#URL"/>
</menupopup>
</rule>
</template>
#endif

Просмотреть файл

@ -52,23 +52,6 @@
<commandset id="mainCommandSet">
<command id="cmd_newNavigator" oncommand="OpenBrowserWindow()"/>
#ifndef MOZ_PLACES_BOOKMARKS
<command id="cmd_bm_open" oncommand="goDoCommand('cmd_bm_open');"/>
<command id="cmd_bm_openinnewwindow" oncommand="goDoCommand('cmd_bm_openinnewwindow');"/>
<command id="cmd_bm_openinnewtab" oncommand="goDoCommand('cmd_bm_openinnewtab');"/>
<command id="cmd_bm_openfolder" oncommand="goDoCommand('cmd_bm_openfolder');"/>
<command id="cmd_bm_managefolder" oncommand="goDoCommand('cmd_bm_managefolder');"/>
<command id="cmd_bm_newfolder" oncommand="goDoCommand('cmd_bm_newfolder');"/>
<command id="cmd_bm_newbookmark" oncommand="goDoCommand('cmd_bm_newbookmark');"/>
<command id="cmd_bm_newseparator" oncommand="goDoCommand('cmd_bm_newseparator');"/>
<command id="cmd_bm_properties" oncommand="goDoCommand('cmd_bm_properties');"/>
<command id="cmd_bm_refreshlivemark" oncommand="goDoCommand('cmd_bm_refreshlivemark');"/>
<command id="cmd_bm_refreshmicrosummary" oncommand="goDoCommand('cmd_bm_refreshmicrosummary');"/>
<command id="cmd_bm_rename" oncommand="goDoCommand('cmd_bm_rename');"/>
<command id="cmd_bm_moveBookmark" oncommand="goDoCommand('cmd_bm_moveBookmark');"/>
<command id="cmd_bm_sortbyname" oncommand="goDoCommand('cmd_bm_sortbyname');"/>
#endif
<command id="cmd_handleBackspace" oncommand="BrowserHandleBackspace();" />
<command id="cmd_handleShiftBackspace" oncommand="BrowserHandleShiftBackspace();" />
@ -103,12 +86,8 @@
<command id="cmd_findPrevious"
oncommand="gFindBar.onFindAgainCommand(true);"
observes="isImage"/>
#ifdef MOZ_PLACES_BOOKMARKS
<command id="Browser:AddBookmarkAs"
oncommand="PlacesCommandHook.bookmarkCurrentPage();"/>
#else
<command id="Browser:AddBookmarkAs" oncommand="addBookmarkAs(document.getElementById('content'), false);"/>
#endif
<!-- The command is disabled for the hidden window. Otherwise its enabled
state is handled by the BookmarkAllTabsHandler object. -->
<command id="Browser:BookmarkAllTabs"
@ -135,14 +114,10 @@
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
</commandset>
#ifdef MOZ_PLACES
<commandset id="placesCommands">
#ifdef MOZ_PLACES_BOOKMARKS
<command id="Browser:ShowBookmarks"
oncommand="PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS);"/>
#endif
</commandset>
#endif
<broadcasterset id="mainBroadcasterSet">
<broadcaster id="viewBookmarksSidebar" autoCheck="false" label="&bookmarksButton.label;"

Просмотреть файл

@ -60,14 +60,6 @@
const kXULNS =
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
#ifndef MOZ_PLACES
# For Places-enabled builds, this is in
# chrome://browser/content/places/controller.js
var Ci = Components.interfaces;
var Cc = Components.classes;
var Cr = Components.results;
#endif
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const MAX_HISTORY_MENU_ITEMS = 15;
@ -148,13 +140,6 @@ function pageShowEventHandlers(event)
} else {
targetBrowser = gBrowser.mCurrentBrowser;
}
#ifndef MOZ_PLACES_BOOKMARKS
// update the last visited date
if (targetBrowser.currentURI.spec)
BMSVC.updateLastVisitedDate(targetBrowser.currentURI.spec,
targetBrowser.contentDocument.characterSet);
#endif
}
/**
@ -298,15 +283,9 @@ function BookmarkThisTab()
if (tab.localName != "tab")
tab = getBrowser().mCurrentTab;
#ifdef MOZ_PLACES_BOOKMARKS
PlacesCommandHook.bookmarkPage(tab.linkedBrowser);
#else
addBookmarkAs(tab.linkedBrowser, false);
#endif
PlacesCommandHook.bookmarkPage(tab.linkedBrowser)
}
#ifdef MOZ_PLACES_BOOKMARKS
/**
* Global bookmarks observer for browser-window specific stuff
*/
@ -353,7 +332,6 @@ function initBookmarksToolbar() {
bt.place =
PlacesUtils.getQueryStringForFolder(PlacesUtils.bookmarks.toolbarFolder);
}
#endif
const gSessionHistoryObserver = {
observe: function(subject, topic, data)
@ -1035,27 +1013,10 @@ function delayedStartup()
// add bookmark options to context menu for tabs
addBookmarkMenuitems();
#ifndef MOZ_PLACES_BOOKMARKS
initServices();
initBMService();
// now load bookmarks
BMSVC.readBookmarks();
var bt = document.getElementById("bookmarks-ptf");
if (bt) {
var btf = BMSVC.getBookmarksToolbarFolder().Value;
bt.ref = btf;
document.getElementById("bookmarks-chevron").ref = btf;
bt.database.AddObserver(BookmarksToolbarRDFObserver);
}
window.addEventListener("resize", BookmarksToolbar.resizeFunc, false);
document.getElementById("PersonalToolbar")
.controllers.appendController(BookmarksMenuController);
#else
PlacesMenuDNDController.init();
initBookmarksToolbar();
PlacesUtils.bookmarks.addObserver(gBookmarksObserver, false);
#endif
// called when we go into full screen, even if it is
// initiated by a web page script
@ -1191,23 +1152,7 @@ function BrowserShutdown()
} catch (ex) {
}
#ifdef MOZ_PLACES_BOOKMARKS
PlacesUtils.bookmarks.removeObserver(gBookmarksObserver);
#else
try {
document.getElementById("PersonalToolbar")
.controllers.removeController(BookmarksMenuController);
} catch (ex) {
}
var bt = document.getElementById("bookmarks-ptf");
if (bt) {
try {
bt.database.RemoveObserver(BookmarksToolbarRDFObserver);
} catch (ex) {
}
}
#endif
try {
gPrefService.removeObserver(gAutoHideTabbarPrefListener.domain,
@ -1300,12 +1245,6 @@ function nonBrowserWindowStartup()
function nonBrowserWindowDelayedStartup()
{
// loads the services
#ifndef MOZ_PLACES_BOOKMARKS
initServices();
initBMService();
#endif
// init global pref service
gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
@ -1627,181 +1566,6 @@ function loadOneOrMoreURIs(aURIString)
}
}
#ifndef MOZ_PLACES
function constructGoMenuItem(goMenu, beforeItem, url, title)
{
var menuitem = document.createElementNS(kXULNS, "menuitem");
menuitem.setAttribute("statustext", url);
menuitem.setAttribute("label", title);
goMenu.insertBefore(menuitem, beforeItem);
return menuitem;
}
function onGoMenuHidden(aEvent)
{
if (aEvent.target == aEvent.currentTarget)
setTimeout(destroyGoMenuItems, 0, document.getElementById('goPopup'));
}
function destroyGoMenuItems(goMenu) {
var startSeparator = document.getElementById("startHistorySeparator");
var endSeparator = document.getElementById("endHistorySeparator");
endSeparator.hidden = true;
// Destroy the items.
var destroy = false;
for (var i = 0; i < goMenu.childNodes.length; i++) {
var item = goMenu.childNodes[i];
if (item == endSeparator)
break;
if (destroy) {
i--;
goMenu.removeChild(item);
}
if (item == startSeparator)
destroy = true;
}
}
function updateGoMenu(aEvent, goMenu)
{
if (aEvent.target != aEvent.currentTarget)
return;
// In case the timer didn't fire.
destroyGoMenuItems(goMenu);
// enable/disable RCT sub menu
// do this here, before the early return
HistoryMenu.toggleRecentlyClosedTabs();
var history = document.getElementById("hiddenHistoryTree");
if (history.hidden) {
history.hidden = false;
var globalHistory = Components.classes["@mozilla.org/browser/global-history;2"]
.getService(Components.interfaces.nsIRDFDataSource);
history.database.AddDataSource(globalHistory);
}
if (!history.ref)
history.ref = "NC:HistoryRoot";
var count = history.view.rowCount;
if (count > 10)
count = 10;
if (count == 0)
return;
const NC_NS = "http://home.netscape.com/NC-rdf#";
if (!gRDF)
gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var builder = history.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
var beforeItem = document.getElementById("endHistorySeparator");
var nameResource = gRDF.GetResource(NC_NS + "Name");
var endSep = beforeItem;
var showSep = false;
for (var i = count-1; i >= 0; i--) {
var res = builder.getResourceAtIndex(i);
var url = res.Value;
var titleRes = history.database.GetTarget(res, nameResource, true);
if (!titleRes)
continue;
showSep = true;
var titleLiteral = titleRes.QueryInterface(Components.interfaces.nsIRDFLiteral);
beforeItem = constructGoMenuItem(goMenu, beforeItem, url, titleLiteral.Value);
}
if (showSep)
endSep.hidden = false;
}
#endif
#ifndef MOZ_PLACES_BOOKMARKS
function addBookmarkAs(aBrowser, aBookmarkAllTabs, aIsWebPanel)
{
const browsers = aBrowser.browsers;
// we only disable the menu item on onpopupshowing; if we get
// here via keyboard shortcut, we need to pretend like
// nothing happened if we have no tabs
if ((!browsers || browsers.length == 1) && aBookmarkAllTabs)
return;
if (browsers && browsers.length > 1)
addBookmarkForTabBrowser(aBrowser, aBookmarkAllTabs);
else
addBookmarkForBrowser(aBrowser.webNavigation, aIsWebPanel);
}
function addBookmarkForTabBrowser(aTabBrowser, aBookmarkAllTabs, aSelect)
{
var tabsInfo = [];
var currentTabInfo = { name: "", url: "", charset: null };
const activeBrowser = aTabBrowser.selectedBrowser;
const browsers = aTabBrowser.browsers;
for (var i = 0; i < browsers.length; ++i) {
var webNav = browsers[i].webNavigation;
var url = webNav.currentURI.spec;
var name = "";
var charSet, description;
try {
var doc = webNav.document;
name = doc.title || url;
charSet = doc.characterSet;
description = BookmarksUtils.getDescriptionFromDocument(doc);
} catch (e) {
name = url;
}
tabsInfo[i] = { name: name, url: url, charset: charSet, description: description };
if (browsers[i] == activeBrowser)
currentTabInfo = tabsInfo[i];
}
var dialogArgs = currentTabInfo;
if (aBookmarkAllTabs) {
dialogArgs = { name: gNavigatorBundle.getString("bookmarkAllTabsDefault") };
dialogArgs.bBookmarkAllTabs = true;
}
dialogArgs.objGroup = tabsInfo;
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
BROWSER_ADD_BM_FEATURES, dialogArgs);
}
function addBookmarkForBrowser(aDocShell, aIsWebPanel)
{
// Bug 52536: We obtain the URL and title from the nsIWebNavigation
// associated with a <browser/> rather than from a DOMWindow.
// This is because when a full page plugin is loaded, there is
// no DOMWindow (?) but information about the loaded document
// may still be obtained from the webNavigation.
var url = aDocShell.currentURI.spec;
var title, charSet = null;
var description;
try {
title = aDocShell.document.title || url;
charSet = aDocShell.document.characterSet;
description = BookmarksUtils.getDescriptionFromDocument(aDocShell.document);
}
catch (e) {
title = url;
}
BookmarksUtils.addBookmark(url, title, charSet, aIsWebPanel, description);
}
#endif
function openLocation()
{
if (gURLBar && isElementVisible(gURLBar)) {
@ -1975,13 +1739,9 @@ function getShortcutOrURI(aURL, aPostDataRef) {
return engine.getSubmission(param, null).uri.spec;
try {
#ifdef MOZ_PLACES_BOOKMARKS
var shortcutURI = PlacesUtils.bookmarks.getURIForKeyword(keyword);
shortcutURL = shortcutURI.spec;
aPostDataRef.value = PlacesUtils.getPostDataForURI(shortcutURI);
#else
shortcutURL = BMSVC.resolveKeyword(keyword, aPostDataRef);
#endif
} catch(ex) {}
if (!shortcutURL)
@ -1998,14 +1758,7 @@ function getShortcutOrURI(aURL, aPostDataRef) {
if (matches)
[, shortcutURL, charset] = matches;
else {
try {
//XXX Bug 317472 will add lastCharset support to places.
#ifndef MOZ_PLACES_BOOKMARKS
charset = BMSVC.getLastCharset(shortcutURL);
#endif
} catch (ex) {
Components.utils.reportError(ex);
}
//XXX Bug 317472 will add lastCharset support to places.
}
var encodedParam = "";
@ -2716,18 +2469,8 @@ var bookmarksButtonObserver = {
{
var split = aXferData.data.split("\n");
var url = split[0];
if (url != aXferData.data) { //do nothing if it's not a valid URL
#ifndef MOZ_PLACES_BOOKMARKS
var dialogArgs = {
name: split[1],
url: url
}
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
BROWSER_ADD_BM_FEATURES, dialogArgs);
#else
if (url != aXferData.data) // do nothing if it's not a valid URL
PlacesUtils.showMinimalAddBookmarkUI(makeURI(url), split[1]);
#endif
}
},
onDragOver: function (aEvent, aFlavour, aDragSession)
@ -3337,31 +3080,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
SetClickAndHoldHandlers();
#endif
#ifdef MOZ_PLACES_BOOKMARKS
initBookmarksToolbar();
#else
// fix up the personal toolbar folder
var bt = document.getElementById("bookmarks-ptf");
if (bt) {
var btf = BMSVC.getBookmarksToolbarFolder().Value;
var btchevron = document.getElementById("bookmarks-chevron");
bt.ref = btf;
btchevron.ref = btf;
// no uniqueness is guaranteed, so we have to remove first
try {
bt.database.RemoveObserver(BookmarksToolbarRDFObserver);
} catch (ex) {
// ignore
}
bt.database.AddObserver(BookmarksToolbarRDFObserver);
bt.builder.rebuild();
btchevron.builder.rebuild();
// fake a resize; this function takes care of flowing bookmarks
// from the bar to the overflow item
BookmarksToolbar.resizeFunc(null);
}
#endif
#ifndef TOOLBAR_CUSTOMIZATION_SHEET
// XXX Shouldn't have to do this, but I do
@ -3565,7 +3284,6 @@ nsBrowserStatusHandler.prototype =
PageProxySetIcon(aBrowser.mIconURL);
}
#ifdef MOZ_PLACES_BOOKMARKS
// Save this favicon in the favicon service
if (aBrowser.mIconURL) {
var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"]
@ -3574,7 +3292,6 @@ nsBrowserStatusHandler.prototype =
.getService(Components.interfaces.nsIIOService).newURI(aBrowser.mIconURL, null, null);
faviconService.setAndLoadFaviconForPage(aBrowser.currentURI, uri, false);
}
#endif
},
onProgressChange : function (aWebProgress, aRequest,
@ -3638,10 +3355,6 @@ nsBrowserStatusHandler.prototype =
var browser = gBrowser.mCurrentBrowser;
if (!gBrowser.mTabbedMode && !browser.mIconURL)
gBrowser.useDefaultIcon(gBrowser.mCurrentTab);
#ifndef MOZ_PLACES_BOOKMARKS
if (browser.mIconURL)
BookmarksUtils.loadFavIcon(browser.currentURI.spec, browser.mIconURL);
#endif
}
}
@ -4438,21 +4151,10 @@ function asyncOpenWebPanel(event)
// This is the Opera convention for a special link that - when clicked - allows
// you to add a sidebar panel. We support the Opera convention here. The link's
// title attribute contains the title that should be used for the sidebar panel.
#ifndef MOZ_PLACES_BOOKMARKS
var dialogArgs = {
name: wrapper.getAttribute("title"),
url: wrapper.href,
bWebPanel: true
}
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
BROWSER_ADD_BM_FEATURES, dialogArgs);
event.preventDefault();
#else
PlacesUtils.showMinimalAddBookmarkUI(makeURI(wrapper.href),
wrapper.getAttribute("title"),
null, null, true, true);
event.preventDefault();
#endif
return false;
}
else if (target == "_search") {
@ -5162,24 +4864,9 @@ function AddKeywordForSearchField()
else
spec += "?" + formData.join("&");
#ifndef MOZ_PLACES_BOOKMARKS
var dialogArgs = {
name: "",
url: spec,
charset: node.ownerDocument.characterSet,
bWebPanel: false,
keyword: "",
bNeedKeyword: true,
postData: postData,
description: BookmarksUtils.getDescriptionFromDocument(node.ownerDocument)
}
openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
BROWSER_ADD_BM_FEATURES, dialogArgs);
#else
var description = PlacesUtils.getDescriptionFromDocument(node.ownerDocument);
PlacesUtils.showMinimalAddBookmarkUI(makeURI(spec), "", description, null,
null, null, "", postData);
#endif
}
function SwitchDocumentDirection(aWindow) {
@ -5447,28 +5134,6 @@ var FeedHandler = {
href = "feed:" + href;
this.loadFeed(href, event);
},
#ifndef MOZ_PLACES_BOOKMARKS
/**
* Adds a Live Bookmark to a feed
* @param url
* The URL of the feed being bookmarked
* @title title
* The title of the feed. Optional.
* @subtitle subtitle
* A short description of the feed. Optional.
*/
addLiveBookmark: function(url, feedTitle, feedSubtitle) {
var doc = gBrowser.selectedBrowser.contentDocument;
var title = (arguments.length > 1) ? feedTitle : doc.title;
var description;
if (arguments.length > 2)
description = feedSubtitle;
else
description = BookmarksUtils.getDescriptionFromDocument(doc);
BookmarksUtils.addLivemark(doc.baseURI, url, title, description);
},
#endif
loadFeed: function(href, event) {
var feeds = gBrowser.selectedBrowser.feeds;
@ -5571,9 +5236,7 @@ var FeedHandler = {
}
};
#ifdef MOZ_PLACES
#include browser-places.js
#endif
#include browser-contentPrefSink.js
#include browser-textZoom.js
@ -5631,13 +5294,6 @@ var AugmentTabs = {
}
};
/**
* History menu initialization
*/
#ifndef MOZ_PLACES
var HistoryMenu = {};
#endif
HistoryMenu.toggleRecentlyClosedTabs = function PHM_toggleRecentlyClosedTabs() {
// enable/disable the Recently Closed Tabs sub menu
var undoPopup = document.getElementById("historyUndoPopup");
@ -5751,9 +5407,8 @@ function formatURL(aFormat, aIsPref) {
}
/**
* This object encapsulates both legacy and places-based implementations
* of the bookmark-all-tabs command. It also takes care of updating the command
* enabled-state when tabs are created or removed.
* This also takes care of updating the command enabled-state when tabs are
* created or removed.
*/
function BookmarkAllTabsHandler() {
this._command = document.getElementById("Browser:BookmarkAllTabs");
@ -5785,11 +5440,7 @@ BookmarkAllTabsHandler.prototype = {
},
doCommand: function BATH_doCommand() {
#ifdef MOZ_PLACES_BOOKMARKS
PlacesCommandHook.bookmarkCurrentPages();
#else
addBookmarkAs(gBrowser, true);
#endif
},
// nsIDOMEventListener

Просмотреть файл

@ -44,10 +44,7 @@
# ***** END LICENSE BLOCK *****
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
#ifdef MOZ_PLACES
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
#endif
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
@ -55,9 +52,7 @@
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
#ifdef MOZ_PLACES
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
#endif
# All DTD information is stored in a separate file so that it can be shared by
# hiddenWindow.xul.
@ -134,27 +129,9 @@
</tooltip>
</popupset>
#ifndef MOZ_PLACES
# The hacky hidden tree used by the Go menu to build items.
#include browser-gotreehack.inc
#endif
#ifndef MOZ_PLACES_BOOKMARKS
<!-- bookmarks context menu -->
<popupset>
<menupopup id="bookmarks-context-menu"
onpopupshowing="return BookmarksMenu.createContextMenu(event);"
onpopuphidden ="BookmarksMenu.destroyContextMenu(event);"/>
</popupset>
#endif
<!-- bookmarks toolbar tooltip -->
<tooltip id="btTooltip" noautohide="true"
#ifdef MOZ_PLACES_BOOKMARKS
onpopupshowing="return BookmarksEventHandler.fillInBTTooltip(document.tooltipNode)">
#else
onpopupshowing="return BookmarksToolbar.fillInBTTooltip(document.tooltipNode)">
#endif
<vbox id="btTooltipTextBox" flex="1">
<label id="btTitleText" />
<label id="btUrlText" />
@ -323,7 +300,6 @@
<button id="navigator-throbber" disabled="true"/>
</toolbaritem>
#ifdef MOZ_PLACES_BOOKMARKS
<toolbaritem flex="1" id="personal-bookmarks" title="&bookmarksItem.title;">
<hbox id="bookmarksBarContent" flex="1" type="places"
context="placesContext" asyncinit="true"
@ -333,56 +309,6 @@
ondragexit="PlacesMenuDNDController.onDragExit(event);"
tooltip="btTooltip"/>
</toolbaritem>
#else
<toolbaritem id="personal-bookmarks" title="&bookmarksItem.title;" flex="1"
class="chromeclass-directories">
<stack id="bookmarks-stack" flex="1" style="min-width:0px; width:0px; overflow: hidden;"
onpopupshowing="BookmarksToolbar.setOpenedMenu(event);"
onpopuphidden="BookmarksToolbar.unsetOpenedMenu(event);">
<hbox id="bookmarks-ptf" class="bookmarks-toolbar-items" contextmenu="bookmarks-context-menu"
flex="1" style="min-width:0px; width:0px;padding-left: 3px;"
datasources="rdf:bookmarks rdf:files"
template="bookmarks-template" flags="dont-test-empty"
infer="forward-proxy"
rdf:type="http://home.netscape.com/NC-rdf#Folder"
onpopupshowing="BookmarksMenu.onShowMenu(event.target)"
onpopuphidden="BookmarksMenu.onHideMenu(event.target)"
oncommand="BookmarksMenu.loadBookmark(event, event.target, this.database)"
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"
ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)"
ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.stopPropagation()">
</hbox>
<hbox class="bookmarks-toolbar-overflow-items" mousethrough="always">
<hbox mousethrough="always" id="overflow-padder"/>
<toolbarbutton id="bookmarks-chevron" type="menu" class="chevron"
chromedir="&locale.dir;"
mousethrough="never" collapsed="true"
datasources="rdf:bookmarks rdf:files"
template="bookmarks-template" flags="dont-test-empty"
onpopupshowing="BookmarksMenu.onShowMenu(event.target)"
onpopuphidden="BookmarksMenu.onHideMenu(event.target)"
oncommand="BookmarksMenu.loadBookmark(event, event.target, this.database)"
onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)"
ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)"
ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.stopPropagation()"
ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.stopPropagation()">
<menupopup onpopupshowing="if (event.target == this) BookmarksToolbar.updateOverflowMenu(this);"
#ifndef XP_MACOSX
contextmenu="bookmarks-context-menu"
#endif
/>
</toolbarbutton>
</hbox>
<toolbarbutton class="bookmark-item bookmarks-toolbar-customize" mousethrough="never"
label="&bookmarksToolbarItem.label;"/>
</stack>
</toolbaritem>
#endif
<toolbarbutton id="downloads-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
observes="Tools:Downloads"
@ -467,19 +393,12 @@
<toolbarset id="customToolbars" context="toolbar-context-menu"/>
#ifdef MOZ_PLACES_BOOKMARKS
<toolbar id="PersonalToolbar" mode="icons" iconsize="small"
class="chromeclass-directories"
context="toolbar-context-menu"
defaultset="bookmarksBarShowPlaces,personal-bookmarks"
toolbarname="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;"
customizable="true"/>
#else
<toolbar id="PersonalToolbar" class="chromeclass-directories" iconsize="small"
customizable="true" defaultset="personal-bookmarks" mode="icons"
toolbarname="&personalbarCmd.label;" accesskey="&personalbarCmd.accesskey;"
context="toolbar-context-menu"/>
#endif
</toolbox>
<stack id="browser-stack" flex="1">

Просмотреть файл

@ -2,21 +2,11 @@
<commandset id="mainCommandSet"/>
<commandset id="baseMenuCommandSet"/>
#ifdef MOZ_PLACES_BOOKMARKS
<commandset id="placesCommands"/>
#endif
<broadcasterset id="mainBroadcasterSet"/>
<keyset id="mainKeyset"/>
<keyset id="baseMenuKeyset"/>
<menubar id="main-menubar"/>
#ifndef MOZ_PLACES_BOOKMARKS
<template id="bookmarks-template"/>
#endif
#ifndef MOZ_PLACES
<tree id="hiddenHistoryTree"/>
#endif
<menubar id="main-menubar"/>

Просмотреть файл

@ -37,19 +37,7 @@
#
# ***** END LICENSE BLOCK *****
# These are loaded by placesOverlay in places-enabled builds
#ifndef MOZ_PLACES
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
#endif
<script type="application/x-javascript" src="chrome://global/content/printUtils.js"/>
#ifndef MOZ_PLACES_BOOKMARKS
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksMenu.js"/>
#endif
<script type="application/x-javascript" src="chrome://global/content/viewZoomOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>

Просмотреть файл

@ -40,16 +40,12 @@
#
# ***** END LICENSE BLOCK *****
#ifdef MOZ_PLACES
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
#endif
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://browser/content/baseMenuOverlay.xul"?>
#ifdef MOZ_PLACES
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
#endif
# All DTD information is stored in a separate file so that it can be shared by
# hiddenWindow.xul.
@ -72,11 +68,6 @@
# browser-sets.inc file for sharing with hiddenWindow.xul.
#include browser-sets.inc
#ifndef MOZ_PLACES
# The hacky hidden tree used by the Go menu to build items.
#include browser-gotreehack.inc
#endif
# The entire main menubar is placed into browser-menubar.inc, so that it can be shared by
# hiddenWindow.xul.
#include browser-menubar.inc

Просмотреть файл

@ -1116,7 +1116,6 @@ nsContextMenu.prototype = {
openUILinkIn(uri, where);
},
#ifdef MOZ_PLACES_BOOKMARKS
bookmarkThisPage: function CM_bookmarkThisPage() {
PlacesCommandHook.bookmarkPage(this.browser);
},
@ -1131,25 +1130,6 @@ nsContextMenu.prototype = {
var description = PlacesUtils.getDescriptionFromDocument(doc);
PlacesUtils.showAddBookmarkUI(uri, doc.title, description);
},
#else
bookmarkThisPage: function CM_bookmarkThisPage() {
addBookmarkAs(this.browser);
},
bookmarkLink: function CM_bookmarkLink() {
BookmarksUtils.addBookmark(this.linkURL, this.linkText());
},
addBookmarkForFrame: function CM_addBookmarkForFrame() {
var doc = this.target.ownerDocument;
var uri = doc.location.href;
var title = doc.title;
var description = BookmarksUtils.getDescriptionFromDocument(doc);
if (!title)
title = uri;
BookmarksUtils.addBookmark(uri, title, doc.charset, description);
},
#endif
savePageAs: function CM_savePageAs() {
saveDocument(this.browser.contentDocument);

Просмотреть файл

@ -40,9 +40,7 @@
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
#ifdef MOZ_PLACES
<?xul-overlay href="chrome://browser/content/places/placesOverlay.xul"?>
#endif
<!DOCTYPE page [
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
@ -55,21 +53,11 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="load()" onunload="unload()">
# These are loaded by placesOverlay in places-enabled builds
#ifndef MOZ_PLACES
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
<script type="application/x-javascript" src="chrome://browser/content/utilityOverlay.js"/>
#endif
<script type="application/x-javascript" src="chrome://global/content/contentAreaUtils.js"/>
<script type="application/x-javascript" src="chrome://browser/content/browser.js"/>
<script type="application/x-javascript" src="chrome://global/content/inlineSpellCheckUI.js"/>
<script type="application/x-javascript" src="chrome://browser/content/nsContextMenu.js"/>
<script type="application/x-javascript" src="chrome://browser/content/web-panels.js"/>
#ifndef MOZ_PLACES_BOOKMARKS
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarks.js"/>
<script type="application/x-javascript" src="chrome://browser/content/bookmarks/bookmarksMenu.js"/>
#endif
<stringbundleset id="stringbundleset">
<stringbundle id="bundle_browser" src="chrome://browser/locale/browser.properties"/>

Просмотреть файл

@ -49,10 +49,6 @@ ifdef MOZ_BRANDING_DIRECTORY
tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
endif
ifndef MOZ_PLACES_BOOKMARKS
tier_app_dirs += xpfe/components/search
endif
tier_app_dirs += browser
installer:

Просмотреть файл

@ -65,18 +65,9 @@ DIRS = \
shell \
sidebar \
feeds \
places \
$(NULL)
ifdef MOZ_PLACES
DIRS += places
else
DIRS += history
endif
ifndef MOZ_PLACES_BOOKMARKS
DIRS += bookmarks
endif
ifdef MOZ_SAFE_BROWSING
DIRS += safebrowsing
endif

Просмотреть файл

@ -42,10 +42,6 @@ EXPORTS = nsBrowserCompsCID.h
CPPSRCS = nsModule.cpp \
$(NULL)
ifndef MOZ_PLACES_BOOKMARKS
REQUIRES += bookmarks
endif
ifeq ($(OS_ARCH),WINNT)
DEFINES += -DPSTOREC_DLL=\"$(subst \,\\,$(WINDIR))\\system32\\pstorec.dll\"
@ -56,14 +52,9 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../migration/src \
-I$(srcdir)/../shell/src \
-I$(srcdir)/../feeds/src \
-I$(srcdir)/../places/src \
$(NULL)
ifndef MOZ_PLACES_BOOKMARKS
LOCAL_INCLUDES += -I$(srcdir)/../bookmarks/src
else
LOCAL_INCLUDES += -I$(srcdir)/../places/src
endif
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,version)
endif
@ -71,6 +62,7 @@ endif
SHARED_LIBRARY_LIBS = \
../migration/src/$(LIB_PREFIX)migration_s.$(LIB_SUFFIX) \
../feeds/src/$(LIB_PREFIX)browser_feeds_s.$(LIB_SUFFIX) \
../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \
$(NULL)
ifneq (,$(filter windows mac cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
@ -78,16 +70,6 @@ SHARED_LIBRARY_LIBS += ../shell/src/$(LIB_PREFIX)shellservice_s.$(LIB_SUFFIX) \
$(NULL)
endif
ifndef MOZ_PLACES_BOOKMARKS
SHARED_LIBRARY_LIBS += \
../bookmarks/src/$(LIB_PREFIX)bookmarks_s.$(LIB_SUFFIX) \
$(NULL)
else
SHARED_LIBRARY_LIBS += \
../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_SAFE_BROWSING
REQUIRES += safebrowsing
LOCAL_INCLUDES += -I$(srcdir)/../safebrowsing/src

Просмотреть файл

@ -39,12 +39,7 @@
#include "nsIGenericFactory.h"
#include "nsBrowserCompsCID.h"
#ifndef MOZ_PLACES_BOOKMARKS
#include "nsBookmarksService.h"
#include "nsForwardProxyDataSource.h"
#else
#include "nsPlacesImportExportService.h"
#endif
#ifdef XP_WIN
#include "nsWindowsShellService.h"
#elif defined(XP_MACOSX)
@ -80,12 +75,7 @@
/////////////////////////////////////////////////////////////////////////////
#ifndef MOZ_PLACES_BOOKMARKS
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsBookmarksService, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsForwardProxyDataSource, Init)
#else
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlacesImportExportService)
#endif
#ifdef XP_WIN
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
#elif defined(XP_MACOSX)
@ -134,38 +124,12 @@ static const nsModuleComponentInfo components[] =
#endif
#ifndef MOZ_PLACES_BOOKMARKS
{ "Bookmarks",
NS_BOOKMARKS_SERVICE_CID,
NS_BOOKMARKS_SERVICE_CONTRACTID,
nsBookmarksServiceConstructor },
{ "Bookmarks",
NS_BOOKMARKS_SERVICE_CID,
NS_BOOKMARKS_DATASOURCE_CONTRACTID,
nsBookmarksServiceConstructor },
{ "Bookmarks",
NS_BOOKMARKS_SERVICE_CID,
"@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1",
nsBookmarksServiceConstructor },
{ "Bookmarks Forward Proxy Inference Data Source",
NS_RDF_FORWARDPROXY_INFER_DATASOURCE_CID,
NS_RDF_INFER_DATASOURCE_CONTRACTID_PREFIX "forward-proxy",
nsForwardProxyDataSourceConstructor },
#else
{ "Places Import/Export Service",
NS_PLACESIMPORTEXPORTSERVICE_CID,
NS_PLACESIMPORTEXPORTSERVICE_CONTRACTID,
nsPlacesImportExportServiceConstructor},
#endif
{ "Feed Sniffer",
NS_FEEDSNIFFER_CID,
NS_FEEDSNIFFER_CONTRACTID,

Просмотреть файл

@ -113,16 +113,8 @@ nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
nsCOMPtr<nsIFile> file;
char const* leafName = nsnull;
#ifndef MOZ_PLACES_BOOKMARKS
PRBool restoreBookmarksBackup = PR_FALSE;
PRBool ensureFilePermissions = PR_FALSE;
#endif
if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) {
#ifndef MOZ_PLACES_BOOKMARKS
ensureFilePermissions = PR_TRUE;
restoreBookmarksBackup = PR_TRUE;
#endif
leafName = "bookmarks.html";
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
@ -184,39 +176,7 @@ nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
file->AppendNative(leafstr);
}
#ifndef MOZ_PLACES_BOOKMARKS
PRBool exists;
rv = file->Exists(&exists);
if (restoreBookmarksBackup && NS_SUCCEEDED(rv) && exists) {
PRInt64 fileSize;
file->GetFileSize(&fileSize);
if (fileSize == 0)
{
file->Remove(PR_FALSE);
exists = PR_FALSE;
}
}
if (NS_SUCCEEDED(rv) && !exists) {
if (!restoreBookmarksBackup ||
NS_FAILED(RestoreBookmarksFromBackup(leafstr, parentDir, file)))
EnsureProfileFile(leafstr, parentDir, file);
}
if (ensureFilePermissions) {
PRBool fileToEnsureExists;
PRBool isWritable;
if (NS_SUCCEEDED(file->Exists(&fileToEnsureExists)) && fileToEnsureExists
&& NS_SUCCEEDED(file->IsWritable(&isWritable)) && !isWritable) {
PRUint32 permissions;
if (NS_SUCCEEDED(file->GetPermissions(&permissions))) {
rv = file->SetPermissions(permissions | 0600);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to ensure file permissions");
}
}
}
#endif
*aPersist = PR_TRUE;
NS_ADDREF(*aResult = file);
@ -338,52 +298,6 @@ static const nsModuleComponentInfo components[] = {
};
NS_IMPL_NSGETMODULE(BrowserDirProvider, components)
#ifndef MOZ_PLACES_BOOKMARKS
nsresult
nsBrowserDirectoryProvider::RestoreBookmarksFromBackup(const nsACString& aLeafName,
nsIFile* aParentDir,
nsIFile* aTarget)
{
nsresult rv;
nsCOMPtr<nsIFile> backupFile;
rv = aParentDir->Clone(getter_AddRefs(backupFile));
if (NS_FAILED(rv))
return rv;
backupFile->AppendNative(nsDependentCString("bookmarks.bak"));
PRBool exists;
rv = backupFile->Exists(&exists);
if (NS_FAILED(rv) || !exists)
return NS_ERROR_FAILURE;
return backupFile->CopyToNative(aParentDir, aLeafName);
}
void
nsBrowserDirectoryProvider::EnsureProfileFile(const nsACString& aLeafName,
nsIFile* aParentDir,
nsIFile* aTarget)
{
nsresult rv;
nsCOMPtr<nsIFile> defaults;
rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR,
getter_AddRefs(defaults));
if (NS_FAILED(rv))
return;
defaults->AppendNative(aLeafName);
PRBool exists;
rv = defaults->Exists(&exists);
if (NS_FAILED(rv) || !exists)
return;
defaults->CopyToNative(aParentDir, aLeafName);
}
#endif
NS_IMPL_ISUPPORTS1(nsBrowserDirectoryProvider::AppendingEnumerator,
nsISimpleEnumerator)

Просмотреть файл

@ -390,11 +390,7 @@ var FeedResultService = {
Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var topWindow = wm.getMostRecentWindow("navigator:browser");
#ifdef MOZ_PLACES_BOOKMARKS
topWindow.PlacesCommandHook.addLiveBookmark(spec, title, subtitle);
#else
topWindow.FeedHandler.addLiveBookmark(spec, title, subtitle);
#endif
break;
}
},

Просмотреть файл

@ -95,12 +95,8 @@ const FW_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
const TITLE_ID = "feedTitleText";
const SUBTITLE_ID = "feedSubtitleText";
#ifdef MOZ_PLACES
const NH_CONTRACTID = "@mozilla.org/browser/nav-history-service;1";
const FAV_CONTRACTID = "@mozilla.org/browser/favicon-service;1";
#else
const ICON_DATAURL_PREFIX = "data:image/x-icon;base64,";
#endif
function FeedWriter() {
}
@ -153,7 +149,6 @@ FeedWriter.prototype = {
}
},
#ifdef MOZ_PLACES
__faviconService: null,
get _faviconService() {
if (!this.__faviconService) {
@ -163,7 +158,6 @@ FeedWriter.prototype = {
return this.__faviconService;
},
#endif
__bundle: null,
get _bundle() {
@ -713,10 +707,8 @@ FeedWriter.prototype = {
handlersMenuPopup.appendChild(this._document.createElementNS(XUL_NS,
"menuseparator"));
#ifdef MOZ_PLACES
var historySvc = Cc[NH_CONTRACTID].getService(Ci.nsINavHistoryService);
historySvc.addObserver(this, false);
#endif
// List of web handlers
var wccr =
@ -735,17 +727,12 @@ FeedWriter.prototype = {
// For privacy reasons we cannot set the image attribute directly
// to the icon url, see Bug 358878
var uri = makeURI(handlers[i].uri);
#ifdef MOZ_PLACES
if (!this._setFaviconForWebReader(uri, menuItem)) {
if (uri && /^https?/.test(uri.scheme)) {
var iconURL = makeURI(uri.prePath + "/favicon.ico");
this._faviconService.setAndLoadFaviconForPage(uri, iconURL, true);
}
}
#else
if (uri && /^https?/.test(uri.scheme))
new iconDataURIGenerator(uri.prePath + "/favicon.ico", menuItem);
#endif
}
}
@ -871,10 +858,8 @@ FeedWriter.prototype = {
prefs.removeObserver(PREF_SELECTED_APP, this);
this._removeFeedFromCache();
#ifdef MOZ_PLACES
var historySvc = Cc[NH_CONTRACTID].getService(Ci.nsINavHistoryService);
historySvc.removeObserver(this);
#endif
},
_removeFeedFromCache: function FW__removeFeedFromCache() {
@ -991,7 +976,6 @@ FeedWriter.prototype = {
}
},
#ifdef MOZ_PLACES
/**
* Sets the icon for the given web-reader item in the readers menu
* if the favicon-service has the necessary icon stored.
@ -1051,7 +1035,6 @@ FeedWriter.prototype = {
onDeleteURI: function() { },
onClearHistory: function() { },
onPageExpired: function() { },
#endif
/**
* See nsIClassInfo
@ -1076,122 +1059,13 @@ FeedWriter.prototype = {
iid.equals(Ci.nsIClassInfo) ||
iid.equals(Ci.nsIDOMEventListener) ||
iid.equals(Ci.nsIObserver) ||
#ifdef MOZ_PLACES
iid.equals(Ci.nsINavHistoryObserver) ||
#endif
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
#ifndef MOZ_PLACES
function iconDataURIGenerator(aURISpec, aElement) {
var ios = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
var chan = ios.newChannelFromURI(makeURI(aURISpec));
chan.notificationCallbacks = this;
chan.asyncOpen(this, null);
this._channel = chan;
this._bytes = [];
this._element = aElement;
}
iconDataURIGenerator.prototype = {
_channel: null,
_countRead: 0,
_stream: null,
QueryInterface: function FW_IDUG_loadQI(aIID) {
if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIRequestObserver) ||
aIID.equals(Ci.nsIStreamListener) ||
aIID.equals(Ci.nsIChannelEventSink) ||
aIID.equals(Ci.nsIInterfaceRequestor) ||
aIID.equals(Ci.nsIBadCertListener) ||
// See bug 358878 comment 11
aIID.equals(Ci.nsIPrompt) ||
// See FIXME comment below
aIID.equals(Ci.nsIHttpEventSink) ||
aIID.equals(Ci.nsIProgressEventSink) ||
false)
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
// nsIRequestObserver
onStartRequest: function FW_IDUG_loadStartR(aRequest, aContext) {
this._stream = Cc["@mozilla.org/binaryinputstream;1"].
createInstance(Ci.nsIBinaryInputStream);
},
onStopRequest: function FW_IDUG_loadStopR(aRequest, aContext, aStatusCode) {
var requestFailed = !Components.isSuccessCode(aStatusCode);
if (!requestFailed && (aRequest instanceof Ci.nsIHttpChannel))
requestFailed = !aRequest.requestSucceeded;
if (!requestFailed && this._countRead != 0) {
var str = String.fromCharCode.apply(null, this._bytes);
try {
var dataURI = ICON_DATAURL_PREFIX + btoa(str);
this._element.setAttribute("image", dataURI);
}
catch(ex) {}
}
this._channel = null;
this._element = null;
},
// nsIStreamListener
onDataAvailable: function FW_IDUG_loadDAvailable(aRequest, aContext,
aInputStream, aOffset,
aCount) {
this._stream.setInputStream(aInputStream);
// Get a byte array of the data
this._bytes = this._bytes.concat(this._stream.readByteArray(aCount));
this._countRead += aCount;
},
// nsIChannelEventSink
onChannelRedirect: function FW_IDUG_loadCRedirect(aOldChannel, aNewChannel,
aFlags) {
this._channel = aNewChannel;
},
// nsIInterfaceRequestor
getInterface: function FW_IDUG_load_GI(aIID) {
return this.QueryInterface(aIID);
},
// nsIBadCertListener
confirmUnknownIssuer: function FW_IDUG_load_CUI(aSocketInfo, aCert,
aCertAddType) {
return false;
},
confirmMismatchDomain: function FW_IDUG_load_CMD(aSocketInfo, aTargetURL,
aCert) {
return false;
},
confirmCertExpired: function FW_IDUG_load_CCE(aSocketInfo, aCert) {
return false;
},
notifyCrlNextupdate: function FW_IDUG_load_NCN(aSocketInfo, aTargetURL, aCert) {
},
// FIXME: bug 253127
// nsIHttpEventSink
onRedirect: function (aChannel, aNewChannel) { },
// nsIProgressEventSink
onProgress: function (aRequest, aContext, aProgress, aProgressMax) { },
onStatus: function (aRequest, aContext, aStatus, aStatusArg) { }
};
#endif
var Module = {
QueryInterface: function M_QueryInterface(iid) {
if (iid.equals(Ci.nsIModule) ||

Просмотреть файл

@ -44,10 +44,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = microsummaries
XPIDL_MODULE = microsummaries
ifdef MOZ_PLACES_BOOKMARKS
XPIDLSRCS = nsIMicrosummaryService.idl
else
XPIDLSRCS = nsIMicrosummaryServiceNonPlaces.idl
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,355 +0,0 @@
#include "nsISupports.idl"
interface nsIDOMDocument;
interface nsIDOMNode;
interface nsIURI;
interface nsISimpleEnumerator;
interface nsIMicrosummary;
[scriptable, uuid(cb284a83-1ca5-4000-9841-ce345ce84915)]
interface nsIMicrosummaryObserver : nsISupports
{
/**
* Called when an observed microsummary updates its content.
* Since an observer might watch multiple microsummaries at the same time,
* the microsummary whose content has been updated gets passed
* to this handler.
* XXX Should this be onContentUpdated?
*
* @param microsummary
* the microsummary whose content has just been updated
*
*/
void onContentLoaded(in nsIMicrosummary microsummary);
/**
* Called when an element is appended to a microsummary set.
* XXX Should this be in a separate nsICollectionObserver interface?
*
* @param microsummary
* the microsummary that has just been appended to the set
*
*/
void onElementAppended(in nsIMicrosummary microsummary);
};
[scriptable, uuid(05b48344-d0a7-427e-934e-9a6e0d5ecced)]
interface nsIMicrosummaryGenerator : nsISupports
{
// Has the generator itself, which may be a remote resource, been loaded.
readonly attribute boolean loaded;
// An arbitrary descriptive name for this microsummary generator.
readonly attribute AUTF8String name;
// The canonical location and unique identifier of the generator.
// It tells us where the generator comes from and where to go for updates.
//
// For generators referenced by web pages via <link> tags, this URI is
// the URL specified by the tag.
//
// For generators installed via nsSidebar::addMicrosummaryGenerator,
// this URI is a URN of the form urn:source:<url>, where <url> is the
// remote location from which we installed the generator.
//
// For generators installed via some other mechanism (f.e. an extension
// that dynamically creates generators), this URI is a URN in a form
// of the extension's own choosing, with the only restriction being that
// the URI be globally unique. To ensure this, we recommend that such
// extensions incorporate UUIDs created by nsUUIDGenerator into the URNs
// of the generators they create.
readonly attribute nsIURI uri;
/**
* microsummary-generator equivalence test
* generators equal if their canonical locations equal, see uri attribute.
*/
boolean equals(in nsIMicrosummaryGenerator aOther);
// For generators installed by the user or bundled with the browser, the
// local URI points to the location of the local file containing the
// generator's XML.
readonly attribute nsIURI localURI;
// Whether or not this generator needs page content to generate
// a microsummary. Microsummaries generated by XSLT templates need page
// content, while those which represent the actual microsummary content
// do not.
readonly attribute boolean needsPageContent;
/**
* Generate a microsummary by processing the generator template
* against the page content. If a generator doesn't need content,
* pass null as the parameter to this method.
*
* XXX In the future, this should support returning rich text content,
* so perhaps we should make it return a DOM node now and have the caller
* convert that to text if it doesn't support rich content.
*
* @param pageContent
* the content of the page being summarized
* @returns the text result of processing the template
*
*/
AString generateMicrosummary(in nsIDOMNode aPageContent);
/**
* Calculate the interval until the microsummary should be updated for
* the next time, depending on the page content. If the generator doesn't
* specify an interval, null is returned.
*
* @param pageContent
* the content of the page being summarized
* @returns the interval in milliseconds until the next update request
*
*/
long calculateUpdateInterval(in nsIDOMNode aPageContent);
};
[scriptable, uuid(a999eabf-68f9-45c2-919f-2ad33777e3e3)]
interface nsIMicrosummary : nsISupports
{
// the URI of the page being summarized
readonly attribute nsIURI pageURI;
// The generator that generates this microsummary. May need to be loaded.
attribute nsIMicrosummaryGenerator generator;
// The content of the microsummary.
// Since generators and pages can be remote resources, and we need them
// to generate the content, this may not always be available.
readonly attribute AString content;
// The minimum interval after which this microsummary would like to be refreshed
// (or null if it doesn't care).
readonly attribute long updateInterval;
/**
* Add a microsummary observer to this microsummary.
*
* @param observer
* the microsummary observer to add
*
*/
void addObserver(in nsIMicrosummaryObserver observer);
/**
* Remove a microsummary observer from this microsummary.
*
* @param observer
* the microsummary observer to remove
*
*/
void removeObserver(in nsIMicrosummaryObserver observer);
/**
* Microsummary equivalence test
* Microsummaries equal if they summarize the same page with the same
* microsummary-generator (see also nsIMicrosummaryGenerator::equals).
*
* Note: this method returns false if either objects don't have a generator
*/
boolean equals(in nsIMicrosummary aOther);
/**
* Update the microsummary, first loading its generator and page content
* as necessary. If you want know when a microsummary finishes updating,
* add an observer before calling this method.
*
*/
void update();
};
[scriptable, uuid(7111e88d-fecd-4b17-b7a9-1fa74e23153f)]
interface nsIMicrosummarySet : nsISupports
{
/**
* Add a microsummary observer to this microsummary set. Adding an observer
* to a set is the equivalent of adding it to each constituent microsummary.
*
* @param observer
* the microsummary observer to add
*
*/
void addObserver(in nsIMicrosummaryObserver observer);
/**
* Remove a microsummary observer from this microsummary.
*
* @param observer
* the microsummary observer to remove
*
*/
void removeObserver(in nsIMicrosummaryObserver observer);
/**
* Retrieve a enumerator of microsummaries in the set.
*
* @returns an enumerator of nsIMicrosummary objects
*
*/
nsISimpleEnumerator Enumerate();
};
[scriptable, uuid(edec7c28-4b06-4692-842f-8bf238e61ac1)]
interface nsIMicrosummaryService : nsISupports
{
/**
* Install the microsummary generator from the resource at the supplied URI.
* Callable by content via the addMicrosummaryGenerator() sidebar method.
*
* @param generatorURI
* the URI of the resource providing the generator
*
*/
void addGenerator(in nsIURI generatorURI);
/**
* Install the microsummary generator in the given XML definition.
*
* @param xmlDefinition
* an nsIDOMDocument XML document defining the generator
*
* @returns the newly-installed nsIMicrosummaryGenerator object
*
*/
nsIMicrosummaryGenerator installGenerator(in nsIDOMDocument xmlDefinition);
/**
* Get the set of bookmarks with microsummaries.
*
* In the old RDF-based bookmarks datastore, bookmark IDs are nsIRDFResource
* objects. In the new Places-based datastore, they are nsIURI objects.
*
* @returns an nsISimpleEnumerator enumeration of bookmark IDs
*
*/
nsISimpleEnumerator getBookmarks();
/**
* Get the set of microsummaries available for a given page. The set
* might change after this method returns, since this method will trigger
* an asynchronous load of the page in question (if it isn't already loaded)
* to see if it references any page-specific microsummaries.
*
* If the caller passes a bookmark ID, and one of the microsummaries
* is the current one for the bookmark, this method will retrieve content
* from the datastore for that microsummary, which is useful when callers
* want to display a list of microsummaries for a page that isn't loaded,
* and they want to display the actual content of the selected microsummary
* immediately (rather than after the content is asynchronously loaded).
*
* @param pageURI
* the URI of the page for which to retrieve available microsummaries
*
* @param bookmarkID (optional)
* the ID of the bookmark for which this method is being called
*
* @returns an nsIMicrosummarySet of nsIMicrosummaries for the given page
*
*/
nsIMicrosummarySet getMicrosummaries(in nsIURI pageURI,
in nsISupports bookmarkID);
/**
* Get the current microsummary for the given bookmark.
*
* @param bookmarkID
* the bookmark for which to get the current microsummary
*
* @returns the current microsummary for the bookmark, or null
* if the bookmark does not have a current microsummary
*
*/
nsIMicrosummary getMicrosummary(in nsISupports bookmarkID);
/**
* Set the current microsummary for the given bookmark.
*
* @param bookmarkID
* the bookmark for which to set the current microsummary
*
* @param microsummary
* the microsummary to set as the current one
*
*/
void setMicrosummary(in nsISupports bookmarkID,
in nsIMicrosummary microsummary);
/**
* Remove the current microsummary for the given bookmark.
*
* @param bookmarkID
* the bookmark for which to remove the current microsummary
*
*/
void removeMicrosummary(in nsISupports bookmarkID);
/**
* Whether or not the given bookmark has a current microsummary.
*
* @param bookmarkID
* the bookmark for which to set the current microsummary
*
* @returns a boolean representing whether or not the given bookmark
* has a current microsummary
*
*/
boolean hasMicrosummary(in nsISupports bookmarkID);
/**
* Whether or not the given microsummary is the current microsummary
* for the given bookmark.
*
* @param bookmarkID
* the bookmark to check
*
* @param microsummary
* the microsummary to check
*
* @returns whether or not the microsummary is the current one
* for the bookmark
*
*/
boolean isMicrosummary(in nsISupports bookmarkID,
in nsIMicrosummary microsummary);
/**
* Refresh a microsummary, updating its value in the datastore and UI.
* If this method can refresh the microsummary instantly, it will.
* Otherwise, it'll asynchronously download the necessary information
* (the generator and/or page) before refreshing the microsummary.
*
* Callers should check the "content" property of the returned microsummary
* object to distinguish between sync and async refreshes. If its value
* is "null", then it's an async refresh, and the caller should register
* itself as an nsIMicrosummaryObserver via nsIMicrosummary.addObserver()
* to find out when the refresh completes.
*
* @param bookmarkID
* the bookmark whose microsummary is being refreshed
*
* @returns the microsummary being refreshed
*
*/
nsIMicrosummary refreshMicrosummary(in nsISupports bookmarkID);
};
[scriptable, uuid(f9e577a8-19d9-4ca0-a140-b9e43f014470)]
interface nsILiveTitleNotificationSubject : nsISupports
{
// The ID of the bookmark displaying this title.
// Note: in the old bookmarks code, this is an RDF resource. In Places
// it is currently a URI, but after the fix for bug 360133 lands it will
// become an integer.
readonly attribute nsISupports bookmarkID;
// The microsummary being displayed as the live title for the bookmark.
// The actual value of the microsummary (i.e. the string that gets displayed
// to the user) is stored in the content property of this object.
readonly attribute nsIMicrosummary microsummary;
};

Просмотреть файл

@ -56,23 +56,10 @@ const CHECK_INTERVAL = 15 * 1000; // 15 seconds
const MICSUM_NS = new Namespace("http://www.mozilla.org/microsummaries/0.1");
const XSLT_NS = new Namespace("http://www.w3.org/1999/XSL/Transform");
#ifdef MOZ_PLACES_BOOKMARKS
const FIELD_MICSUM_GEN_URI = "microsummary/generatorURI";
const FIELD_MICSUM_EXPIRATION = "microsummary/expiration";
const FIELD_GENERATED_TITLE = "bookmarks/generatedTitle";
const FIELD_CONTENT_TYPE = "bookmarks/contentType";
#else
const NC_NS = "http://home.netscape.com/NC-rdf#";
const RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
const FIELD_RDF_TYPE = RDF_NS + "type";
const VALUE_MICSUM_BOOKMARK = NC_NS + "MicsumBookmark";
const VALUE_NORMAL_BOOKMARK = NC_NS + "Bookmark";
const FIELD_MICSUM_GEN_URI = NC_NS + "MicsumGenURI";
const FIELD_MICSUM_EXPIRATION = NC_NS + "MicsumExpiration";
const FIELD_GENERATED_TITLE = NC_NS + "GeneratedTitle";
const FIELD_CONTENT_TYPE = NC_NS + "ContentType";
const FIELD_BOOKMARK_URL = NC_NS + "URL";
#endif
const MAX_SUMMARY_LENGTH = 4096;
@ -81,8 +68,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
function MicrosummaryService() { this._init() }
MicrosummaryService.prototype = {
#ifdef MOZ_PLACES_BOOKMARKS
// Bookmarks Service
__bms: null,
get _bms() {
@ -100,32 +85,6 @@ MicrosummaryService.prototype = {
getService(Ci.nsIAnnotationService);
return this.__ans;
},
#else
// RDF Service
__rdf: null,
get _rdf() {
if (!this.__rdf)
this.__rdf = Cc["@mozilla.org/rdf/rdf-service;1"].
getService(Ci.nsIRDFService);
return this.__rdf;
},
// Bookmarks Data Source
__bmds: null,
get _bmds() {
if (!this.__bmds)
this.__bmds = this._rdf.GetDataSource("rdf:bookmarks");
return this.__bmds;
},
// Old Bookmarks Service
__bms: null,
get _bms() {
if (!this.__bms)
this.__bms = this._bmds.QueryInterface(Ci.nsIBookmarksService);
return this.__bms;
},
#endif
// IO Service
__ios: null,
@ -155,28 +114,6 @@ MicrosummaryService.prototype = {
return this._ios.newURI(spec, null, null);
},
#ifndef MOZ_PLACES_BOOKMARKS
/**
* Make an RDF resource from a URI spec.
* @param uriSpec
* The URI spec to convert into a resource.
* @returns An nsIRDFResource object.
*/
_resource: function MSS__resource(uriSpec) {
return this._rdf.GetResource(uriSpec);
},
/**
* Make an RDF literal from a string.
* @param str
* The string from which to construct the literal.
* @returns An nsIRDFLiteral object
*/
_literal: function MSS__literal(str) {
return this._rdf.GetLiteral(str);
},
#endif
// Directory Locator
__dirs: null,
get _dirs() {
@ -298,11 +235,7 @@ MicrosummaryService.prototype = {
oldValue = this._getField(bookmarkID, FIELD_GENERATED_TITLE);
// A string identifying the bookmark to use when logging the update.
#ifdef MOZ_PLACES_BOOKMARKS
var bookmarkIdentity = bookmarkID;
#else
var bookmarkIdentity = bookmarkID.Value + " (" + microsummary.pageURI.spec + ")";
#endif
if (oldValue == null || oldValue != microsummary.content) {
this._setField(bookmarkID, FIELD_GENERATED_TITLE, microsummary.content);
@ -621,11 +554,7 @@ MicrosummaryService.prototype = {
// If this is the current microsummary for this bookmark, load the content
// from the datastore so it shows up immediately in microsummary picking UI.
#ifdef MOZ_PLACES_BOOKMARKS
if (bookmarkID != -1 && this.isMicrosummary(bookmarkID, microsummary))
#else
if (bookmarkID && this.isMicrosummary(bookmarkID, microsummary))
#endif
microsummary._content = this._getField(bookmarkID, FIELD_GENERATED_TITLE);
microsummaries.AppendElement(microsummary);
@ -634,11 +563,7 @@ MicrosummaryService.prototype = {
// If a bookmark identifier has been provided, list its microsummary
// synchronously, if any.
#ifdef MOZ_PLACES_BOOKMARKS
if (bookmarkID != -1 && this.hasMicrosummary(bookmarkID)) {
#else
if (bookmarkID && this.hasMicrosummary(bookmarkID)) {
#endif
var currentMicrosummary = this.getMicrosummary(bookmarkID);
if (!microsummaries.hasItemForMicrosummary(currentMicrosummary))
microsummaries.AppendElement(currentMicrosummary);
@ -699,7 +624,6 @@ MicrosummaryService.prototype = {
}
},
#ifdef MOZ_PLACES_BOOKMARKS
/**
* Get the set of bookmarks with microsummaries.
*
@ -748,130 +672,9 @@ MicrosummaryService.prototype = {
return this._bms.getBookmarkURI(aBookmarkId);
},
#else
/**
* Get the set of bookmarks with microsummaries.
*
* This is the internal version of this method, which is not accessible
* via XPCOM but is more performant; inside this component, use this version.
* Outside the component, use getBookmarks (no underscore prefix) instead.
*
* @returns an array of bookmark IDs
*
*/
_getBookmarks: function MSS__getBookmarks() {
var bookmarks = [];
var resources = this._bmds.GetSources(this._resource(FIELD_RDF_TYPE),
this._resource(VALUE_MICSUM_BOOKMARK),
true);
while (resources.hasMoreElements()) {
var resource = resources.getNext().QueryInterface(Ci.nsIRDFResource);
// When a bookmark gets deleted or cut, most of its arcs get removed
// from the data source, but a few of them remain, in particular its RDF
// type arc. So just because this resource has a MicsumBookmark type,
// that doesn't mean it's a real bookmark! We need to check.
if (!this._bms.isBookmarkedResource(resource))
continue;
bookmarks.push(resource);
}
return bookmarks;
},
_getField: function MSS__getField(bookmarkID, fieldName) {
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
var fieldValue;
var node = this._bmds.GetTarget(bookmarkResource,
this._resource(fieldName),
true);
if (node) {
if (fieldName == FIELD_RDF_TYPE)
fieldValue = node.QueryInterface(Ci.nsIRDFResource).Value;
else
fieldValue = node.QueryInterface(Ci.nsIRDFLiteral).Value;
}
else
fieldValue = null;
return fieldValue;
},
_setField: function MSS__setField(bookmarkID, fieldName, fieldValue) {
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
if (this._hasField(bookmarkID, fieldName)) {
var oldValue = this._getField(bookmarkID, fieldName);
this._bmds.Change(bookmarkResource,
this._resource(fieldName),
this._literal(oldValue),
this._literal(fieldValue));
}
else {
this._bmds.Assert(bookmarkResource,
this._resource(fieldName),
this._literal(fieldValue),
true);
}
},
_clearField: function MSS__clearField(bookmarkID, fieldName) {
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
var node = this._bmds.GetTarget(bookmarkResource,
this._resource(fieldName),
true);
if (node) {
this._bmds.Unassert(bookmarkResource,
this._resource(fieldName),
node);
}
},
_hasField: function MSS__hasField(bookmarkID, fieldName) {
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
var node = this._bmds.GetTarget(bookmarkResource,
this._resource(fieldName),
true);
return node ? true : false;
},
/**
* Get the URI of the page to which a given bookmark refers.
*
* @param bookmarkResource
* an nsIResource uniquely identifying the bookmark
*
* @returns an nsIURI object representing the bookmark's page,
* or null if the bookmark doesn't exist
*
*/
_getPageForBookmark: function MSS__getPageForBookmark(bookmarkID) {
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
var node = this._bmds.GetTarget(bookmarkResource,
this._resource(NC_NS + "URL"),
true);
if (!node)
return null;
var pageSpec = node.QueryInterface(Ci.nsIRDFLiteral).Value;
var pageURI = this._uri(pageSpec);
return pageURI;
},
#endif
/**
* Get the set of bookmarks with microsummaries.
*
* Bookmark IDs are nsIRDFResource objects on builds with old RDF-based
* bookmarks and nsIURI objects on builds with new Places-based bookmarks.
*
* This is the external version of this method and is accessible via XPCOM.
* Use it outside this component. Inside the component, use _getBookmarks
* (with underscore prefix) instead for performance.
@ -932,32 +735,6 @@ MicrosummaryService.prototype = {
*
*/
setMicrosummary: function MSS_setMicrosummary(bookmarkID, microsummary) {
#ifndef MOZ_PLACES_BOOKMARKS
// Make sure that the bookmark is of type MicsumBookmark
// because that's what the template rules are matching
if (this._getField(bookmarkID, FIELD_RDF_TYPE) != VALUE_MICSUM_BOOKMARK) {
// Force the bookmark trees to rebuild, since they don't seem
// to be rebuilding on their own (bug 348928).
this._bmds.beginUpdateBatch();
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
if (this._hasField(bookmarkID, FIELD_RDF_TYPE)) {
var oldValue = this._getField(bookmarkID, FIELD_RDF_TYPE);
this._bmds.Change(bookmarkResource,
this._resource(FIELD_RDF_TYPE),
this._resource(oldValue),
this._resource(VALUE_MICSUM_BOOKMARK));
}
else {
this._bmds.Assert(bookmarkResource,
this._resource(FIELD_RDF_TYPE),
this._resource(VALUE_MICSUM_BOOKMARK),
true);
}
this._bmds.endUpdateBatch();
}
#endif
this._setField(bookmarkID, FIELD_MICSUM_GEN_URI, microsummary.generator.uri.spec);
if (microsummary.content) {
@ -981,23 +758,6 @@ MicrosummaryService.prototype = {
*
*/
removeMicrosummary: function MSS_removeMicrosummary(bookmarkID) {
#ifndef MOZ_PLACES_BOOKMARKS
// Set the bookmark's RDF type back to the normal bookmark type
if (this._getField(bookmarkID, FIELD_RDF_TYPE) == VALUE_MICSUM_BOOKMARK) {
// Force the bookmark trees to rebuild, since they don't seem
// to be rebuilding on their own (bug 348928).
this._bmds.beginUpdateBatch();
var bookmarkResource = bookmarkID.QueryInterface(Ci.nsIRDFResource);
this._bmds.Change(bookmarkResource,
this._resource(FIELD_RDF_TYPE),
this._resource(VALUE_MICSUM_BOOKMARK),
this._resource(VALUE_NORMAL_BOOKMARK));
this._bmds.endUpdateBatch();
}
#endif
var fields = [FIELD_MICSUM_GEN_URI,
FIELD_MICSUM_EXPIRATION,
FIELD_GENERATED_TITLE,

Просмотреть файл

@ -65,17 +65,10 @@ REQUIRES = \
dom \
docshell \
xulapp \
places \
browserplaces \
$(NULL)
ifdef MOZ_PLACES
REQUIRES += places
endif
ifndef MOZ_PLACES_BOOKMARKS
REQUIRES += bookmarks
else
REQUIRES += browserplaces
endif
CPPSRCS = nsProfileMigrator.cpp \
nsBrowserProfileMigratorUtils.cpp \
nsNetscapeProfileMigratorBase.cpp \

Просмотреть файл

@ -37,14 +37,10 @@
* ***** END LICENSE BLOCK ***** */
#include "nsBrowserProfileMigratorUtils.h"
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#include "nsToolkitCompsCID.h"
#include "nsIPlacesImportExportService.h"
#else
#include "nsIBookmarksService.h"
#endif
#include "nsIFile.h"
#include "nsIInputStream.h"
#include "nsILineInputStream.h"
@ -225,41 +221,6 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
{
nsresult rv;
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIBookmarksService> bms =
do_GetService("@mozilla.org/browser/bookmarks-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsArray> params =
do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFService> rdfs =
do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFResource> prop;
rv = rdfs->GetResource(NC_URI(URL), getter_AddRefs(prop));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFLiteral> url;
nsAutoString path;
aBookmarksFile->GetPath(path);
rdfs->GetLiteral(path.get(), getter_AddRefs(url));
params->AppendElement(prop);
params->AppendElement(url);
nsCOMPtr<nsIRDFResource> importCmd;
rv = rdfs->GetResource(NC_URI(command?cmd=import), getter_AddRefs(importCmd));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFResource> root;
rv = rdfs->GetResource(NS_LITERAL_CSTRING("NC:BookmarksRoot"),
getter_AddRefs(root));
NS_ENSURE_SUCCESS(rv, rv);
#endif // MOZ_PLACES_BOOKMARKS
// Look for the localized name of the bookmarks toolbar
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
@ -278,7 +239,6 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
sourceNameStrings, 1,
getter_Copies(importedBookmarksTitle));
#ifdef MOZ_PLACES_BOOKMARKS
// Get the bookmarks service
nsCOMPtr<nsINavBookmarksService> bms =
do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv);
@ -298,28 +258,5 @@ ImportBookmarksHTML(nsIFile* aBookmarksFile,
NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE);
nsCOMPtr<nsIPlacesImportExportService> importer = do_GetService(NS_PLACESIMPORTEXPORTSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = importer->ImportHTMLFromFileToFolder(localFile, folder, PR_FALSE);
#else
nsCOMPtr<nsIRDFResource> folder;
bms->CreateFolderInContainer(importedBookmarksTitle.get(), root, -1,
getter_AddRefs(folder));
nsCOMPtr<nsIRDFResource> folderProp;
rv = rdfs->GetResource(NC_URI(Folder), getter_AddRefs(folderProp));
NS_ENSURE_SUCCESS(rv, rv);
params->AppendElement(folderProp);
params->AppendElement(folder);
nsCOMPtr<nsISupportsArray> sources =
do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
sources->AppendElement(folder);
nsCOMPtr<nsIRDFDataSource> ds = do_QueryInterface(bms, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = ds->DoCommand(sources, importCmd, params);
#endif
return rv;
return importer->ImportHTMLFromFileToFolder(localFile, folder, PR_FALSE);
}

Просмотреть файл

@ -85,12 +85,8 @@
#include "nsIRDFService.h"
#include "nsIRDFContainer.h"
#include "nsIURL.h"
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#else
#include "nsIBookmarksService.h"
#endif
#include "nsIStringBundle.h"
#include "nsNetUtil.h"
#include "nsToolkitCompsCID.h"
@ -1165,30 +1161,15 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
// a folder called "Imported IE Favorites" and place all the Bookmarks there.
nsresult rv;
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 root;
rv = bms->GetBookmarksRoot(&root);
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCOMPtr<nsIRDFService> rdf(do_GetService("@mozilla.org/rdf/rdf-service;1"));
nsCOMPtr<nsIRDFResource> root;
rdf->GetResource(NS_LITERAL_CSTRING("NC:BookmarksRoot"), getter_AddRefs(root));
nsCOMPtr<nsIBookmarksService> bms(do_GetService("@mozilla.org/browser/bookmarks-service;1"));
NS_ENSURE_TRUE(bms, NS_ERROR_FAILURE);
PRBool dummy;
bms->ReadBookmarks(&dummy);
#endif
nsAutoString personalToolbarFolderName;
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 folder;
#else
nsCOMPtr<nsIRDFResource> folder;
#endif
if (!aReplace) {
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
@ -1205,11 +1186,7 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
bundle->FormatStringFromName(NS_LITERAL_STRING("importedBookmarksFolder").get(),
sourceNameStrings, 1, getter_Copies(importedIEFavsTitle));
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(root, importedIEFavsTitle, -1, &folder);
#else
bms->CreateFolderInContainer(importedIEFavsTitle.get(), root, -1, getter_AddRefs(folder));
#endif
}
else {
// Locate the Links toolbar folder, we want to replace the Personal Toolbar content with
@ -1245,7 +1222,6 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
rv = ParseFavoritesFolder(favoritesDirectory, folder, bms, personalToolbarFolderName, PR_TRUE);
if (NS_FAILED(rv)) return rv;
#ifdef MOZ_PLACES_BOOKMARKS
// after importing the favorites,
// we need to set this pref so that on startup
// we don't blow away what we just imported
@ -1253,18 +1229,13 @@ nsIEProfileMigrator::CopyFavorites(PRBool aReplace) {
NS_ENSURE_TRUE(pref, NS_ERROR_FAILURE);
rv = pref->SetBoolPref("browser.places.importBookmarksHTML", PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
#endif
}
return CopySmartKeywords(root);
}
nsresult
#ifdef MOZ_PLACES_BOOKMARKS
nsIEProfileMigrator::CopySmartKeywords(PRInt64 aParentFolder)
#else
nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
#endif
{
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
@ -1274,15 +1245,10 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
NS_SUCCEEDED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
searchUrlKey, nsIWindowsRegKey::ACCESS_READ))) {
#ifdef MOZ_PLACES_BOOKMARKS
nsresult rv;
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 keywordsFolder = 0;
#else
nsCOMPtr<nsIBookmarksService> bms(do_GetService("@mozilla.org/browser/bookmarks-service;1"));
nsCOMPtr<nsIRDFResource> keywordsFolder, bookmark;
#endif
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
@ -1305,12 +1271,7 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
nsString importedIESearchUrlsTitle;
bundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchURLsFolder").get(),
sourceNameStrings, 1, getter_Copies(importedIESearchUrlsTitle));
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(aParentFolder, importedIESearchUrlsTitle, -1, &keywordsFolder);
#else
bms->CreateFolderInContainer(importedIESearchUrlsTitle.get(), aParentFolder, -1,
getter_AddRefs(keywordsFolder));
#endif
}
nsCOMPtr<nsIWindowsRegKey> childKey;
@ -1326,37 +1287,10 @@ nsIEProfileMigrator::CopySmartKeywords(nsIRDFResource* aParentFolder)
childKey->Close();
continue;
}
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 id;
bms->InsertBookmark(keywordsFolder, uri,
nsINavBookmarksService::DEFAULT_INDEX, keyName,
&id);
#else
nsCAutoString hostCStr;
uri->GetHost(hostCStr);
NS_ConvertUTF8toUTF16 host(hostCStr);
const PRUnichar* nameStrings[] = { host.get() };
nsString keywordName;
nsresult rv = bundle->FormatStringFromName(
NS_LITERAL_STRING("importedSearchURLsTitle").get(),
nameStrings, 1, getter_Copies(keywordName));
const PRUnichar* descStrings[] = { keyName.get(), host.get() };
nsString keywordDesc;
rv = bundle->FormatStringFromName(
NS_LITERAL_STRING("importedSearchUrlDesc").get(),
descStrings, 2, getter_Copies(keywordDesc));
bms->CreateBookmarkInContainer(keywordName.get(),
url.get(),
keyName.get(),
keywordDesc.get(),
nsnull,
nsnull,
keywordsFolder,
-1,
getter_AddRefs(bookmark));
#endif
}
childKey->Close();
}
@ -1399,13 +1333,8 @@ nsIEProfileMigrator::ResolveShortcut(const nsString &aFileName, char** aOutURL)
nsresult
nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParentFolder,
nsINavBookmarksService* aBookmarksService,
#else
nsIRDFResource* aParentResource,
nsIBookmarksService* aBookmarksService,
#endif
const nsAString& aPersonalToolbarFolderName,
PRBool aIsAtRootLevel)
{
@ -1466,7 +1395,6 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
CaseInsensitiveCompare))
bookmarkName.SetLength(lnkExtStart);
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> bookmarkURI;
rv = NS_NewFileURI(getter_AddRefs(bookmarkURI), localFile);
NS_ENSURE_SUCCESS(rv, rv);
@ -1475,78 +1403,21 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
nsINavBookmarksService::DEFAULT_INDEX,
bookmarkName, &id);
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCAutoString spec;
nsCOMPtr<nsIFile> filePath(localFile);
// Get the file url format (file:///...) of the native file path.
rv = NS_GetURLSpecFromFile(filePath, spec);
if (NS_FAILED(rv)) continue;
nsCOMPtr<nsIRDFResource> bookmark;
// Here it's assumed that NS_GetURLSpecFromFile returns spec in UTF-8.
// It is very likely to be ASCII (with everything escaped beyond file://),
// but we don't lose much assuming that it's UTF-8. This is not perf.
// critical.
aBookmarksService->CreateBookmarkInContainer(bookmarkName.get(),
NS_ConvertUTF8toUTF16(spec).get(),
nsnull,
nsnull,
nsnull,
nsnull,
aParentResource,
-1,
getter_AddRefs(bookmark));
#endif
if (NS_FAILED(rv)) continue;
}
else if (isDir) {
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 folder;
#else
nsCOMPtr<nsIRDFResource> folder;
#endif
if (bookmarkName.Equals(aPersonalToolbarFolderName)) {
#ifdef MOZ_PLACES_BOOKMARKS
aBookmarksService->GetToolbarFolder(&folder);
// If we're here, it means the user's doing a _replace_ import which means
// clear out the content of this folder, and replace it with the new content
aBookmarksService->RemoveFolderChildren(folder);
#else
aBookmarksService->GetBookmarksToolbarFolder(getter_AddRefs(folder));
// If we're here, it means the user's doing a _replace_ import which means
// clear out the content of this folder, and replace it with the new content
nsCOMPtr<nsIRDFContainer> ctr(do_CreateInstance("@mozilla.org/rdf/container;1"));
nsCOMPtr<nsIRDFDataSource> bmds(do_QueryInterface(aBookmarksService));
ctr->Init(bmds, folder);
nsCOMPtr<nsISimpleEnumerator> e;
ctr->GetElements(getter_AddRefs(e));
PRBool hasMore;
e->HasMoreElements(&hasMore);
while (hasMore) {
nsCOMPtr<nsIRDFResource> b;
e->GetNext(getter_AddRefs(b));
ctr->RemoveElement(b, PR_FALSE);
e->HasMoreElements(&hasMore);
}
#endif
}
else {
#ifdef MOZ_PLACES_BOOKMARKS
rv = aBookmarksService->CreateFolder(aParentFolder,
bookmarkName,
nsINavBookmarksService::DEFAULT_INDEX,
&folder);
#else
rv = aBookmarksService->CreateFolderInContainer(bookmarkName.get(),
aParentResource,
-1,
getter_AddRefs(folder));
#endif
if (NS_FAILED(rv)) continue;
}
@ -1570,7 +1441,6 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
nsCString resolvedURL;
ResolveShortcut(path, getter_Copies(resolvedURL));
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> resolvedURI;
rv = NS_NewURI(getter_AddRefs(resolvedURI), resolvedURL);
NS_ENSURE_SUCCESS(rv, rv);
@ -1579,24 +1449,6 @@ nsIEProfileMigrator::ParseFavoritesFolder(nsIFile* aDirectory,
nsINavBookmarksService::DEFAULT_INDEX,
name, &id);
if (NS_FAILED(rv)) continue;
#else
nsCOMPtr<nsIRDFResource> bookmark;
// As far as I can tell reading the MSDN API document,
// IUniformResourceLocator::GetURL (used by ResolveShortcut) returns a
// URL in ASCII (with non-ASCII characters escaped) and it doesn't yet
// support IDN (i18n) hostname. However, it may in the future so that
// using UTF8toUTF16 wouldn't be a bad idea.
rv = aBookmarksService->CreateBookmarkInContainer(name.get(),
NS_ConvertUTF8toUTF16(resolvedURL).get(),
nsnull,
nsnull,
nsnull,
nsnull,
aParentResource,
-1,
getter_AddRefs(bookmark));
#endif
if (NS_FAILED(rv)) continue;
}
}
while (1);

Просмотреть файл

@ -50,11 +50,7 @@
class nsIFile;
class nsICookieManager2;
class nsIRDFResource;
#ifdef MOZ_PLACES_BOOKMARKS
class nsINavBookmarksService;
#else
class nsIBookmarksService;
#endif
class nsIPrefBranch;
#import PSTOREC_DLL raw_interfaces_only
@ -90,21 +86,12 @@ protected:
nsresult CopyFavorites(PRBool aReplace);
void ResolveShortcut(const nsString &aFileName, char** aOutURL);
#ifdef MOZ_PLACES_BOOKMARKS
nsresult ParseFavoritesFolder(nsIFile* aDirectory,
PRInt64 aParentFolder,
nsINavBookmarksService* aBookmarksService,
const nsAString& aPersonalToolbarFolderName,
PRBool aIsAtRootLevel);
nsresult CopySmartKeywords(PRInt64 aParentFolder);
#else
nsresult ParseFavoritesFolder(nsIFile* aDirectory,
nsIRDFResource* aParentResource,
nsIBookmarksService* aBookmarksService,
const nsAString& aPersonalToolbarFolderName,
PRBool aIsAtRootLevel);
nsresult CopySmartKeywords(nsIRDFResource* aParentFolder);
#endif
nsresult CopyCookiesFromBuffer(char *aBuffer, PRUint32 aBufferLength,
nsICookieManager2 *aCookieManager);

Просмотреть файл

@ -40,12 +40,8 @@
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDocShellCID.h"
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#else
#include "nsIBookmarksService.h"
#endif
#include "nsIBrowserProfileMigrator.h"
#include "nsIBrowserHistory.h"
#include "nsICookieManager2.h"
@ -1041,25 +1037,12 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
nsCOMPtr<nsILineInputStream> lineInputStream(do_QueryInterface(fileInputStream));
nsresult rv;
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 root;
rv = bms->GetBookmarksRoot(&root);
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 parentFolder;
#else
nsCOMPtr<nsIBookmarksService> bms(do_GetService("@mozilla.org/browser/bookmarks-service;1"));
NS_ENSURE_TRUE(bms, NS_ERROR_FAILURE);
PRBool dummy;
bms->ReadBookmarks(&dummy);
nsCOMPtr<nsIRDFService> rdf(do_GetService("@mozilla.org/rdf/rdf-service;1"));
nsCOMPtr<nsIRDFResource> root;
rdf->GetResource(NS_LITERAL_CSTRING("NC:BookmarksRoot"),
getter_AddRefs(root));
nsCOMPtr<nsIRDFResource> parentFolder;
#endif
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID));
nsCOMPtr<nsIStringBundle> bundle;
@ -1075,13 +1058,8 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
sourceNameStrings, 1,
getter_Copies(importedOperaHotlistTitle));
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(parentFolder, importedOperaHotlistTitle,
nsINavBookmarksService::DEFAULT_INDEX, &parentFolder);
#else
bms->CreateFolderInContainer(importedOperaHotlistTitle.get(),
root, -1, getter_AddRefs(parentFolder));
#endif
}
else
parentFolder = root;
@ -1092,22 +1070,13 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
printf("*** done copying smart keywords\n");
#endif
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 toolbar;
rv = bms->GetToolbarFolder(&toolbar);
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCOMPtr<nsIRDFResource> toolbar;
bms->GetBookmarksToolbarFolder(getter_AddRefs(toolbar));
if (aReplace)
ClearToolbarFolder(bms, toolbar);
#endif
rv = ParseBookmarksFolder(lineInputStream, parentFolder, toolbar, bms);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef MOZ_PLACES_BOOKMARKS
// after importing the favorites,
// we need to set this pref so that on startup
// we don't blow away what we just imported
@ -1115,21 +1084,14 @@ nsOperaProfileMigrator::CopyBookmarks(PRBool aReplace)
NS_ENSURE_TRUE(pref, NS_ERROR_FAILURE);
rv = pref->SetBoolPref("browser.places.importBookmarksHTML", PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
#endif
return rv;
return NS_OK;
}
#if defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
nsresult
#ifdef MOZ_PLACES_BOOKMARKS
nsOperaProfileMigrator::CopySmartKeywords(nsINavBookmarksService* aBMS,
nsIStringBundle* aBundle,
PRInt64 aParentFolder)
#else
nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
nsIStringBundle* aBundle,
nsIRDFResource* aParentFolder)
#endif
{
nsresult rv;
@ -1156,16 +1118,10 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
sourceNameStrings, 1,
getter_Copies(importedSearchUrlsTitle));
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 keywordsFolder;
rv = aBMS->CreateFolder(aParentFolder, importedSearchUrlsTitle,
nsINavBookmarksService::DEFAULT_INDEX, &keywordsFolder);
NS_ENSURE_SUCCESS(rv, rv);
#else
nsCOMPtr<nsIRDFResource> keywordsFolder;
aBMS->CreateFolderInContainer(importedSearchUrlsTitle.get(),
aParentFolder, -1, getter_AddRefs(keywordsFolder));
#endif
PRInt32 sectionIndex = 1;
nsCAutoString name, url, keyword;
@ -1226,30 +1182,12 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
aBundle->FormatStringFromName(NS_LITERAL_STRING("importedSearchUrlDesc").get(),
descStrings, 2, getter_Copies(keywordDesc));
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 newId;
rv = aBMS->InsertBookmark(keywordsFolder, uri,
nsINavBookmarksService::DEFAULT_INDEX,
nameStr, &newId);
NS_ENSURE_SUCCESS(rv, rv);
// TODO -- set bookmark keyword to keyword and description to keywordDesc.
#else
nsCOMPtr<nsIRDFResource> itemRes;
// XXX We don't know for sure how Opera deals with IDN hostnames in URL.
// Assuming it's in UTF-8 is rather safe because it covers two cases
// (UTF-8 and ASCII) out of three cases (the last is a non-UTF-8
// multibyte encoding).
rv = aBMS->CreateBookmarkInContainer(nameStr.get(),
NS_ConvertUTF8toUTF16(url).get(),
NS_ConvertUTF8toUTF16(keyword).get(),
keywordDesc.get(),
nsnull,
nsnull,
keywordsFolder,
-1,
getter_AddRefs(itemRes));
#endif
}
while (1);
@ -1257,32 +1195,6 @@ nsOperaProfileMigrator::CopySmartKeywords(nsIBookmarksService* aBMS,
}
#endif
#ifndef MOZ_PLACES_BOOKMARKS
void
nsOperaProfileMigrator::ClearToolbarFolder(nsIBookmarksService* aBookmarksService, nsIRDFResource* aToolbarFolder)
{
// If we're here, it means the user's doing a _replace_ import which means
// clear out the content of this folder, and replace it with the new content
nsCOMPtr<nsIRDFContainer> ctr(do_CreateInstance("@mozilla.org/rdf/container;1"));
nsCOMPtr<nsIRDFDataSource> bmds(do_QueryInterface(aBookmarksService));
ctr->Init(bmds, aToolbarFolder);
nsCOMPtr<nsISimpleEnumerator> e;
ctr->GetElements(getter_AddRefs(e));
PRBool hasMore;
e->HasMoreElements(&hasMore);
while (hasMore) {
nsCOMPtr<nsIRDFResource> b;
e->GetNext(getter_AddRefs(b));
ctr->RemoveElement(b, PR_FALSE);
e->HasMoreElements(&hasMore);
}
}
#endif
typedef enum { LineType_FOLDER,
LineType_BOOKMARK,
LineType_SEPARATOR,
@ -1336,15 +1248,9 @@ typedef enum { EntryType_BOOKMARK, EntryType_FOLDER } EntryType;
nsresult
nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParent,
PRInt64 aToolbar,
nsINavBookmarksService* aBMS)
#else
nsIRDFResource* aParent,
nsIRDFResource* aToolbar,
nsIBookmarksService* aBMS)
#endif
{
nsresult rv;
PRBool moreData = PR_FALSE;
@ -1397,12 +1303,8 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
// Assuming it's in UTF-8 is rather safe because it covers two cases
// (UTF-8 and ASCII) out of three cases (the last is a non-UTF-8
// multibyte encoding).
#ifndef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIRDFResource> itemRes;
#endif
if (entryType == EntryType_BOOKMARK) {
if (!name.IsEmpty() && !url.IsEmpty()) {
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), url);
if (NS_FAILED(rv))
@ -1413,19 +1315,6 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
name, &id);
if (NS_FAILED(rv))
continue;
#else
rv = aBMS->CreateBookmarkInContainer(name.get(),
NS_ConvertUTF8toUTF16(url).get(),
keyword.get(),
description.get(),
nsnull,
nsnull,
onToolbar ? aToolbar : aParent,
-1,
getter_AddRefs(itemRes));
if (NS_FAILED(rv))
continue;
#endif
name.Truncate();
url.Truncate();
keyword.Truncate();
@ -1435,22 +1324,12 @@ nsOperaProfileMigrator::ParseBookmarksFolder(nsILineInputStream* aStream,
}
else if (entryType == EntryType_FOLDER) {
if (!name.IsEmpty()) {
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 newFolder;
rv = aBMS->CreateFolder(onToolbar ? aToolbar : aParent,
name, nsINavBookmarksService::DEFAULT_INDEX, &newFolder);
if (NS_FAILED(rv))
continue;
rv = ParseBookmarksFolder(aStream, newFolder, aToolbar, aBMS);
#else
rv = aBMS->CreateFolderInContainer(name.get(),
onToolbar ? aToolbar : aParent,
-1,
getter_AddRefs(itemRes));
if (NS_FAILED(rv))
continue;
rv = ParseBookmarksFolder(aStream, itemRes, aToolbar, aBMS);
#endif
name.Truncate();
}
}

Просмотреть файл

@ -52,11 +52,7 @@ class nsILocalFile;
class nsINIParser;
class nsIPermissionManager;
class nsIPrefBranch;
#ifdef MOZ_PLACES_BOOKMARKS
class nsINavBookmarksService;
#else
class nsIBookmarksService;
#endif
class nsIRDFResource;
class nsOperaProfileMigrator : public nsIBrowserProfileMigrator
@ -108,7 +104,6 @@ protected:
nsresult CopyHistory(PRBool aReplace);
nsresult CopyBookmarks(PRBool aReplace);
#ifdef MOZ_PLACES_BOOKMARKS
void ClearToolbarFolder(nsINavBookmarksService * aBookmarksService, PRInt64 aToolbarFolder);
nsresult ParseBookmarksFolder(nsILineInputStream* aStream,
PRInt64 aFolder,
@ -119,18 +114,6 @@ protected:
nsIStringBundle* aBundle,
PRInt64 aParentFolder);
#endif // defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
#else
void ClearToolbarFolder(nsIBookmarksService* aBookmarksService, nsIRDFResource* aToolbarFolder);
nsresult ParseBookmarksFolder(nsILineInputStream* aStream,
nsIRDFResource* aFolder,
nsIRDFResource* aToolbar,
nsIBookmarksService* aBMS);
#if defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
nsresult CopySmartKeywords(nsIBookmarksService* aBMS,
nsIStringBundle* aBundle,
nsIRDFResource* aParentFolder);
#endif // defined(XP_WIN) || (defined(XP_UNIX) && !defined(XP_MACOSX))
#endif // MOZ_PLACES_BOOKMARKS
void GetOperaProfile(const PRUnichar* aProfile, nsILocalFile** aFile);

Просмотреть файл

@ -41,12 +41,8 @@
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDocShellCID.h"
#ifdef MOZ_PLACES_BOOKMARKS
#include "nsINavBookmarksService.h"
#include "nsBrowserCompsCID.h"
#else
#include "nsIBookmarksService.h"
#endif
#include "nsIBrowserHistory.h"
#include "nsICookieManager2.h"
#include "nsIFileProtocolHandler.h"
@ -896,7 +892,6 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
// a folder called "Imported IE Favorites" and place all the Bookmarks there.
nsresult rv;
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsINavBookmarksService> bms(do_GetService(NS_NAVBOOKMARKSSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 root;
@ -904,21 +899,6 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 folder;
#else
nsCOMPtr<nsIRDFService> rdf(do_GetService("@mozilla.org/rdf/rdf-service;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRDFResource> root;
rdf->GetResource(NS_LITERAL_CSTRING("NC:BookmarksRoot"), getter_AddRefs(root));
nsCOMPtr<nsIBookmarksService> bms(do_GetService("@mozilla.org/browser/bookmarks-service;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRBool dummy;
bms->ReadBookmarks(&dummy);
nsCOMPtr<nsIRDFResource> folder;
#endif
if (!aReplace) {
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
@ -936,13 +916,8 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
sourceNameStrings, 1,
getter_Copies(importedSafariBookmarksTitle));
#ifdef MOZ_PLACES_BOOKMARKS
bms->CreateFolder(root, importedSafariBookmarksTitle, nsINavBookmarksService::DEFAULT_INDEX,
&folder);
#else
bms->CreateFolderInContainer(importedSafariBookmarksTitle.get(), root, -1,
getter_AddRefs(folder));
#endif
}
else {
// In non-replace mode we are merging at the top level.
@ -979,7 +954,6 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
(CFArrayRef)::CFDictionaryGetValue(safariBookmarks, CFSTR("Children"));
if (children) {
rv = ParseBookmarksFolder(children, folder, bms, PR_TRUE);
#ifdef MOZ_PLACES_BOOKMARKS
if (NS_SUCCEEDED(rv)) {
// after importing the favorites,
// we need to set this pref so that on startup
@ -989,7 +963,6 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
rv = pref->SetBoolPref("browser.places.importBookmarksHTML", PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
}
#endif
}
}
}
@ -999,13 +972,8 @@ nsSafariProfileMigrator::CopyBookmarks(PRBool aReplace)
nsresult
nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParentFolder,
nsINavBookmarksService * aBookmarksService,
#else
nsIRDFResource* aParentResource,
nsIBookmarksService* aBookmarksService,
#endif
PRBool aIsAtRootLevel)
{
nsresult rv = NS_OK;
@ -1034,13 +1002,8 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
// Look for the BookmarksBar Bookmarks and add them into the appropriate
// Personal Toolbar Root
if (title.EqualsLiteral("BookmarksBar") && aIsAtRootLevel) {
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 toolbarFolder;
aBookmarksService->GetToolbarFolder(&toolbarFolder);
#else
nsCOMPtr<nsIRDFResource> toolbarFolder;
aBookmarksService->GetBookmarksToolbarFolder(getter_AddRefs(toolbarFolder));
#endif
rv |= ParseBookmarksFolder(children,
toolbarFolder,
@ -1050,29 +1013,17 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
// Look for the BookmarksMenu Bookmarks and flatten them into the top level
else if (title.EqualsLiteral("BookmarksMenu") && aIsAtRootLevel) {
rv |= ParseBookmarksFolder(children,
#ifdef MOZ_PLACES_BOOKMARKS
aParentFolder,
#else
aParentResource,
#endif
aBookmarksService,
PR_TRUE);
}
else {
// Encountered a Folder, so create one in our Bookmarks DataSource and then
// parse the contents of the Safari one into it...
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 folder;
rv |= aBookmarksService->CreateFolder(aParentFolder, title,
nsINavBookmarksService::DEFAULT_INDEX,
&folder);
#else
nsCOMPtr<nsIRDFResource> folder;
rv |= aBookmarksService->CreateFolderInContainer(title.get(),
aParentResource,
-1,
getter_AddRefs(folder));
#endif
rv |= ParseBookmarksFolder(children,
folder,
aBookmarksService,
@ -1086,25 +1037,12 @@ nsSafariProfileMigrator::ParseBookmarksFolder(CFArrayRef aChildren,
nsAutoString title, url;
if (GetDictionaryStringValue(URIDictionary, CFSTR("title"), title) &&
GetDictionaryStringValue(entry, CFSTR("URLString"), url)) {
#ifdef MOZ_PLACES_BOOKMARKS
nsCOMPtr<nsIURI> uri;
PRInt64 id;
rv |= NS_NewURI(getter_AddRefs(uri), url);
rv |= aBookmarksService->InsertBookmark(aParentFolder, uri,
nsINavBookmarksService::DEFAULT_INDEX,
title, &id);
#else
nsCOMPtr<nsIRDFResource> bookmark;
rv |= aBookmarksService->CreateBookmarkInContainer(title.get(),
url.get(),
nsnull,
nsnull,
nsnull,
nsnull,
aParentResource,
-1,
getter_AddRefs(bookmark));
#endif
}
}
}

Просмотреть файл

@ -93,13 +93,8 @@ protected:
nsresult CopyHistory(PRBool aReplace);
nsresult CopyBookmarks(PRBool aReplace);
nsresult ParseBookmarksFolder(CFArrayRef aChildren,
#ifdef MOZ_PLACES_BOOKMARKS
PRInt64 aParentFolder,
nsINavBookmarksService * aBookmarksService,
#else
nsIRDFResource* aParentResource,
nsIBookmarksService* aBookmarksService,
#endif
PRBool aIsAtRootLevel);
nsresult CopyFormData(PRBool aReplace);
nsresult CopyOtherData(PRBool aReplace);

Просмотреть файл

@ -289,7 +289,6 @@ BrowserGlue.prototype = {
* - imports the bookmarks html file if bookmarks datastore is empty
*/
_initPlaces: function bg__initPlaces() {
#ifdef MOZ_PLACES_BOOKMARKS
// we need to instantiate the history service before we check the
// the browser.places.importBookmarksHTML pref, as
// nsNavHistory::ForceMigrateBookmarksDB() will set that pref
@ -338,7 +337,6 @@ BrowserGlue.prototype = {
}
}
}
#endif
},
/**
@ -346,13 +344,11 @@ BrowserGlue.prototype = {
* - back up and archive bookmarks
*/
_shutdownPlaces: function bg__shutdownPlaces() {
#ifdef MOZ_PLACES_BOOKMARKS
// backup bookmarks to bookmarks.html
var importer =
Cc["@mozilla.org/browser/places/import-export-service;1"].
getService(Ci.nsIPlacesImportExportService);
importer.backupBookmarksFile();
#endif
},
// ------------------------------

Просмотреть файл

@ -43,11 +43,7 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = public
ifdef MOZ_PLACES_BOOKMARKS
DIRS += src
endif
DIRS = public src
ifdef ENABLE_TESTS
DIRS += tests

Просмотреть файл

@ -157,7 +157,6 @@ PlacesController.prototype = {
}
}
return false;
#ifdef MOZ_PLACES_BOOKMARKS
case "placesCmd_new:folder":
case "placesCmd_new:livemark":
return this._canInsert() &&
@ -229,7 +228,6 @@ PlacesController.prototype = {
}
}
return false;
#endif
default:
return false;
}
@ -290,7 +288,6 @@ PlacesController.prototype = {
case "placesCmd_open:tabs":
this.openLinksInTabs();
break;
#ifdef MOZ_PLACES_BOOKMARKS
case "placesCmd_new:folder":
this.newItem("folder");
break;
@ -321,7 +318,6 @@ PlacesController.prototype = {
case "placesCmd_setAsBookmarksToolbarFolder":
this.setBookmarksToolbarFolder();
break;
#endif
}
},
@ -1504,7 +1500,6 @@ function goUpdatePlacesCommands() {
goUpdateCommand("placesCmd_open:window");
goUpdateCommand("placesCmd_open:tab");
goUpdateCommand("placesCmd_open:tabs");
#ifdef MOZ_PLACES_BOOKMARKS
goUpdateCommand("placesCmd_new:folder");
goUpdateCommand("placesCmd_new:bookmark");
goUpdateCommand("placesCmd_new:livemark");
@ -1515,5 +1510,4 @@ function goUpdatePlacesCommands() {
goUpdateCommand("placesCmd_reload");
goUpdateCommand("placesCmd_reloadMicrosummary");
goUpdateCommand("placesCmd_sortBy:name");
#endif
}

Просмотреть файл

@ -105,12 +105,8 @@ function historyAddBookmarks()
var node = gHistoryTree.selectedURINode;
if (!node)
return;
#ifdef MOZ_PLACES_BOOKMARKS
PlacesUtils.showMinimalAddBookmarkUI(PlacesUtils._uri(node.uri), node.title);
#else
BookmarksUtils.addBookmark(node.uri, node.title, undefined);
#endif
}
function SetSortingAndGrouping(aOptions)

Просмотреть файл

@ -63,10 +63,6 @@
src="chrome://browser/content/bookmarks/sidebarUtils.js"/>
<script type="application/x-javascript"
src="chrome://browser/content/places/history-panel.js"/>
#ifndef MOZ_PLACES_BOOKMARKS
<script type="application/x-javascript"
src="chrome://browser/content/bookmarks/bookmarks.js"/>
#endif
<commandset id="editMenuCommands"/>
<commandset id="placesCommands"/>

Просмотреть файл

@ -73,7 +73,6 @@
oncommand="goDoCommand('placesCmd_open:tab');"/>
<command id="placesCmd_open:tabs"
oncommand="goDoCommand('placesCmd_open:tabs');"/>
#ifdef MOZ_PLACES_BOOKMARKS
<command id="placesCmd_new:bookmark"
oncommand="goDoCommand('placesCmd_new:bookmark');"/>
<command id="placesCmd_new:livemark"
@ -97,7 +96,6 @@
oncommand="goDoCommand('placesCmd_moveBookmarks');"/>
<command id="placesCmd_setAsBookmarksToolbarFolder"
oncommand="goDoCommand('placesCmd_setAsBookmarksToolbarFolder');"/>
#endif
</commandset>
<popup id="placesContext"

Просмотреть файл

@ -45,8 +45,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = test_browser_places
ifdef MOZ_PLACES_BOOKMARKS
XPCSHELL_TESTS = unit
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -113,11 +113,7 @@ var gMainPane = {
setHomePageToBookmark: function ()
{
var rv = { urls: null, names: null };
#ifdef MOZ_PLACES_BOOKMARKS
document.documentElement.openSubDialog("chrome://browser/content/preferences/selectBookmark.xul",
#else
document.documentElement.openSubDialog("chrome://browser/content/bookmarks/selectBookmark.xul",
#endif
"resizable", rv);
if (rv.urls && rv.names) {
var homePage = document.getElementById("browser.startup.homepage");

Просмотреть файл

@ -175,17 +175,10 @@ var gEngineManagerDialog = {
eduplicate = true;
} else {
try {
#ifdef MOZ_PLACES_BOOKMARKS
var bmserv = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
if (bmserv.getURIForKeyword(alias.value))
bduplicate = true;
#else
var bmserv = Cc["@mozilla.org/browser/bookmarks-service;1"].
getService(Ci.nsIBookmarksService);
if (bmserv.resolveKeyword(alias.value, {}))
bduplicate = true;
#endif
} catch(ex) {}
// Check for duplicates in changes we haven't committed yet

Просмотреть файл

@ -121,7 +121,6 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
if (!sidebarURLSecurityCheck(aContentURL))
return;
#ifdef MOZ_PLACES_BOOKMARKS
var uri = null;
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
@ -131,20 +130,6 @@ function (aTitle, aContentURL, aCustomizeURL, aPersist)
catch(ex) { return; }
win.PlacesUtils.showMinimalAddBookmarkUI(uri, aTitle, null, null, true, true);
#else
var dialogArgs = {
name: aTitle,
url: aContentURL,
bWebPanel: true
}
#ifdef XP_MACOSX
var features = "chrome,dialog,resizable,modal";
#else
var features = "centerscreen,chrome,dialog,resizable,dependent";
#endif
win.openDialog("chrome://browser/content/bookmarks/addBookmark2.xul", "",
features, dialogArgs);
#endif
}
nsSidebar.prototype.validateSearchEngine =

Просмотреть файл

@ -42,7 +42,6 @@ MOZ_PHOENIX=1
MOZ_ENABLE_LIBXUL=1
MOZ_PLACES=1
MOZ_PLACES_BOOKMARKS=1
# always enabled for form history
MOZ_MORKREADER=1
MOZ_SAFE_BROWSING=1

Просмотреть файл

@ -25,21 +25,12 @@
locale/browser/setDesktopBackground.dtd (%chrome/browser/setDesktopBackground.dtd)
locale/browser/shellservice.properties (%chrome/browser/shellservice.properties)
locale/browser/sessionstore.properties (%chrome/browser/sessionstore.properties)
#ifdef MOZ_PLACES
locale/browser/places/places.dtd (%chrome/browser/places/places.dtd)
locale/browser/places/places.properties (%chrome/browser/places/places.properties)
#endif
#ifdef MOZ_PLACES_BOOKMARKS
locale/browser/places/bookmarkProperties.dtd (%chrome/browser/places/bookmarkProperties.dtd)
locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties)
locale/browser/preferences/selectBookmark.dtd (%chrome/browser/preferences/selectBookmark.dtd)
locale/browser/places/moveBookmarks.dtd (%chrome/browser/places/moveBookmarks.dtd)
#else
* locale/browser/bookmarks/bookmarks.dtd (%chrome/browser/bookmarks/bookmarks.dtd)
* locale/browser/bookmarks/addBookmark.dtd (%chrome/browser/bookmarks/addBookmark.dtd)
* locale/browser/bookmarks/bookmarks.properties (%chrome/browser/bookmarks/bookmarks.properties)
* locale/browser/bookmarks/bookmarksProperties.dtd (%chrome/browser/bookmarks/bookmarksProperties.dtd)
#endif
#ifdef MOZ_SAFE_BROWSING
locale/browser/safebrowsing/phishing-afterload-warning-message.dtd (%chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd)
locale/browser/safebrowsing/report-phishing.dtd (%chrome/browser/safebrowsing/report-phishing.dtd)

Просмотреть файл

@ -155,34 +155,6 @@ toolbarbutton.bookmark-item .toolbarbutton-text {
padding-top: 1px;
}
%ifndef MOZ_PLACES_BOOKMARKS
.bookmark-item > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://browser/skin/bookmarks/folderarrow.png");
height: 16px !important;
padding: 5px 5px 4px 3px;
}
.bookmark-item:hover > .toolbarbutton-menu-dropmarker, .bookmark-item[open] > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://browser/skin/bookmarks/folderarrow-hover.png");
}
.bookmark-item[livemark] > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://browser/skin/bookmarks/livemark-folder.png");
padding: 4px 4px 3px 2px;
}
.bookmark-item[livemark]:hover > .toolbarbutton-menu-dropmarker, .bookmark-item[livemark][open] > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://browser/skin/bookmarks/livemark-folder-hover.png");
}
.bookmark-item[livemark] {
list-style-image: url("chrome://browser/skin/page-livemarks.png");
}
.bookmark-item[livemark] .menuitem-iconic {
list-style-image: url("chrome://browser/skin/bookmarks/livemark-item.png");
}
%else
.bookmark-item > .toolbarbutton-menu-dropmarker {
list-style-image: url("chrome://browser/skin/places/folderDropArrow.png");
height: 16px !important;
@ -214,7 +186,6 @@ toolbarbutton.bookmark-item .toolbarbutton-text {
.bookmark-item menuitem[siteURI] {
list-style-image: none;
}
%endif
.toolbarpaletteitem-box[type="bookmarks-toolbar"][place="palette"] {
background: url("chrome://browser/skin/bookmarks/Toolbar-bookmarks.png") no-repeat;
@ -237,11 +208,9 @@ toolbarpaletteitem[place="toolbar"] .bookmarks-toolbar-items {
visibility: hidden;
}
%ifdef MOZ_PLACES_BOOKMARKS
toolbarpaletteitem[place="toolbar"] .places-toolbar-items {
display: none;
}
%endif
/* ----- BOOKMARK MENUS ----- */
@ -1001,11 +970,7 @@ toolbar[iconsize="small"] #paste-button:hover:active {
}
#page-proxy-button {
%ifdef MOZ_PLACES
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
%else
list-style-image: url("chrome://browser/skin/bookmarks/bookmark-item.png");
%endif
}
#page-proxy-button[pageproxystate="invalid"] {
@ -1235,11 +1200,7 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
}
.bookmark-item {
%ifdef MOZ_PLACES
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
%else
list-style-image: url("chrome://browser/skin/bookmarks/bookmark-item.png");
%endif
}
.openintabs-menuitem {
@ -1275,7 +1236,6 @@ tabpanels.plain {
background-color: #fff !important;
}
%ifdef MOZ_PLACES_BOOKMARKS
/* Personal toolbar */
.toolbar-drop-indicator {
height: 16px;
@ -1317,7 +1277,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
.bookmark-item[dragover-bottom="true"] {
-moz-border-bottom-colors: #000000;
}
%endif
#CustomizeToolbarSheet > #main-box {
border-top: none !important;

Просмотреть файл

@ -32,14 +32,9 @@ classic.jar:
skin/classic/browser/feeds/feedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/setDesktopBackground.css
skin/classic/browser/monitor.png
#ifdef MOZ_PLACES
skin/classic/browser/places/places.css (places/places.css)
skin/classic/browser/places/query.png (places/query.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
#else
skin/classic/browser/bookmarks/bookmark-item.png (bookmarks/bookmark-item.png)
#endif
#ifdef MOZ_PLACES_BOOKMARKS
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
@ -54,22 +49,6 @@ classic.jar:
skin/classic/browser/places/expander-closed.png (bookmarks/expander-closed.png)
skin/classic/browser/places/expander-open-active.png (bookmarks/expander-open-active.png)
skin/classic/browser/places/expander-open.png (bookmarks/expander-open.png)
#else
skin/classic/browser/bookmarks/addBookmark.css (bookmarks/addBookmark.css)
skin/classic/browser/bookmarks/bookmarksProperties.css (bookmarks/bookmarksProperties.css)
skin/classic/browser/bookmarks/bookmark-folder.png (bookmarks/bookmark-folder.png)
skin/classic/browser/bookmarks/Bookmarks-toolbar.png (bookmarks/Bookmarks-toolbar.png)
skin/classic/browser/bookmarks/bookmarksManager.css (bookmarks/bookmarksManager.css)
skin/classic/browser/bookmarks/expander-closed-active.png (bookmarks/expander-closed-active.png)
skin/classic/browser/bookmarks/expander-closed.png (bookmarks/expander-closed.png)
skin/classic/browser/bookmarks/expander-open-active.png (bookmarks/expander-open-active.png)
skin/classic/browser/bookmarks/expander-open.png (bookmarks/expander-open.png)
skin/classic/browser/bookmarks/livemark-folder-hover.png (bookmarks/livemark-folder-hover.png)
skin/classic/browser/bookmarks/livemark-folder.png (bookmarks/livemark-folder.png)
skin/classic/browser/bookmarks/livemark-item.png (bookmarks/livemark-item.png)
skin/classic/browser/bookmarks/folderarrow-hover.png (bookmarks/folderarrow-hover.png)
skin/classic/browser/bookmarks/folderarrow.png (bookmarks/folderarrow.png)
#endif
#ifdef MOZ_SAFE_BROWSING
skin/classic/browser/safebrowsing/browser-protection.css (safebrowsing/browser-protection.css)
skin/classic/browser/safebrowsing/close16x16.png (safebrowsing/close16x16.png)

Просмотреть файл

@ -155,11 +155,9 @@ toolbarpaletteitem[place="toolbar"] .bookmarks-toolbar-items {
visibility: hidden;
}
%ifdef MOZ_PLACES_BOOKMARKS
toolbarpaletteitem[place="toolbar"] .places-toolbar-items {
display: none;
}
%endif
/* ::::: bookmark menus ::::: */
@ -1414,7 +1412,6 @@ toolbar[mode="text"] > #window-controls > toolbarbutton > .toolbarbutton-text {
list-style-image: url("chrome://global/skin/throbber/Throbber-small.gif");
}
%ifdef MOZ_PLACES_BOOKMARKS
/* Personal toolbar */
.toolbar-drop-indicator {
height: 16px;
@ -1456,4 +1453,3 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
.bookmark-item[dragover-bottom="true"] {
-moz-border-bottom-colors: #000000;
}
%endif

Просмотреть файл

@ -43,25 +43,15 @@ classic.jar:
skin/classic/browser/feeds/feedIcon.png (feeds/feedIcon.png)
skin/classic/browser/feeds/feedIcon16.png (feeds/feedIcon16.png)
skin/classic/browser/feeds/subscribe.css (feeds/subscribe.css)
#ifdef MOZ_PLACES
skin/classic/browser/places/places.css (places/places.css)
skin/classic/browser/places/query.png (places/query.png)
skin/classic/browser/places/livemarkItem.png (places/livemarkItem.png)
#endif
#ifdef MOZ_PLACES_BOOKMARKS
skin/classic/browser/places/bookmarksMenu.png (places/bookmarksMenu.png)
skin/classic/browser/places/bookmarksToolbar.png (places/bookmarksToolbar.png)
skin/classic/browser/places/toolbarDropMarker.png (places/toolbarDropMarker.png)
skin/classic/browser/places/folderDragOver.png (places/folderDragOver.png)
skin/classic/browser/places/bookmarkProperties.css (places/bookmarkProperties.css)
skin/classic/browser/places/organizer-toolbar.png (bookmarks/Bookmarks-toolbar.png)
#else
skin/classic/browser/Bookmarks-folder.png
skin/classic/browser/bookmarks/addBookmark.css (bookmarks/addBookmark.css)
skin/classic/browser/bookmarks/bookmarksProperties.css (bookmarks/bookmarksProperties.css)
skin/classic/browser/bookmarks/bookmarksManager.css (bookmarks/bookmarksManager.css)
skin/classic/browser/bookmarks/Bookmarks-toolbar.png (bookmarks/Bookmarks-toolbar.png)
#endif
#ifdef MOZ_SAFE_BROWSING
skin/classic/browser/safebrowsing/browser-protection.css (safebrowsing/browser-protection.css)
skin/classic/browser/safebrowsing/close16x16.png (safebrowsing/close16x16.png)

Просмотреть файл

@ -5816,17 +5816,10 @@ if test -n "$MOZ_PLACES"; then
AC_DEFINE(MOZ_PLACES)
MOZ_MORK=
MOZ_MORKREADER=1
fi
dnl ========================================================
dnl = Enable places bookmarks (use places for bookmarks)
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(places-bookmarks,
[ --enable-places-bookmarks Enable 'places' for bookmarks backend],
MOZ_PLACES_BOOKMARKS=1,
MOZ_PLACES_BOOKMARKS= )
if test -n "$MOZ_PLACES_BOOKMARKS"; then
AC_DEFINE(MOZ_PLACES_BOOKMARKS)
else
if test "$MOZ_BUILD_APP" = "browser"; then
AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
fi
fi
dnl ========================================================

Просмотреть файл

@ -101,10 +101,8 @@ EXTRA_DSO_LDOPTS += \
LOCAL_INCLUDES += -I$(srcdir)/../../build
ifdef MOZ_PLACES_BOOKMARKS
EXTRA_PP_COMPONENTS = nsLivemarkService.js \
nsTaggingService.js \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -377,14 +377,12 @@ nsNavBookmarks::InitRoots()
rv = CreateRoot(getRootStatement, NS_LITERAL_CSTRING("tags"), &mTagRoot, mRoot, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef MOZ_PLACES_BOOKMARKS
if (importDefaults) {
// when there is no places root, we should define the hierarchy by
// importing the default one.
rv = InitDefaults();
NS_ENSURE_SUCCESS(rv, rv);
}
#endif
// migration for bug 382094 - remove for A6
PRInt64 parent;

Просмотреть файл

@ -45,11 +45,9 @@ include $(DEPTH)/config/autoconf.mk
MODULE = test_places
XPCSHELL_TESTS = unit
ifdef MOZ_PLACES_BOOKMARKS
XPCSHELL_TESTS += bookmarks
endif
XPCSHELL_TESTS = unit \
bookmarks \
$(NULL)
ifdef MOZ_MOCHITEST
DIRS = chrome