Bug 706005 - Chrome migrator notifies user to close browser. r=MattN

--HG--
extra : commitid : 5oD1YL5zeLw
extra : rebase_source : 24a99b34f8bfa458b2db0f79ffd1335a40e7dd15
This commit is contained in:
Bernardo P. Rittmeyer 2015-08-07 23:36:32 -07:00
parent 0d3715764d
commit e2a7d78267
6 changed files with 42 additions and 7 deletions

View File

@ -184,6 +184,13 @@ Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
}
});
Object.defineProperty(ChromeProfileMigrator.prototype, "sourceLocked", {
get: function Chrome_sourceLocked() {
// There is an exclusive lock on some SQLite databases. Assume they are locked for now.
return true;
},
});
function GetBookmarksResource(aProfileFolder) {
let bookmarksFile = aProfileFolder.clone();
bookmarksFile.append("Bookmarks");

View File

@ -167,6 +167,12 @@ this.MigratorPrototype = {
*/
get sourceHomePageURL() "",
/**
* Override if the data to migrate is locked/in-use and the user should
* probably shutdown the source browser.
*/
get sourceLocked() false,
/**
* DO NOT OVERRIDE - After deCOMing migration, the UI will just call
* getResources.

View File

@ -64,6 +64,15 @@ var MigrationWizard = {
// 1 - Import Source
onImportSourcePageShow: function ()
{
// Show warning message to close the selected browser when needed
function toggleCloseBrowserWarning() {
let visibility = "hidden";
if (group.selectedItem.id != "nothing") {
let migrator = MigrationUtils.getMigrator(group.selectedItem.id);
visibility = migrator.sourceLocked ? "visible" : "hidden";
}
document.getElementById("closeSourceBrowser").style.visibility = visibility;
}
this._wiz.canRewind = false;
var selectedMigrator = null;
@ -86,9 +95,12 @@ var MigrationWizard = {
}
}
if (selectedMigrator)
group.addEventListener("command", toggleCloseBrowserWarning);
if (selectedMigrator) {
group.selectedItem = selectedMigrator;
else {
toggleCloseBrowserWarning();
} else {
// We didn't find a migrator, notify the user
document.getElementById("noSources").hidden = false;

View File

@ -52,6 +52,8 @@
<radio id="nothing" label="&importFromNothing.label;" accesskey="&importFromNothing.accesskey;" hidden="true"/>
</radiogroup>
<label id="noSources" hidden="true">&noMigrationSources.label;</label>
<spacer flex="1"/>
<description class="header" id="closeSourceBrowser" style="visibility:hidden">&closeSourceBrowser.label;</description>
</wizardpage>
<wizardpage id="selectProfile" pageid="selectProfile" label="&selectProfile.title;"

View File

@ -8,7 +8,7 @@
interface nsIArray;
interface nsIProfileStartup;
[scriptable, uuid(30e5a7ec-f71e-4f41-9dbd-7429c02132ec)]
[scriptable, uuid(22b56ffc-3149-43c5-b5a9-b3a6b678de93)]
interface nsIBrowserProfileMigrator : nsISupports
{
/**
@ -43,16 +43,16 @@ interface nsIBrowserProfileMigrator : nsISupports
*/
unsigned short getMigrateData(in jsval aProfile, in boolean aDoingStartup);
/**
* Whether or not there is any data that can be imported from this
/**
* Whether or not there is any data that can be imported from this
* browser (i.e. whether or not it is installed, and there exists
* a user profile)
*/
readonly attribute boolean sourceExists;
/**
* An enumeration of available profiles. If the import source does
/**
* An enumeration of available profiles. If the import source does
* not support profiles, this attribute is null.
*/
readonly attribute jsval sourceProfiles;
@ -61,4 +61,11 @@ interface nsIBrowserProfileMigrator : nsISupports
* The import source homepage. Returns null if not present/available
*/
readonly attribute AUTF8String sourceHomePageURL;
/**
* Whether the source browser data is locked/in-use meaning migration likely
* won't succeed and the user should be warned.
*/
readonly attribute boolean sourceLocked;
};

View File

@ -43,3 +43,4 @@
<!ENTITY done.title "Import Complete">
<!ENTITY done.label "The following items were successfully imported:">
<!ENTITY closeSourceBrowser.label "Please ensure the selected browser is closed before continuing.">