summaryrefslogtreecommitdiffstats
path: root/application/basilisk/components/customizableui
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-04-17 20:22:59 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-04-17 20:22:59 +0200
commit3eb4310cd889e6c8d22c27f0326273acf0a3e8bf (patch)
tree508827a64a5ad5c2d465535afea68eee39775a11 /application/basilisk/components/customizableui
parent07381c3edad8ec24b5d820ec0592e0cafa7d73fa (diff)
parent1e868fadf94935bcb4a49ea5eec776d84fe2d1e7 (diff)
downloadUXP-3eb4310cd889e6c8d22c27f0326273acf0a3e8bf.tar
UXP-3eb4310cd889e6c8d22c27f0326273acf0a3e8bf.tar.gz
UXP-3eb4310cd889e6c8d22c27f0326273acf0a3e8bf.tar.lz
UXP-3eb4310cd889e6c8d22c27f0326273acf0a3e8bf.tar.xz
UXP-3eb4310cd889e6c8d22c27f0326273acf0a3e8bf.zip
Merge branch 'Sync-weave'
Diffstat (limited to 'application/basilisk/components/customizableui')
-rw-r--r--application/basilisk/components/customizableui/CustomizableUI.jsm1
-rw-r--r--application/basilisk/components/customizableui/CustomizableWidgets.jsm138
-rw-r--r--application/basilisk/components/customizableui/content/panelUI.inc.xul110
-rw-r--r--application/basilisk/components/customizableui/moz.build5
4 files changed, 4 insertions, 250 deletions
diff --git a/application/basilisk/components/customizableui/CustomizableUI.jsm b/application/basilisk/components/customizableui/CustomizableUI.jsm
index cb0f519b2..31126b37c 100644
--- a/application/basilisk/components/customizableui/CustomizableUI.jsm
+++ b/application/basilisk/components/customizableui/CustomizableUI.jsm
@@ -200,7 +200,6 @@ var CustomizableUIInternal = {
"find-button",
"preferences-button",
"add-ons-button",
- "sync-button",
];
if (!AppConstants.MOZ_DEV_EDITION) {
diff --git a/application/basilisk/components/customizableui/CustomizableWidgets.jsm b/application/basilisk/components/customizableui/CustomizableWidgets.jsm
index 401b7ca74..9e8f0ec78 100644
--- a/application/basilisk/components/customizableui/CustomizableWidgets.jsm
+++ b/application/basilisk/components/customizableui/CustomizableWidgets.jsm
@@ -286,144 +286,6 @@ const CustomizableWidgets = [
log.debug("History view is being hidden!");
}
}, {
- id: "sync-button",
- label: "remotetabs-panelmenu.label",
- tooltiptext: "remotetabs-panelmenu.tooltiptext2",
- type: "view",
- viewId: "PanelUI-remotetabs",
- defaultArea: CustomizableUI.AREA_PANEL,
- deckIndices: {
- DECKINDEX_TABS: 0,
- DECKINDEX_TABSDISABLED: 1,
- DECKINDEX_FETCHING: 2,
- DECKINDEX_NOCLIENTS: 3,
- },
- onCreated(aNode) {
- // Add an observer to the button so we get the animation during sync.
- // (Note the observer sets many attributes, including label and
- // tooltiptext, but we only want the 'syncstatus' attribute for the
- // animation)
- let doc = aNode.ownerDocument;
- let obnode = doc.createElementNS(kNSXUL, "observes");
- obnode.setAttribute("element", "sync-status");
- obnode.setAttribute("attribute", "syncstatus");
- aNode.appendChild(obnode);
- },
- setDeckIndex(index) {
- let deck = this._tabsList.ownerDocument.getElementById("PanelUI-remotetabs-deck");
- // We call setAttribute instead of relying on the XBL property setter due
- // to things going wrong when we try and set the index before the XBL
- // binding has been created - see bug 1241851 for the gory details.
- deck.setAttribute("selectedIndex", index);
- },
-
- _showTabsPromise: Promise.resolve(),
- // Update the tab list after any existing in-flight updates are complete.
- _showTabs() {
- this._showTabsPromise = this._showTabsPromise.then(() => {
- return this.__showTabs();
- });
- },
- // Return a new promise to update the tab list.
- __showTabs() {
- let doc = this._tabsList.ownerDocument;
- return SyncedTabs.getTabClients().then(clients => {
- // The view may have been hidden while the promise was resolving.
- if (!this._tabsList) {
- return;
- }
- if (clients.length === 0 && !SyncedTabs.hasSyncedThisSession) {
- // the "fetching tabs" deck is being shown - let's leave it there.
- // When that first sync completes we'll be notified and update.
- return;
- }
-
- if (clients.length === 0) {
- this.setDeckIndex(this.deckIndices.DECKINDEX_NOCLIENTS);
- return;
- }
-
- this.setDeckIndex(this.deckIndices.DECKINDEX_TABS);
- this._clearTabList();
- SyncedTabs.sortTabClientsByLastUsed(clients, 50 /* maxTabs */);
- let fragment = doc.createDocumentFragment();
-
- for (let client of clients) {
- // add a menu separator for all clients other than the first.
- if (fragment.lastChild) {
- let separator = doc.createElementNS(kNSXUL, "menuseparator");
- fragment.appendChild(separator);
- }
- this._appendClient(client, fragment);
- }
- this._tabsList.appendChild(fragment);
- }).catch(err => {
- Cu.reportError(err);
- }).then(() => {
- // an observer for tests.
- Services.obs.notifyObservers(null, "synced-tabs-menu:test:tabs-updated", null);
- });
- },
- _clearTabList () {
- let list = this._tabsList;
- while (list.lastChild) {
- list.lastChild.remove();
- }
- },
- _showNoClientMessage() {
- this._appendMessageLabel("notabslabel");
- },
- _appendMessageLabel(messageAttr, appendTo = null) {
- if (!appendTo) {
- appendTo = this._tabsList;
- }
- let message = this._tabsList.getAttribute(messageAttr);
- let doc = this._tabsList.ownerDocument;
- let messageLabel = doc.createElementNS(kNSXUL, "label");
- messageLabel.textContent = message;
- appendTo.appendChild(messageLabel);
- return messageLabel;
- },
- _appendClient: function (client, attachFragment) {
- let doc = attachFragment.ownerDocument;
- // Create the element for the remote client.
- let clientItem = doc.createElementNS(kNSXUL, "label");
- clientItem.setAttribute("itemtype", "client");
- let window = doc.defaultView;
- clientItem.setAttribute("tooltiptext",
- window.gSyncUI.formatLastSyncDate(new Date(client.lastModified)));
- clientItem.textContent = client.name;
-
- attachFragment.appendChild(clientItem);
-
- if (client.tabs.length == 0) {
- let label = this._appendMessageLabel("notabsforclientlabel", attachFragment);
- label.setAttribute("class", "PanelUI-remotetabs-notabsforclient-label");
- } else {
- for (let tab of client.tabs) {
- let tabEnt = this._createTabElement(doc, tab);
- attachFragment.appendChild(tabEnt);
- }
- }
- },
- _createTabElement(doc, tabInfo) {
- let item = doc.createElementNS(kNSXUL, "toolbarbutton");
- let tooltipText = (tabInfo.title ? tabInfo.title + "\n" : "") + tabInfo.url;
- item.setAttribute("itemtype", "tab");
- item.setAttribute("class", "subviewbutton");
- item.setAttribute("targetURI", tabInfo.url);
- item.setAttribute("label", tabInfo.title != "" ? tabInfo.title : tabInfo.url);
- item.setAttribute("image", tabInfo.icon);
- item.setAttribute("tooltiptext", tooltipText);
- // We need to use "click" instead of "command" here so openUILink
- // respects different buttons (eg, to open in a new tab).
- item.addEventListener("click", e => {
- doc.defaultView.openUILink(tabInfo.url, e);
- CustomizableUI.hidePanelForNode(item);
- });
- return item;
- },
- }, {
id: "privatebrowsing-button",
shortcutId: "key_privatebrowsing",
defaultArea: CustomizableUI.AREA_PANEL,
diff --git a/application/basilisk/components/customizableui/content/panelUI.inc.xul b/application/basilisk/components/customizableui/content/panelUI.inc.xul
index 8ebd93327..da8077554 100644
--- a/application/basilisk/components/customizableui/content/panelUI.inc.xul
+++ b/application/basilisk/components/customizableui/content/panelUI.inc.xul
@@ -20,27 +20,6 @@
oncommand="gMenuButtonUpdateBadge.onMenuPanelCommand(event);"
wrap="true"
hidden="true"/>
- <hbox id="PanelUI-footer-fxa">
- <hbox id="PanelUI-fxa-status"
- defaultlabel="&fxaSignIn.label;"
- signedinTooltiptext="&syncSettings.label;"
- tooltiptext="&syncSettings.label;"
- errorlabel="&fxaSignInError.label;"
- unverifiedlabel="&fxaUnverified.label;"
- settingslabel="&syncSettings.label;"
- onclick="if (event.which == 1) gFxAccounts.onMenuPanelCommand();">
- <image id="PanelUI-fxa-avatar"/>
- <toolbarbutton id="PanelUI-fxa-label"
- fxabrandname="&syncBrand.fxAccount.label;"/>
- </hbox>
- <toolbarseparator/>
- <toolbarbutton id="PanelUI-fxa-icon"
- oncommand="gSyncUI.doSync();"
- closemenu="none">
- <observes element="sync-status" attribute="syncstatus"/>
- <observes element="sync-status" attribute="tooltiptext"/>
- </toolbarbutton>
- </hbox>
<hbox id="PanelUI-footer-inner">
<toolbarbutton id="PanelUI-customize" label="&appMenuCustomize.label;"
@@ -103,95 +82,6 @@
oncommand="PlacesCommandHook.showPlacesOrganizer('History'); CustomizableUI.hidePanelForNode(this);"/>
</panelview>
- <panelview id="PanelUI-remotetabs" flex="1" class="PanelUI-subView">
- <label value="&appMenuRemoteTabs.label;" class="panel-subview-header"/>
- <vbox class="panel-subview-body">
- <!-- this widget has 3 boxes in the body, but only 1 is ever visible -->
- <!-- When Sync is ready to sync -->
- <vbox id="PanelUI-remotetabs-main" observes="sync-syncnow-state">
- <vbox id="PanelUI-remotetabs-buttons">
- <toolbarbutton id="PanelUI-remotetabs-view-sidebar"
- class="subviewbutton"
- oncommand="BrowserOpenSyncTabs();"
- label="&appMenuRemoteTabs.sidebar.label;"/>
- <toolbarbutton id="PanelUI-remotetabs-syncnow"
- observes="sync-status"
- class="subviewbutton"
- oncommand="gSyncUI.doSync();"
- closemenu="none"/>
- <menuseparator id="PanelUI-remotetabs-separator"/>
- </vbox>
- <deck id="PanelUI-remotetabs-deck">
- <!-- Sync is ready to Sync and the "tabs" engine is enabled -->
- <vbox id="PanelUI-remotetabs-tabspane">
- <vbox id="PanelUI-remotetabs-tabslist"
- notabsforclientlabel="&appMenuRemoteTabs.notabs.label;"
- />
- </vbox>
- <!-- Sync is ready to Sync but the "tabs" engine isn't enabled-->
- <hbox id="PanelUI-remotetabs-tabsdisabledpane" pack="center" flex="1">
- <vbox class="PanelUI-remotetabs-instruction-box">
- <hbox pack="center">
- <image class="fxaSyncIllustration" alt=""/>
- </hbox>
- <label class="PanelUI-remotetabs-instruction-label">&appMenuRemoteTabs.tabsnotsyncing.label;</label>
- <hbox pack="center">
- <toolbarbutton class="PanelUI-remotetabs-prefs-button"
- label="&appMenuRemoteTabs.openprefs.label;"
- oncommand="gSyncUI.openSetup(null, 'synced-tabs');"/>
- </hbox>
- </vbox>
- </hbox>
- <!-- Sync is ready to Sync but we are still fetching the tabs to show -->
- <vbox id="PanelUI-remotetabs-fetching">
- <!-- Show intentionally blank panel, see bug 1239845 -->
- </vbox>
- <!-- Sync has only 1 (ie, this) device connected -->
- <hbox id="PanelUI-remotetabs-nodevicespane" pack="center" flex="1">
- <vbox class="PanelUI-remotetabs-instruction-box">
- <hbox pack="center">
- <image class="fxaSyncIllustration" alt=""/>
- </hbox>
- <label class="PanelUI-remotetabs-instruction-title">&appMenuRemoteTabs.noclients.title;</label>
- <label class="PanelUI-remotetabs-instruction-label">&appMenuRemoteTabs.noclients.subtitle;</label>
- <!-- The inner HTML for PanelUI-remotetabs-mobile-promo is built at runtime -->
- <label id="PanelUI-remotetabs-mobile-promo" fxAccountsBrand="&syncBrand.fxAccount.label;"/>
- </vbox>
- </hbox>
- </deck>
- </vbox>
- <!-- a box to ensure contained boxes are centered horizonally -->
- <hbox pack="center" flex="1">
- <!-- When Sync is not configured -->
- <vbox id="PanelUI-remotetabs-setupsync"
- flex="1"
- align="center"
- class="PanelUI-remotetabs-instruction-box"
- observes="sync-setup-state">
- <image class="fxaSyncIllustration" alt=""/>
- <label class="PanelUI-remotetabs-instruction-label">&appMenuRemoteTabs.notsignedin.label;</label>
- <toolbarbutton class="PanelUI-remotetabs-prefs-button"
- label="&appMenuRemoteTabs.signin.label;"
- oncommand="gSyncUI.openSetup(null, 'synced-tabs');"/>
- </vbox>
- <!-- When Sync needs re-authentication. This uses the exact same messaging
- as "Sync is not configured" but remains a separate box so we get
- the goodness of observing broadcasters to manage the hidden states -->
- <vbox id="PanelUI-remotetabs-reauthsync"
- flex="1"
- align="center"
- class="PanelUI-remotetabs-instruction-box"
- observes="sync-reauth-state">
- <image class="fxaSyncIllustration" alt=""/>
- <label class="PanelUI-remotetabs-instruction-label">&appMenuRemoteTabs.notsignedin.label;</label>
- <toolbarbutton class="PanelUI-remotetabs-prefs-button"
- label="&appMenuRemoteTabs.signin.label;"
- oncommand="gSyncUI.openSetup(null, 'synced-tabs');"/>
- </vbox>
- </hbox>
- </vbox>
- </panelview>
-
<panelview id="PanelUI-bookmarks" flex="1" class="PanelUI-subView">
<label value="&bookmarksMenu.label;" class="panel-subview-header"/>
<vbox class="panel-subview-body">
diff --git a/application/basilisk/components/customizableui/moz.build b/application/basilisk/components/customizableui/moz.build
index 034630dc9..5797a03b0 100644
--- a/application/basilisk/components/customizableui/moz.build
+++ b/application/basilisk/components/customizableui/moz.build
@@ -9,7 +9,6 @@ DIRS += [
]
EXTRA_JS_MODULES += [
- 'CustomizableUI.jsm',
'CustomizableWidgets.jsm',
'CustomizeMode.jsm',
'DragPositionManager.jsm',
@@ -17,5 +16,9 @@ EXTRA_JS_MODULES += [
'ScrollbarSampler.jsm',
]
+EXTRA_PP_JS_MODULES += [
+ 'CustomizableUI.jsm',
+]
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1