зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1221050 - part 5: create page for use with tabview migration, r=ttaubert
--HG-- rename : browser/components/sessionstore/content/aboutSessionRestore.xhtml => browser/base/content/aboutTabGroupsMigration.xhtml extra : commitid : E9PZnr7z9hO extra : rebase_source : e3c38469a98bb008075110e4e7d4af1e151511f3
This commit is contained in:
Родитель
c3904f5023
Коммит
781be4fb9c
|
@ -0,0 +1,63 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
|
||||
Cu.import("resource:///modules/TabGroupsMigrator.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
|
||||
const SUPPORT_URL = "https://support.mozilla.org/kb/tab-groups-removal";
|
||||
|
||||
function fillInDescription() {
|
||||
let descElement = document.getElementById("mainDescription");
|
||||
let text = descElement.getAttribute("_description_label");
|
||||
let learnMoreText = descElement.getAttribute("_learnmore_label");
|
||||
let link = document.createElement("a");
|
||||
link.href = SUPPORT_URL;
|
||||
link.target = "_blank";
|
||||
link.textContent = learnMoreText;
|
||||
// We don't want to assign the label (plaintext, because we took it out of
|
||||
// getAttribute, so html entities have been resolved) directly to innerHTML.
|
||||
// Using a separate element and then using innerHTML on that would mean we
|
||||
// depend on the HTML encoding (or lack thereof) of %S, which l10n tools
|
||||
// might change.
|
||||
// So instead, split the plaintext we have and create textNodes:
|
||||
let nodes = text.split(/%S/).map(document.createTextNode.bind(document));
|
||||
// then insert the link:
|
||||
nodes.splice(1, 0, link);
|
||||
// then append all of these in turn:
|
||||
for (let node of nodes) {
|
||||
descElement.appendChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
let loadPromise = new Promise(resolve => {
|
||||
let loadHandler = e => {
|
||||
window.removeEventListener("DOMContentLoaded", loadHandler);
|
||||
fillInDescription();
|
||||
resolve();
|
||||
};
|
||||
window.addEventListener("DOMContentLoaded", loadHandler, false);
|
||||
});
|
||||
|
||||
let tabGroupsBookmarkItemId;
|
||||
// If the session wasn't restored this run/session, this might be null.
|
||||
// Then we shouldn't show the button:
|
||||
if (TabGroupsMigrator.bookmarkedGroupsPromise) {
|
||||
let bookmarkPromise = TabGroupsMigrator.bookmarkedGroupsPromise.then(bm => {
|
||||
return PlacesUtils.promiseItemId(bm.guid);
|
||||
}).then(itemId => { tabGroupsBookmarkItemId = itemId });
|
||||
|
||||
Promise.all([bookmarkPromise, loadPromise]).then(function() {
|
||||
document.getElementById("show-migrated-bookmarks-button").style.removeProperty("display");
|
||||
});
|
||||
}
|
||||
|
||||
function showMigratedGroups() {
|
||||
let browserWin = getBrowserWindow();
|
||||
browserWin.PlacesCommandHook.showPlacesOrganizer(["BookmarksMenu", tabGroupsBookmarkItemId]);
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<!DOCTYPE html [
|
||||
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
|
||||
%htmlDTD;
|
||||
<!ENTITY % netErrorDTD SYSTEM "chrome://global/locale/netError.dtd">
|
||||
%netErrorDTD;
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
%globalDTD;
|
||||
<!ENTITY % restorepageDTD SYSTEM "chrome://browser/locale/aboutSessionRestore.dtd">
|
||||
%restorepageDTD;
|
||||
]>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<head>
|
||||
<title>&tabgroupsmigration.tabtitle;</title>
|
||||
<link rel="stylesheet" href="chrome://global/skin/in-content/info-pages.css" type="text/css" media="all"/>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutSessionRestore.css" type="text/css" media="all"/>
|
||||
<link rel="icon" type="image/png" href="chrome://global/skin/icons/warning-16.png"/>
|
||||
|
||||
<script type="application/javascript;version=1.8" src="chrome://browser/content/aboutSessionRestore.js"/>
|
||||
<script type="application/javascript;version=1.8" src="chrome://browser/content/aboutTabGroupsMigration.js"/>
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;">
|
||||
|
||||
<div class="container restore-chosen">
|
||||
|
||||
<div class="title">
|
||||
<h1 class="title-text">&tabgroupsmigration.pagetitle;</h1>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p id="mainDescription"
|
||||
_learnmore_label="&tabgroupsmigration.learnMoreLink;"
|
||||
_description_label="&tabgroupsmigration.description;"></p>
|
||||
<button id="show-migrated-bookmarks-button" style="display:none" onclick="showMigratedGroups()">&tabgroupsmigration.bookmarkbutton;</button>
|
||||
|
||||
<p>&tabgroupsmigration.restoredescription;</p>
|
||||
</div>
|
||||
<div class="tree-container" available="true">
|
||||
<xul:tree id="tabList" seltype="single" hidecolumnpicker="true"
|
||||
onclick="onListClick(event);" onkeydown="onListKeyDown(event);"
|
||||
_window_label="&restorepage.windowLabel;">
|
||||
<xul:treecols>
|
||||
<xul:treecol cycler="true" id="restore" type="checkbox" label="&restorepage.restoreHeader;"/>
|
||||
<xul:splitter class="tree-splitter"/>
|
||||
<xul:treecol primary="true" id="title" label="&restorepage.listHeader;" flex="1"/>
|
||||
</xul:treecols>
|
||||
<xul:treechildren flex="1"/>
|
||||
</xul:tree>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
#ifdef XP_UNIX
|
||||
<xul:button id="errorCancel"
|
||||
label="&restorepage.closeButton;"
|
||||
accesskey="&restorepage.close.access;"
|
||||
oncommand="startNewSession();"/>
|
||||
<xul:button class="primary"
|
||||
id="errorTryAgain"
|
||||
label="&restorepage.tryagainButton;"
|
||||
accesskey="&restorepage.restore.access;"
|
||||
oncommand="restoreSession();"/>
|
||||
#else
|
||||
<xul:button class="primary"
|
||||
id="errorTryAgain"
|
||||
label="&restorepage.tryagainButton;"
|
||||
accesskey="&restorepage.restore.access;"
|
||||
oncommand="restoreSession();"/>
|
||||
<xul:button id="errorCancel"
|
||||
label="&restorepage.closeButton;"
|
||||
accesskey="&restorepage.close.access;"
|
||||
oncommand="startNewSession();"/>
|
||||
#endif
|
||||
</div>
|
||||
<!-- holds the session data for when the tab is closed -->
|
||||
<input type="text" id="sessionData" style="display: none;"/>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -72,6 +72,8 @@ browser.jar:
|
|||
content/browser/aboutTabCrashed.css (content/aboutTabCrashed.css)
|
||||
content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js)
|
||||
content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml)
|
||||
* content/browser/aboutTabGroupsMigration.xhtml (content/aboutTabGroupsMigration.xhtml)
|
||||
content/browser/aboutTabGroupsMigration.js (content/aboutTabGroupsMigration.js)
|
||||
* content/browser/browser.css (content/browser.css)
|
||||
* content/browser/browser.js (content/browser.js)
|
||||
* content/browser/browser.xul (content/browser.xul)
|
||||
|
|
|
@ -70,7 +70,7 @@ function initTreeView() {
|
|||
gTreeData = [];
|
||||
gStateObject.windows.forEach(function(aWinData, aIx) {
|
||||
var winState = {
|
||||
label: winLabel.replace("%S", (aIx + 1)),
|
||||
label: aWinData.tabGroupsMigrationTitle || winLabel.replace("%S", (aIx + 1)),
|
||||
open: true,
|
||||
checked: true,
|
||||
ix: aIx
|
||||
|
|
|
@ -48,3 +48,17 @@ their language.
|
|||
<!ENTITY welcomeback2.afterlink.pageInfo2 "">
|
||||
|
||||
<!ENTITY welcomeback2.link.pageInfo2 "learn more about what you can do.">
|
||||
|
||||
<!-- LOCALIZATION NOTE: The following 'tabgroupsmigration' strings are for
|
||||
the tab groups (panorama) migration page, not about:sessionrestore -->
|
||||
<!ENTITY tabgroupsmigration.tabtitle "Migrate your other Tab Groups">
|
||||
<!ENTITY tabgroupsmigration.pagetitle "Tab Groups are no more. Sorry.">
|
||||
<!-- LOCALIZATION NOTE (tabgroupsmigration.learnMoreLink):
|
||||
This is inserted into tabgroupsmigration.description. -->
|
||||
<!ENTITY tabgroupsmigration.learnMoreLink "Learn More">
|
||||
<!-- LOCALIZATION NOTE (tabgroupsmigration.description):
|
||||
%S will be replaced with a link labeled with tabgroupsmigration.learnMoreLink -->
|
||||
<!ENTITY tabgroupsmigration.description "&brandShortName; has bookmarked all your groups, so you have not lost anything. %S">
|
||||
<!ENTITY tabgroupsmigration.bookmarkbutton "Show Bookmarked Tab Groups">
|
||||
<!ENTITY tabgroupsmigration.restoredescription "You can also choose to restore some or all background groups into windows now:">
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ XPCOMUtils.defineLazyGetter(this, "gBrowserBundle", function() {
|
|||
return Services.strings.createBundle('chrome://browser/locale/browser.properties');
|
||||
});
|
||||
|
||||
const RECOVERY_URL = "chrome://browser/content/aboutTabGroupsMigration.xhtml";
|
||||
|
||||
|
||||
this.TabGroupsMigrator = {
|
||||
bookmarkedGroupsPromise: null,
|
||||
|
@ -235,7 +237,11 @@ this.TabGroupsMigrator = {
|
|||
},
|
||||
|
||||
_createBackgroundTabGroupRestorationPage(state, backgroundData) {
|
||||
// TODO
|
||||
let win = state.windows[(state.selectedWindow || 1) - 1];
|
||||
let formdata = {id: {sessionData: JSON.stringify(backgroundData)}, url: RECOVERY_URL};
|
||||
let newTab = { entries: [{url: RECOVERY_URL}], formdata, index: 1 };
|
||||
// Add tab and mark it as selected:
|
||||
win.selected = win.tabs.push(newTab);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче