Bug 436069 - Unify history, bookmarks, awesomebar search and remote tabs into a single UI [r=mfinkle]

This commit is contained in:
Vivien Nicolas 2010-08-24 10:42:28 +02:00
Родитель 322b108da6
Коммит 919d71df96
25 изменённых файлов: 547 добавлений и 442 удалений

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

@ -95,6 +95,9 @@ pref("network.http.max-persistent-connections-per-proxy", 4);
pref("network.autodial-helper.enabled", true);
#endif
/* history max results display */
pref("browser.display.history.maxresults", 100);
/* session history */
pref("browser.sessionhistory.max_total_viewers", 1);
pref("browser.sessionhistory.max_entries", 50);

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

@ -1227,7 +1227,6 @@ function GestureModule(owner, browserViewContainer) {
}
GestureModule.prototype = {
/**
* Dispatch events based on the type of mouse gesture event. For now, make
* sure to stop propagation of every gesture event so that web content cannot
@ -1350,3 +1349,4 @@ GestureModule.prototype = {
}
}
};

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

@ -231,7 +231,7 @@
}
function openRemoteTabs() {
getChromeWin().WeaveGlue.openRemoteTabs();
getChromeWin().CommandUpdater.doCommand("cmd_remoteTabs");
}
function goToAddons(aSearchString) {

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

@ -1,174 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
<!ENTITY % remoteTabsDTD SYSTEM "chrome://browser/locale/aboutTabs.dtd" >
%remoteTabsDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&remoteTabs.title;</title>
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
<link rel="stylesheet" href="chrome://browser/skin/aboutTabs.css" type="text/css"/>
</head>
<body onload="RemoteTabViewer.show();">
<div id="tabList">
</div>
<script type="application/javascript;version=1.8"><![CDATA[
// Make sure this is the only instance of the page
Components.utils.import("resource://services-sync/service.js");
Weave.Utils.ensureOneOpen(window);
const Cc = Components.classes;
const Ci = Components.interfaces;
let RemoteTabViewer = {
get chromeWin() {
let chromeWin = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem).
rootTreeItem.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindow).QueryInterface(Ci.nsIDOMChromeWindow);
delete this.chromeWin;
return this.chromeWin = chromeWin;
},
show: function RemoteTabViewer_show() {
// Don't do anything if the tabs engine isn't ready
if (!Weave.Engines.get("tabs"))
return;
this._maybeNotify();
this._populateTabs();
this._refetchTabs();
},
_maybeNotify: function _maybeNotify() {
// Don't notify if the tab engine has new tabs or the user dismissed it
let prefs = Weave.Svc.Prefs;
if (prefs.get("notifyTabState") == 0)
return;
// No need to reshow the notification if it's still open
let notifyBox = this.chromeWin.getNotificationBox(window);
if (notifyBox.getNotificationWithValue("remote-tabs") != null)
return;
let message = Weave.Str.sync.get("remote.notification.label");
let notification = notifyBox.appendNotification(message, "remote-tabs", "",
notifyBox.PRIORITY_INFO_LOW);
// Wrap the close function to find out if the user clicks the X
let close = notification.close;
notification.close = function() {
// Once the user dismisses the dialog, remember that and don't show again
prefs.set("notifyTabState", 0);
close.apply(notification, arguments);
};
},
_refetchTabs: function _refetchTabs() {
// Don't bother refetching tabs if we already did so recently
let lastFetch = Weave.Svc.Prefs.get("lastTabFetch", 0);
let now = Math.floor(Date.now() / 1000);
if (now - lastFetch < 30)
return;
// Asynchronously fetch the tabs
setTimeout(function() {
let engine = Weave.Engines.get("tabs");
let lastSync = engine.lastSync;
// Force a sync only for the tabs engine
engine.lastModified = null;
engine.sync();
Weave.Svc.Prefs.set("lastTabFetch", now);
// Only reload the page if something synced
if (engine.lastSync != lastSync)
location.reload();
}, 0);
},
_populateTabs: function _populateTabs() {
// Clear out all child elements from holder first, so we don't
// end up adding duplicate rows.
let engine = Weave.Engines.get("tabs");
let holder = document.getElementById("tabList");
if (holder.hasChildNodes()) {
while (holder.childNodes.length >= 1)
holder.removeChild(holder.firstChild);
}
// Generate the list of tabs
let haveTabs = false;
for (let [guid, client] in Iterator(engine.getAllClients())) {
haveTabs = true;
// Create the client node, but don't add it in-case we don't show any tabs
let appendClient = true;
let nameNode = document.createElement("h2");
nameNode.textContent = client.clientName;
client.tabs.forEach(function({title, urlHistory, icon}) {
let pageUrl = urlHistory[0];
// Skip tabs that are already open
if (engine.locallyOpenTabMatchesURL(pageUrl))
return;
if (title == "")
title = pageUrl;
let item = document.createElement("div");
item.addEventListener("click", function() {
item.setAttribute("selected", true);
RemoteTabViewer.chromeWin.BrowserUI.newTab(pageUrl);
}, false)
item.setAttribute("class", "tab");
let img = document.createElement("img");
img.setAttribute("class", "icon");
img.src = Weave.Utils.getIcon(icon, "chrome://browser/skin/images/tab.png");
let tabDiv = document.createElement("div");
tabDiv.setAttribute("class", "info");
let titleNode = document.createElement("div");
titleNode.setAttribute("class", "title");
titleNode.textContent = title;
let urlNode = document.createElement("div");
urlNode.setAttribute("class", "url");
urlNode.textContent = pageUrl;
tabDiv.appendChild(titleNode);
tabDiv.appendChild(urlNode);
item.appendChild(img);
item.appendChild(tabDiv);
// Append the client name if we haven't yet
if (appendClient) {
appendClient = false;
holder.appendChild(nameNode);
}
holder.appendChild(item);
});
}
if (holder.childNodes.length == 0) {
// Assume we're pending, but we might already have tabs or have synced
let text = Weave.Str.sync.get("remote.pending.label");
if (haveTabs)
text = Weave.Str.sync.get("remote.opened.label");
else if (engine.lastSync != 0)
text = Weave.Str.sync.get("remote.missing.label");
let item = document.createElement("h1");
item.textContent = text;
document.getElementsByTagName('body')[0].appendChild(item);
}
}
};
]]></script>
</body>
</html>

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

@ -34,10 +34,7 @@
<handlers>
<handler event="keypress" keycode="VK_RETURN" phase="capturing">
<![CDATA[
if (this.popup.allBookmarksItemSelected) {
this.popup.closePopup();
CommandUpdater.doCommand("cmd_bookmarks");
}
setTimeout(function() { BrowserUI.activePanel = null }, 0);
]]>
</handler>
<handler event="text" phase="bubbling"
@ -58,43 +55,38 @@
</binding>
<binding id="popup_autocomplete">
<content>
<xul:vbox class="autocomplete-box" flex="1">
<!-- 24 child items, to match browser.urlbar.maxRichResults -->
<xul:scrollbox orient="vertical"
class="autocomplete-items"
anonid="autocomplete-items"
flex="1000">
<xul:autocompleteresult anonid="allbookmarks"
value="&allBookmarks.label;"
class="allbookmarks"/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
</xul:scrollbox>
<children/>
</xul:vbox>
<content orient="vbox" class="autocomplete-box" flex="1">
<!-- 24 child items, to match browser.urlbar.maxRichResults -->
<xul:scrollbox orient="vertical"
class="autocomplete-items"
anonid="autocomplete-items"
flex="1000">
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
<xul:autocompleteresult/>
</xul:scrollbox>
<children/>
</content>
<implementation implements="nsIAutoCompletePopup">
@ -119,8 +111,7 @@
<field name="_selectedIndex">-1</field>
<field name="_selectedItem"/>
<property name="selectedIndex"
onget="return this._allBookmarksItem._hidden ? this._selectedIndex : this._selectedIndex - 1;">
<property name="selectedIndex" onget="return this._selectedIndex;">
<setter><![CDATA[
// Ignore invalid indices
if (val < -1 ||
@ -154,15 +145,9 @@
if (this._popupOpen)
return;
BrowserUI.pushDialog(this);
this._selectedItem = null;
this._input = aInput;
this._input.select();
if (this.hidden)
this.hidden = false;
this.collapsed = false;
this._popupOpen = true;
this.invalidate();
@ -180,16 +165,11 @@
this.selectedIndex = -1;
this.input.controller.stopSearch();
this.collapsed = true;
this._popupOpen = false;
let event = document.createEvent("Events");
event.initEvent("popuphidden", true, false);
this.dispatchEvent(event);
BrowserUI.showToolbar(false);
BrowserUI.popDialog();
]]></body>
</method>
@ -221,12 +201,6 @@
let searchString = controller.searchString;
let items = this._items;
// Remove the allBookmarksItem if present, before populating the list.
if (!this._allBookmarksItem._hidden) {
items.removeChild(this._allBookmarksItem);
this._allBookmarksItem._hidden = true;
}
// Need to iterate over all our existing entries at a minimum, to make
// sure they're either updated or cleared out. We might also have to
// add extra items.
@ -275,10 +249,6 @@
// Show the "no results" or "all bookmarks" entries as needed
this._updateNoResultsItem(matchCount);
if (searchString == "") {
items.insertBefore(this._allBookmarksItem, items.firstChild);
this._allBookmarksItem._hidden = false;
}
// Make sure the list is scrolled to the top
this.scrollToTop();
@ -291,8 +261,7 @@
let noResultsItem = this._items.childNodes.item(1);
if (isResults) {
noResultsItem.className = "";
}
else {
} else {
noResultsItem.className = "noresults";
noResultsItem.setAttribute("value", "]]>&noResults.label;<![CDATA[");
noResultsItem.removeAttribute("favorite");
@ -303,11 +272,6 @@
]]></body>
</method>
<field name="_allBookmarksItem">document.getAnonymousElementByAttribute(this, "anonid", "allbookmarks");</field>
<property name="allBookmarksItemSelected" readonly="true"
onget="return this._selectedItem == this._allBookmarksItem;"/>
<method name="selectBy">
<parameter name="aReverse"/>
<parameter name="aPage"/>
@ -339,8 +303,7 @@
<property name="_matchCount"
readonly="true">
<getter><![CDATA[
let matchCount = this.input.controller.matchCount;
return matchCount + (this._allBookmarksItem._hidden ? 0 : 1);
return this.input.controller.matchCount;
]]></getter>
</property>
@ -360,15 +323,10 @@
<handler event="click" button="0">
<![CDATA[
let target = event.originalTarget;
if (target == this._allBookmarksItem) {
this._selectedIndex = 0;
this.close();
CommandUpdater.doCommand("cmd_bookmarks");
}
else if (target.localName == "autocompleteresult" && !target._empty) {
let offset = this._allBookmarksItem._hidden ? 0 : 1;
this._selectedIndex = target._index + offset;
if (target.localName == "autocompleteresult" && !target._empty) {
this._selectedIndex = target._index;
this.input.controller.handleEnter(true);
BrowserUI.activePanel = null;
}
]]>
</handler>
@ -688,7 +646,7 @@
<handler event="click" button="0">
<![CDATA[
if (this.control)
this.control.openFolder(this.previousSibling.itemId);
this.control.open(this.previousSibling.itemId);
]]>
</handler>
</handlers>
@ -870,7 +828,7 @@
</body>
</method>
<method name="openFolder">
<method name="open">
<parameter name="aRootFolder"/>
<body>
<![CDATA[
@ -904,13 +862,13 @@
} while (folderId != PlacesUtils.bookmarks.placesRoot)
let children = this._children;
while (children.firstChild)
children.removeChild(children.firstChild);
while (children.lastChild)
children.removeChild(children.lastChild);
children.scrollBoxObject.scrollTo(0, 0);
let items = (aRootFolder == this._desktopFolderId) ? this._desktopChildren.concat()
: this._getChildren(aRootFolder);
: this._getChildren(aRootFolder);
if (aRootFolder == this.mobileRoot && !this.isDesktopFolderEmpty())
items.unshift(this._desktopFolder);
@ -961,9 +919,8 @@
return;
if (aItem.type == "folder") {
this.openFolder(aItem.itemId);
}
else {
this.open(aItem.itemId);
} else {
// Force the item to be active
this._activeItem = aItem;
@ -972,8 +929,9 @@
let event = document.createEvent("Events");
event.initEvent("BookmarkOpen", true, false);
this.dispatchEvent(event);
let func = new Function("event", this.getAttribute("onopen"));
func.call(this, event);
func.call(this, aEvent);
}
]]>
</body>
@ -981,6 +939,209 @@
</implementation>
</binding>
<binding id="history-list">
<handlers>
<handler event="click" button="0">
<![CDATA[
let func = new Function("event", this.getAttribute("onopen"));
func.call(this, event);
]]>
</handler>
</handlers>
<content orient="vertical" flex="1">
<xul:richlistbox anonid="child-items" class="history-list-children" flex="1" batch="25"/>
</content>
<implementation>
<method name="open">
<body><![CDATA[
let children = this._children;
while (children.lastChild)
children.removeChild(children.lastChild);
let items = this._getHistory();
children.setItems(items.map(this.createItem));
]]></body>
</method>
<field name="_children">
document.getAnonymousElementByAttribute(this, "anonid", "child-items");
</field>
<field name="scrollBoxObject">this._children.scrollBoxObject</field>
<method name="_getHistory">
<body><![CDATA[
let items = [];
let historyService = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
let query = historyService.getNewQuery();
let options = historyService.getNewQueryOptions();
options.excludeQueries = true;
options.queryType = options.QUERY_TYPE_HISTORY;
options.maxResults = Services.prefs.getIntPref("browser.display.history.maxresults");
options.resultType = options.RESULTS_AS_URI;
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
let result = historyService.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let childCount = rootNode.childCount;
// Get the rows title
let titleToday = PlacesUtils.getString("finduri-AgeInDays-is-0");
let titleYesterday = PlacesUtils.getString("finduri-AgeInDays-is-1");
let titleLastWeek = PlacesUtils.getFormattedString("finduri-AgeInDays-last-is", [7]);
let titleOlder = PlacesUtils.getFormattedString("finduri-AgeInDays-isgreater", [7]);
let lastTitle = null;
let msPerDay = 86400000;
let msPerWeek = msPerDay * 7;
let today = new Date(Date.now() - (Date.now() % msPerDay));
for (let i = 0; i < childCount; i++) {
let node = rootNode.getChild(i);
let time = new Date(node.time / 1000); // node.time is microseconds
// Insert a row title if needed
let msDelta = today - time;
if (msDelta < 0 && lastTitle == null) {
lastTitle = titleToday;
items.push({ title: lastTitle });
} else if (msDelta > 0 && msDelta < msPerDay && lastTitle != titleYesterday) {
lastTitle = titleYesterday;
items.push({ title: lastTitle });
} else if (msDelta > msPerDay && msDelta < msPerWeek && lastTitle != titleLastWeek) {
lastTitle = titleLastWeek;
items.push({ title: lastTitle });
} else if (msDelta > msPerWeek && lastTitle != titleOlder) {
lastTitle = titleOlder;
items.push({ title: lastTitle });
}
items.push(node);
}
rootNode.containerOpen = false;
return items;
]]></body>
</method>
<method name="createItem">
<parameter name="aItem"/>
<body>
<![CDATA[
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let child = document.createElementNS(XULNS, "autocompleteresult");
child.setAttribute("value", aItem.title || aItem.uri);
if (!aItem.uri) {
child.setAttribute("class", "history-item-title");
} else {
child.setAttribute("class", "history-item");
child.setAttribute("url", aItem.uri);
child.setAttribute("src", aItem.icon);
}
return child;
]]>
</body>
</method>
</implementation>
</binding>
<binding id="remotetabs-list">
<handlers>
<handler event="click" button="0">
<![CDATA[
let func = new Function("event", this.getAttribute("onopen"));
func.call(this, event);
]]>
</handler>
</handlers>
<content orient="vertical" flex="1">
<xul:richlistbox anonid="child-items" class="remotetabs-list-children" flex="1" batch="25"/>
</content>
<implementation>
<method name="open">
<body><![CDATA[
let children = this._children;
while (children.lastChild)
children.removeChild(children.lastChild);
let items = this._getRemoteTabs();
children.setItems(items.map(this.createItem));
]]></body>
</method>
<field name="_children">
document.getAnonymousElementByAttribute(this, "anonid", "child-items");
</field>
<field name="scrollBoxObject">this._children.scrollBoxObject</field>
<method name="_getRemoteTabs">
<body><![CDATA[
// Don't do anything if the tabs engine isn't ready
let engine = Weave.Engines.get("tabs");
if (!engine)
return [];
// Don't bother refetching tabs if we already did so recently
let lastFetch = Weave.Svc.Prefs.get("lastTabFetch", 0);
let now = Math.floor(Date.now() / 1000);
if (now - lastFetch >= 30) {
// Force a sync only for the tabs engine
engine.lastModified = null;
engine.sync();
Weave.Svc.Prefs.set("lastTabFetch", now);
};
// Generate the list of tabs
let tabs = [];
for (let [guid, client] in Iterator(engine.getAllClients())) {
tabs.push({ name: client.clientName });
client.tabs.forEach(function({title, urlHistory, icon}) {
let pageUrl = urlHistory[0];
// Skip tabs that are already open
if (engine.locallyOpenTabMatchesURL(pageUrl))
return;
tabs.push({
title: title ? pageUrl : title,
uri: pageUrl,
icon: Weave.Utils.getIcon(icon, "chrome://browser/skin/images/tab.png")
});
});
};
return tabs;
]]></body>
</method>
<method name="createItem">
<parameter name="aItem"/>
<body>
<![CDATA[
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let child = document.createElementNS(XULNS, "autocompleteresult");
child.setAttribute("value", aItem.title || aItem.name);
if (aItem.name) {
child.setAttribute("class", "remotetabs-item-title");
} else {
child.setAttribute("class", "remotetabs-item");
child.setAttribute("url", aItem.uri);
child.setAttribute("src", aItem.icon);
}
return child;
]]>
</body>
</method>
</implementation>
</binding>
<binding id="richlistbox-batch" extends="chrome://global/content/bindings/richlistbox.xml#richlistbox">
<handlers>
<handler event="scroll">

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

@ -217,11 +217,16 @@ var BrowserUI = {
}
},
updateAwesomeHeader: function updateAwesomeHeader(aVisible) {
document.getElementById('awesome-header').hidden = aVisible;
},
_closeOrQuit: function _closeOrQuit() {
// Close active dialog, if we have one. If not then close the application.
let dialog = this.activeDialog;
if (dialog) {
dialog.close();
if (this.activePanel) {
this.activePanel = null;
} else if (this.activeDialog) {
this.activeDialog.close();
} else {
// Check to see if we should really close the window
if (Browser.closing())
@ -229,6 +234,26 @@ var BrowserUI = {
}
},
_activePanel: null,
get activePanel() {
return this._activePanel;
},
set activePanel(aPanel) {
let container = document.getElementById("awesome-panels");
if (aPanel) {
container.hidden = false;
aPanel.open();
} else {
container.hidden = true;
BrowserUI.showToolbar(false);
}
if (this._activePanel)
this._activePanel.close();
this._activePanel = aPanel;
},
get activeDialog() {
// Return the topmost dialog
if (this._dialogs.length)
@ -333,8 +358,8 @@ var BrowserUI = {
// tabs
document.getElementById("tabs").resize();
// awesomebar
let popup = document.getElementById("popup_autocomplete");
// awesomebar and related panels
let popup = document.getElementById("awesome-panels");
popup.top = this.toolbarH;
popup.height = windowH - this.toolbarH;
popup.width = windowW;
@ -512,7 +537,7 @@ var BrowserUI = {
BrowserSearch.updateSearchButtons();
this._hidePopup();
this._edit.showHistoryPopup();
this.activePanel = AllPagesList;
},
closeAutoComplete: function closeAutoComplete(aResetInput) {
@ -538,6 +563,7 @@ var BrowserUI = {
// Give the new page lots of room
Browser.hideSidebars();
this.activePanel = null;
this.closeAutoComplete(false);
// Make sure we're online before attempting to load
@ -811,6 +837,8 @@ var BrowserUI = {
case "cmd_openLocation":
case "cmd_star":
case "cmd_bookmarks":
case "cmd_history":
case "cmd_remoteTabs":
case "cmd_quit":
case "cmd_close":
case "cmd_menu":
@ -839,7 +867,7 @@ var BrowserUI = {
},
doCommand : function(cmd) {
var browser = getBrowser();
let browser = getBrowser();
switch (cmd) {
case "cmd_back":
browser.goBack();
@ -892,7 +920,13 @@ var BrowserUI = {
break;
}
case "cmd_bookmarks":
BookmarkList.show();
this.activePanel = BookmarkList;
break;
case "cmd_history":
this.activePanel = HistoryList;
break;
case "cmd_remoteTabs":
this.activePanel = RemoteTabsList;
break;
case "cmd_quit":
goQuitApplication();
@ -1249,6 +1283,49 @@ var NewTabPopup = {
}
};
var AwesomePanel = function(aElementId, aCommandId) {
let items = document.getElementById(aElementId);
let command = document.getElementById(aCommandId);
this.open = function aw_open() {
BrowserUI.pushDialog(this);
command.setAttribute("checked", "true");
items.hidden = false;
if (items.hasAttribute("onshow")) {
let func = new Function("panel", items.getAttribute("onshow"));
func.call(items);
}
if (items.open)
items.open();
},
this.close = function aw_close() {
if (items.hasAttribute("onhide")) {
let func = new Function("panel", items.getAttribute("onhide"));
func.call(items);
}
if (items.close)
items.close();
items.blur();
items.hidden = true;
command.removeAttribute("checked", "true");
BrowserUI.popDialog();
},
this.openLink = function aw_openLink(aEvent) {
let item = aEvent.originalTarget;
let uri = item.getAttribute("url") || item.getAttribute("uri");
if (uri != "") {
BrowserUI.activePanel = null;
BrowserUI.goToURI(uri);
}
}
};
var BookmarkPopup = {
get box() {
let self = this;
@ -1356,50 +1433,18 @@ var BookmarkHelper = {
this._panel.hidden = true;
BrowserUI.popPopup();
},
};
var BookmarkList = {
_panel: null,
_bookmarks: null,
removeBookmarksForURI: function BH_removeBookmarksForURI(aURI) {
//XXX blargle xpconnect! might not matter, but a method on
// nsINavBookmarksService that takes an array of items to
// delete would be faster. better yet, a method that takes a URI!
let itemIds = PlacesUtils.getBookmarksForURI(aURI);
itemIds.forEach(PlacesUtils.bookmarks.removeItem);
get mobileRoot() {
let items = PlacesUtils.annotations.getItemsWithAnnotation("mobile/bookmarksRoot", {});
if (!items.length)
throw "Couldn't find mobile bookmarks root!";
delete this.mobileRoot;
return this.mobileRoot = items[0];
},
show: function() {
this._panel = document.getElementById("bookmarklist-container");
this._panel.width = window.innerWidth;
this._panel.height = window.innerHeight;
this._panel.hidden = false;
BrowserUI.pushDialog(this);
this._bookmarks = document.getElementById("bookmark-items");
this._bookmarks.openFolder();
},
close: function() {
BrowserUI.updateStar();
this._bookmarks.blur();
this._panel.hidden = true;
BrowserUI.popDialog();
},
openBookmark: function() {
let item = this._bookmarks.activeItem;
if (item.spec) {
this.close();
BrowserUI.goToURI(item.spec);
}
}
};
var FindHelperUI = {
type: "find",
commands: {
@ -1770,7 +1815,6 @@ var FormHelperUI = {
}
};
/**
* SelectHelperUI: Provides an interface for making a choice in a list.
* Supports simultaneous selection of choices and group headers.
@ -2201,12 +2245,29 @@ var SharingUI = {
};
function removeBookmarksForURI(aURI) {
//XXX blargle xpconnect! might not matter, but a method on
// nsINavBookmarksService that takes an array of items to
// delete would be faster. better yet, a method that takes a URI!
let itemIds = PlacesUtils.getBookmarksForURI(aURI);
itemIds.forEach(PlacesUtils.bookmarks.removeItem);
XPCOMUtils.defineLazyGetter(this, "HistoryList", function() {
return new AwesomePanel("history-items", "cmd_history");
});
XPCOMUtils.defineLazyGetter(this, "RemoteTabsList", function() {
return new AwesomePanel("remotetabs-items", "cmd_remoteTabs");
});
XPCOMUtils.defineLazyGetter(this, "AllPagesList", function() {
return new AwesomePanel("popup_autocomplete", "cmd_openLocation");
});
XPCOMUtils.defineLazyGetter(this, "BookmarkList", function() {
let list = new AwesomePanel("bookmarks-items", "cmd_bookmarks");
list.__defineGetter__("mobileRoot", function() {
let items = PlacesUtils.annotations.getItemsWithAnnotation("mobile/bookmarksRoot", {});
if (!items.length)
throw "Couldn't find mobile bookmarks root!";
delete this.mobileRoot;
return this.mobileRoot = items[0];
});
return list;
});
BrowserUI.updateStar();
}

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

@ -62,7 +62,7 @@ notification[type="geo"] {
-moz-binding: url("chrome://browser/content/bindings.xml#popup_autocomplete");
}
.autocomplete-items > autocompleteresult {
autocompleteresult {
-moz-binding: url("chrome://browser/content/bindings.xml#popup_autocomplete_result");
}
@ -89,6 +89,14 @@ placelist {
-moz-binding: url("chrome://browser/content/bindings.xml#place-list");
}
historylist {
-moz-binding: url("chrome://browser/content/bindings.xml#history-list");
}
remotetabslist {
-moz-binding: url("chrome://browser/content/bindings.xml#remotetabs-list");
}
placelabel {
-moz-binding: url("chrome://browser/content/bindings.xml#place-label");
}

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

@ -1892,6 +1892,7 @@ IdentityHandler.prototype = {
show: function ih_show() {
// dismiss any dialog which hide the identity popup
BrowserUI.activePanel = null;
while (BrowserUI.activeDialog)
BrowserUI.activeDialog.close();

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

@ -110,12 +110,12 @@
<command id="cmd_forceReload" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_stop" label="&stop.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_go" label="&go.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_openLocation" label="&openLocation.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_openLocation" oncommand="CommandUpdater.doCommand(this.id);"/>
<!-- tabs -->
<command id="cmd_newTab" label="&newtab.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_closeTab" label="&closetab.label;" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_remoteTabs" oncommand="WeaveGlue.openRemoteTabs();"/>
<command id="cmd_remoteTabs" oncommand="CommandUpdater.doCommand(this.id);" disabled="true"/>
<command id="cmd_undoCloseTab" oncommand="CommandUpdater.doCommand(this.id);"/>
<!-- bookmarking -->
@ -127,6 +127,8 @@
<command id="cmd_menu" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_actions" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_panel" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_bookmarks" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_history" oncommand="CommandUpdater.doCommand(this.id);"/>
<command id="cmd_sanitize" oncommand="CommandUpdater.doCommand(this.id);"/>
<!-- screen/display -->
@ -208,7 +210,6 @@
<vbox id="tabs" onselect="BrowserUI.selectTab(this);" onclosetab="BrowserUI.closeTab(this)" flex="1"/>
<hbox id="tabs-controls">
<toolbarbutton id="newtab-button" class="button-image" command="cmd_newTab"/>
<toolbarbutton id="remotetabs-button" class="button-image" disabled="true" command="cmd_remoteTabs"/>
</hbox>
</vbox>
</vbox>
@ -242,6 +243,7 @@
completeselectedindex="true"
minresultsforpopup="0"
oncontextmenu="event.preventDefault();"
onsearchbegin="BrowserUI.updateAwesomeHeader(this.controller.searchString != '');"
emptytext="&urlbar.emptytext;"
flex="1"
ontextentered="BrowserUI.goToURI();"
@ -353,7 +355,7 @@
<vbox>
<button id="bookmark-popup-edit" label="&bookmarkEdit.label;" class="button-dark" oncommand="BookmarkHelper.edit();"/>
<spacer/>
<button id="bookmark-popup-remove" label="&bookmarkRemove.label;" class="button-dark" oncommand="BookmarkPopup.hide(); removeBookmarksForURI(getBrowser().currentURI);"/>
<button id="bookmark-popup-remove" label="&bookmarkRemove.label;" class="button-dark" oncommand="BookmarkPopup.hide(); BookmarkHelper.removeBookmarksForURI(getBrowser().currentURI);"/>
</vbox>
</vbox>
@ -489,27 +491,32 @@
</deck>
</box>
<!-- titlebar autocomplete results -->
<vbox id="popup_autocomplete" class="panel-dark" hidden="true">
<arrowscrollbox id="autocomplete_navbuttons"
style="-moz-user-focus: ignore;"
align="center"
flex="1"
orient="horizontal">
<image class="tool-search"/>
<radiogroup id="search-buttons" class="toggle-dark" style="-moz-user-focus: ignore;"
onclick="BrowserUI.doButtonSearch(event.target);">
</radiogroup>
</arrowscrollbox>
</vbox>
<!-- bookmark window -->
<vbox id="bookmarklist-container" class="panel-dark" hidden="true">
<hbox id="bookmarklist-header">
<description flex="1">&bookmarksHeader.label;</description>
<toolbarbutton id="tool-bookmarks-close" class="urlbar-button button-image" command="cmd_close"/>
<vbox id="awesome-panels" hidden="true">
<!-- Awesome header row -->
<hbox id="awesome-header">
<toolbarbutton type="radio" group="awesome-header" label="&allPagesHeader.label;" command="cmd_openLocation" class="choice-all show-text" checked="true"/>
<toolbarbutton type="radio" group="awesome-header" label="&bookmarksHeader.label;" command="cmd_bookmarks" class="choice-bookmarks show-text"/>
<toolbarbutton type="radio" group="awesome-header" label="&historyHeader.label;" command="cmd_history" class="choice-history show-text"/>
<toolbarbutton type="radio" group="awesome-header" label="&desktopHeader.label;" command="cmd_remoteTabs" class="choice-remotetabs show-text"/>
</hbox>
<placelist id="bookmark-items" type="bookmarks" flex="1" onopen="BookmarkList.openBookmark();" autoedit="true"/>
<!-- titlebar autocomplete results -->
<vbox id="popup_autocomplete" class="panel-dark" flex="1" onshow="BrowserUI._edit.showHistoryPopup();" hidden="true">
<arrowscrollbox id="autocomplete_navbuttons"
style="-moz-user-focus: ignore;"
align="center"
flex="1"
orient="horizontal">
<image class="tool-search"/>
<radiogroup id="search-buttons" class="toggle-dark" style="-moz-user-focus: ignore;"
onclick="BrowserUI.doButtonSearch(event.target);">
</radiogroup>
</arrowscrollbox>
</vbox>
<placelist id="bookmarks-items" type="bookmarks" onopen="BookmarkList.openLink(event);" onhide="BrowserUI.updateStar();" flex="1" hidden="true"/>
<historylist id="history-items" onopen="HistoryList.openLink(event);" flex="1" hidden="true"/>
<remotetabslist id="remotetabs-items" onopen="RemoteTabsList.openLink(event)" flex="1" hidden="true"/>
</vbox>
<!-- options dialog for select form field -->

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

@ -47,10 +47,6 @@ let WeaveGlue = {
Weave.Service.keyGenEnabled = false;
},
openRemoteTabs: function openRemoteTabs() {
BrowserUI.newOrSelectTab("about:sync-tabs", null);
},
connect: function connect() {
if (this._settings.user.value != Weave.Service.username)
Weave.Service.startOver();
@ -103,7 +99,7 @@ let WeaveGlue = {
_updateOptions: function _updateOptions() {
let loggedIn = Weave.Service.isLoggedIn;
document.getElementById("remotetabs-button").disabled = !loggedIn;
document.getElementById("cmd_remoteTabs").setAttribute("disabled", !loggedIn);
// Make sure we're online when connecting/syncing
Util.forceOnline();

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

@ -15,7 +15,6 @@ chrome.jar:
content/aboutCertError.xhtml (content/aboutCertError.xhtml)
content/aboutCertError.css (content/aboutCertError.css)
content/aboutHome.xhtml (content/aboutHome.xhtml)
content/aboutTabs.xhtml (content/aboutTabs.xhtml)
content/languages.properties (content/languages.properties)
* content/browser.xul (content/browser.xul)
* content/browser.js (content/browser.js)

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

@ -67,10 +67,6 @@ let modules = {
home: {
uri: "chrome://browser/content/aboutHome.xhtml",
privileged: true
},
"sync-tabs": {
uri: "chrome://browser/content/aboutTabs.xhtml",
privileged: true
}
}
@ -145,12 +141,6 @@ AboutHome.prototype = {
classID: Components.ID("{b071364f-ab68-4669-a9db-33fca168271a}")
}
function AboutSyncTabs() {}
AboutSyncTabs.prototype = {
__proto__: AboutGeneric.prototype,
classID: Components.ID("{d503134a-f6f3-4824-bc3c-09c123177944}")
}
const components = [AboutFirstrun, AboutFennec, AboutRights,
AboutCertError, AboutFirefox, AboutHome, AboutSyncTabs];
AboutCertError, AboutFirefox, AboutHome];
const NSGetFactory = XPCOMUtils.generateNSGetFactory(components);

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

@ -1 +0,0 @@
<!ENTITY remoteTabs.title "Tabs from my other computers">

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

@ -5,7 +5,6 @@
<!ENTITY reload.label "Reload">
<!ENTITY stop.label "Stop">
<!ENTITY go.label "Go">
<!ENTITY openLocation.label "Open location">
<!ENTITY star.label "Star">
<!ENTITY newtab.label "New Tab">
@ -20,7 +19,10 @@
<!ENTITY noSuggestions.label "(No suggestions)">
<!ENTITY addToDictionary.label "Add to Dictionary">
<!ENTITY allPagesHeader.label "All Pages">
<!ENTITY bookmarksHeader.label "Bookmarks">
<!ENTITY historyHeader.label "History">
<!ENTITY desktopHeader.label "Desktop">
<!ENTITY editBookmarkDone.label "Done">
<!ENTITY editBookmarkTags.label "Add tags here">

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

@ -5,7 +5,6 @@
locale/@AB_CD@/browser/about.dtd (%chrome/about.dtd)
locale/@AB_CD@/browser/aboutCertError.dtd (%chrome/aboutCertError.dtd)
locale/@AB_CD@/browser/aboutHome.dtd (%chrome/aboutHome.dtd)
locale/@AB_CD@/browser/aboutTabs.dtd (%chrome/aboutTabs.dtd)
locale/@AB_CD@/browser/browser.dtd (%chrome/browser.dtd)
locale/@AB_CD@/browser/browser.properties (%chrome/browser.properties)
locale/@AB_CD@/browser/config.dtd (%chrome/config.dtd)

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

@ -1,50 +0,0 @@
body {
color: black;
font-family: "Nokia Sans", Tahoma, Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
}
h1 {
font-size: 24px;
text-align: center;
}
h2 {
background-color: lightgray;
font-size: 24px;
font-weight: bold;
margin: 0;
padding: 8px;
}
.tab {
border-bottom: solid 1px rgb(207, 207, 207);
min-height: 70px;
padding-right: 32px;
position: relative;
}
.tab[selected] {
background-color: #8db8d8;
}
.icon {
height: 32px;
left: 16px;
position: absolute;
top: 4px;
width: 32px;
}
.info {
margin-left: 32px;
overflow: hidden;
padding-left: 32px;
white-space: nowrap;
}
.title {
font-size: 24px;
margin-top: 4px;
}
.url {
color: blue;
font-size: 18px;
margin-top: 4px;
}

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

@ -739,6 +739,8 @@ placeitem {
autocompleteresult:active,
placelist placeitem:active:not([selected="true"]),
historylist placeitem:active:not([selected="true"]):not([class="history-item-title"]),
historylist placeitem:active:not([selected="true"]):not([class="remotetabs-item-title"]),
.autocompleteresult-selected {
background-color: #8db8d8;
}
@ -800,7 +802,29 @@ placeitem[src=""] .bookmark-item-label > image {
-moz-margin-end: 24px;
}
/* special "no results" and "all bookmarks" items */
/* special "no results", "awesome header row" and "title rows" items */
autocompleteresult[class="history-item-title"],
autocompleteresult[class="remotetabs-item-title"] {
-moz-box-pack: center;
background-color: #E9E9E9;
min-height: 0px;
}
autocompleteresult[class="history-item-title"] .bookmark-item-url,
autocompleteresult[class="remotetabs-item-title"] .bookmark-item-url {
display: none;
}
autocompleteresult[class="history-item-title"] .bookmark-item-label,
autocompleteresult[class="remotetabs-item-title"] .bookmark-item-label {
font-size: 24px !important;
}
autocompleteresult[class="history-item-title"] image,
autocompleteresult[class="remotetabs-item-title"] image {
display: none;
}
autocompleteresult.noresults {
font-style: italic;
border-bottom: none;
@ -815,36 +839,117 @@ autocompleteresult.noresults > .autocomplete-item-label {
color: grey;
}
autocompleteresult.allbookmarks {
-moz-box-pack: center;
background: #E9E9E9 url("images/arrowright-16.png") no-repeat 98% 50%;
#awesome-header {
min-height: 70px; /* row size */
}
autocompleteresult.allbookmarks:-moz-locale-dir(rtl) {
background: #E9E9E9 url("images/arrowleft-16.png") no-repeat 2% 50%;
#awesome-header > toolbarbutton {
-moz-user-focus: ignore;
-moz-user-select: none;
-moz-appearance: none;
color: white;
font-weight: bold;
border: 1px solid #36373b;
border-left-width: 0;
background-color: #797979;
-moz-box-flex: 1;
}
autocompleteresult.allbookmarks:active,
autocompleteresult.allbookmarks.autocompleteresult-selected {
background-color: #8db8d8;
@media (max-width: 499px) {
#awesome-header > toolbarbutton {
-moz-box-orient: vertical;
}
#awesome-header > toolbarbutton .toolbarbutton-text {
font-size: 18px !important;
}
}
autocompleteresult.allbookmarks > .autocomplete-item-label {
font-size: 24px !important;
#awesome-header > toolbarbutton:last-child {
border-right-width: 0;
}
autocompleteresult.allbookmarks > .autocomplete-item-label > image {
width: 44px;
height: 30px;
margin-top: 0;
margin-bottom: 0;
-moz-margin-end: 12px;
-moz-margin-start: 0;
list-style-image: url(images/bookmarks-30.png);
#awesome-header > toolbarbutton:hover,
#awesome-header > toolbarbutton:hover,
#awesome-header > toolbarbutton:hover:active,
#awesome-header > toolbarbutton[checked="true"] {
border-color: #36373b !important;
color: white !important;
background: -moz-radial-gradient(#757575, #636363, #666769) !important;
}
autocompleteresult.allbookmarks > .autocomplete-item-url {
display: none;
#awesome-header > toolbarbutton[checked="true"],
#awesome-header > toolbarbutton[disabled="true"] {
pointer-events: none;
}
#awesome-header > toolbarbutton[disabled="true"] .toolbarbutton-icon {
opacity: 0.5;
}
#awesome-header > toolbarbutton[disabled="true"] .toolbarbutton-text {
color: #aaa;
}
#awesome-header > toolbarbutton .toolbarbutton-icon {
min-width: 48px;
min-height: 48px;
}
#awesome-header > toolbarbutton .toolbarbutton-text {
text-align: left;
}
#awesome-header > toolbarbutton.choice-bookmarks {
list-style-image: url(chrome://browser/skin/images/bookmarks-48.png);
}
#awesome-header > toolbarbutton.choice-history {
list-style-image: url(chrome://browser/skin/images/history-48.png);
}
#awesome-header > toolbarbutton.choice-remotetabs {
list-style-image: url(chrome://browser/skin/images/remotetabs-48.png);
}
#awesome-header > toolbarbutton:hover:active,
#awesome-header > toolbarbutton[checked="true"] {
border-color: #36373b !important;
color: white !important;
background: -moz-radial-gradient(#757575, #636363, #666769) !important;
}
#awesome-header > toolbarbutton[checked="true"],
#awesome-header > toolbarbutton[disabled="true"] {
pointer-events: none;
}
#awesome-header > toolbarbutton[disabled="true"] .toolbarbutton-icon {
opacity: 0.5;
}
#awesome-header > toolbarbutton[disabled="true"] .toolbarbutton-text {
color: #aaa;
}
#awesome-header > toolbarbutton .toolbarbutton-icon {
min-width: 48px;
min-height: 48px;
}
#awesome-header > toolbarbutton .toolbarbutton-text {
text-align: left;
}
#awesome-header > toolbarbutton.choice-bookmarks {
list-style-image: url(chrome://browser/skin/images/bookmarks-48.png);
}
#awesome-header > toolbarbutton.choice-history {
list-style-image: url(chrome://browser/skin/images/history-48.png);
}
#awesome-header > toolbarbutton.choice-remotetabs {
list-style-image: url(chrome://browser/skin/images/remotetabs-48.png);
}
/* Left sidebar (tabs) ---------------------------------------------------- */

Двоичные данные
mobile/themes/core/images/bookmarks-30.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

Двоичные данные
mobile/themes/core/images/bookmarks-48.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.3 KiB

Двоичные данные
mobile/themes/core/images/history-48.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.0 KiB

Двоичные данные
mobile/themes/core/images/remotetabs-48.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.9 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.5 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 1.6 KiB

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

@ -6,7 +6,6 @@ chrome.jar:
skin/aboutPage.css (aboutPage.css)
skin/about.css (about.css)
skin/aboutHome.css (aboutHome.css)
skin/aboutTabs.css (aboutTabs.css)
skin/config.css (config.css)
skin/firstRun.css (firstRun.css)
skin/header.css (header.css)
@ -52,9 +51,10 @@ chrome.jar:
skin/images/back-default-64.png (images/back-default-64.png)
skin/images/back-active-64.png (images/back-active-64.png)
skin/images/back-disabled-64.png (images/back-disabled-64.png)
skin/images/history-48.png (images/history-48.png)
skin/images/bookmark-default-64.png (images/bookmark-default-64.png)
skin/images/bookmark-active-64.png (images/bookmark-active-64.png)
skin/images/bookmarks-30.png (images/bookmarks-30.png)
skin/images/bookmarks-48.png (images/bookmarks-48.png)
skin/images/bookmarked-default-64.png (images/bookmarked-default-64.png)
skin/images/bookmarked-active-64.png (images/bookmarked-active-64.png)
skin/images/forward-default-64.png (images/forward-default-64.png)
@ -74,10 +74,8 @@ chrome.jar:
skin/images/console-active-64.png (images/console-active-64.png)
skin/images/newtab-default-64.png (images/newtab-default-64.png)
skin/images/newtab-active-64.png (images/newtab-active-64.png)
skin/images/remotetabs-default-64.png (images/remotetabs-default-64.png)
skin/images/remotetabs-active-64.png (images/remotetabs-active-64.png)
skin/images/remotetabs-disabled-64.png (images/remotetabs-disabled-64.png)
skin/images/remotetabs-32.png (images/remotetabs-32.png)
skin/images/remotetabs-48.png (images/remotetabs-48.png)
skin/images/tab-32.png (images/tab-32.png)
skin/images/mozilla-32.png (images/mozilla-32.png)
skin/images/leftcap-default-64.png (images/leftcap-default-64.png)