Bug 1437940 - include Chrome Beta and Chrome Dev in migration list on Linux, r?dthayer draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 01 Mar 2018 14:03:06 +0000
changeset 763250 44ed4aa2753c2bf4c20248dfb78fe63be499129a
parent 763109 51200c0fdaddb2749549a82596da5323a4cbd499
child 763251 2d0c6ed2aeb45f39c9b4adc521cd82a540d6d590
push id101377
push usergijskruitbosch@gmail.com
push dateMon, 05 Mar 2018 16:49:00 +0000
reviewersdthayer
bugs1437940
milestone60.0a1
Bug 1437940 - include Chrome Beta and Chrome Dev in migration list on Linux, r?dthayer MozReview-Commit-ID: HDTkdXdYos3
browser/components/migration/BrowserProfileMigrators.manifest
browser/components/migration/ChromeMigrationUtils.jsm
browser/components/migration/ChromeProfileMigrator.js
browser/components/migration/MigrationUtils.jsm
browser/components/migration/content/migration.xul
browser/locales/en-US/chrome/browser/migration/migration.dtd
browser/locales/en-US/chrome/browser/migration/migration.properties
--- a/browser/components/migration/BrowserProfileMigrators.manifest
+++ b/browser/components/migration/BrowserProfileMigrators.manifest
@@ -1,14 +1,19 @@
 component {6F8BB968-C14F-4D6F-9733-6C6737B35DCE} ProfileMigrator.js
 contract @mozilla.org/toolkit/profile-migrator;1 {6F8BB968-C14F-4D6F-9733-6C6737B35DCE}
 
 #if defined(XP_WIN) || defined(XP_MACOSX)
 component {4bf85aa5-4e21-46ca-825f-f9c51a5e8c76} ChromeProfileMigrator.js
 contract @mozilla.org/profile/migrator;1?app=browser&type=canary {4bf85aa5-4e21-46ca-825f-f9c51a5e8c76}
+#else
+component {47f75963-840b-4950-a1f0-d9c1864f8b8e} ChromeProfileMigrator.js
+contract @mozilla.org/profile/migrator;1?app=browser&type=chrome-beta {47f75963-840b-4950-a1f0-d9c1864f8b8e}
+component {7370a02a-4886-42c3-a4ec-d48c726ec30a} ChromeProfileMigrator.js
+contract @mozilla.org/profile/migrator;1?app=browser&type=chrome-dev {7370a02a-4886-42c3-a4ec-d48c726ec30a}
 #endif
 component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
 contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
 component {8cece922-9720-42de-b7db-7cef88cb07ca} ChromeProfileMigrator.js
 contract @mozilla.org/profile/migrator;1?app=browser&type=chromium {8cece922-9720-42de-b7db-7cef88cb07ca}
 
 component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js
 contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386}
--- a/browser/components/migration/ChromeMigrationUtils.jsm
+++ b/browser/components/migration/ChromeMigrationUtils.jsm
@@ -222,16 +222,18 @@ var ChromeMigrationUtils = {
       },
       macosx: {
         Chrome: ["Google", "Chrome"],
         Chromium: ["Chromium"],
         Canary: ["Google", "Chrome Canary"],
       },
       linux: {
         Chrome: ["google-chrome"],
+        "Chrome Beta": ["google-chrome-beta"],
+        "Chrome Dev": ["google-chrome-unstable"],
         Chromium: ["chromium"],
         // Canary is not available on Linux.
       },
     };
     let dirKey, subfolders;
     subfolders = SUB_DIRECTORIES[AppConstants.platform][chromeProjectName];
     if (!subfolders) {
       return null;
--- a/browser/components/migration/ChromeProfileMigrator.js
+++ b/browser/components/migration/ChromeProfileMigrator.js
@@ -483,9 +483,32 @@ CanaryProfileMigrator.prototype = Object
 CanaryProfileMigrator.prototype.classDescription = "Chrome Canary Profile Migrator";
 CanaryProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=canary";
 CanaryProfileMigrator.prototype.classID = Components.ID("{4bf85aa5-4e21-46ca-825f-f9c51a5e8c76}");
 
 if (AppConstants.platform == "win" || AppConstants.platform == "macosx") {
   componentsArray.push(CanaryProfileMigrator);
 }
 
+/**
+ * Chrome Dev / Unstable and Beta. Only separate from `regular` chrome on Linux
+ */
+if (AppConstants.platform != "win" && AppConstants.platform != "macosx") {
+  function ChromeDevMigrator() {
+    this._chromeUserDataPathSuffix = "Chrome Dev";
+  }
+  ChromeDevMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
+  ChromeDevMigrator.prototype.classDescription = "Chrome Dev Profile Migrator";
+  ChromeDevMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=chrome-dev";
+  ChromeDevMigrator.prototype.classID = Components.ID("{7370a02a-4886-42c3-a4ec-d48c726ec30a}");
+
+  function ChromeBetaMigrator() {
+    this._chromeUserDataPathSuffix = "Chrome Beta";
+  }
+  ChromeBetaMigrator.prototype = Object.create(ChromeProfileMigrator.prototype);
+  ChromeBetaMigrator.prototype.classDescription = "Chrome Beta Profile Migrator";
+  ChromeBetaMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta";
+  ChromeBetaMigrator.prototype.classID = Components.ID("{47f75963-840b-4950-a1f0-d9c1864f8b8e}");
+
+  componentsArray.push(ChromeDevMigrator, ChromeBetaMigrator);
+}
+
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory(componentsArray);
--- a/browser/components/migration/MigrationUtils.jsm
+++ b/browser/components/migration/MigrationUtils.jsm
@@ -52,17 +52,17 @@ XPCOMUtils.defineLazyGetter(this, "gAvai
       "firefox", "edge", "ie", "chrome", "chromium", "360se",
       "canary",
     ];
   }
   if (AppConstants.platform == "macosx") {
     return ["firefox", "safari", "chrome", "chromium", "canary"];
   }
   if (AppConstants.XP_UNIX) {
-    return ["firefox", "chrome", "chromium"];
+    return ["firefox", "chrome", "chrome-beta", "chrome-dev", "chromium"];
   }
   return [];
 });
 
 function getMigrationBundle() {
   if (!gMigrationBundle) {
     gMigrationBundle = Services.strings.createBundle(
      "chrome://browser/locale/migration/migration.properties");
@@ -513,17 +513,17 @@ var MigrationUtils = Object.freeze({
    *        The key of the string to retrieve.
    * @param aReplacements
    *        [optioanl] Array of replacements to run on the retrieved string.
    * @return the retrieved string.
    *
    * @see nsIStringBundle
    */
   getLocalizedString: function MU_getLocalizedString(aKey, aReplacements) {
-    aKey = aKey.replace(/_(canary|chromium)$/, "_chrome");
+    aKey = aKey.replace(/_(canary|chromium|chrome-beta|chrome-dev)$/, "_chrome");
 
     const OVERRIDES = {
       "4_firefox": "4_firefox_history_and_bookmarks",
       "64_firefox": "64_firefox_other",
     };
     aKey = OVERRIDES[aKey] || aKey;
 
     if (aReplacements === undefined)
@@ -539,16 +539,20 @@ var MigrationUtils = Object.freeze({
       case "ie":
         return "sourceNameIE";
       case "safari":
         return "sourceNameSafari";
       case "canary":
         return "sourceNameCanary";
       case "chrome":
         return "sourceNameChrome";
+      case "chrome-beta":
+        return "sourceNameChromeBeta";
+      case "chrome-dev":
+        return "sourceNameChromeDev";
       case "chromium":
         return "sourceNameChromium";
       case "firefox":
         return "sourceNameFirefox";
       case "360se":
         return "sourceName360se";
     }
     return null;
--- a/browser/components/migration/content/migration.xul
+++ b/browser/components/migration/content/migration.xul
@@ -42,16 +42,18 @@
       <radio id="360se"     label="&importFrom360se.label;"     accesskey="&importFrom360se.accesskey;"/>
 #elifdef XP_MACOSX
       <radio id="safari"    label="&importFromSafari.label;"    accesskey="&importFromSafari.accesskey;"/>
       <radio id="chrome"    label="&importFromChrome.label;"    accesskey="&importFromChrome.accesskey;"/>
       <radio id="chromium"  label="&importFromChromium.label;"  accesskey="&importFromChromium.accesskey;"/>
       <radio id="canary"    label="&importFromCanary.label;"    accesskey="&importFromCanary.accesskey;"/>
 #elifdef XP_UNIX
       <radio id="chrome"    label="&importFromChrome.label;"    accesskey="&importFromChrome.accesskey;"/>
+      <radio id="chrome-beta" label="&importFromChromeBeta.label;" accesskey="&importFromChromeBeta.accesskey;"/>
+      <radio id="chrome-dev"  label="&importFromChromeDev.label;"  accesskey="&importFromChromeDev.accesskey;"/>
       <radio id="chromium"  label="&importFromChromium.label;"  accesskey="&importFromChromium.accesskey;"/>
 #endif
       <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>
--- a/browser/locales/en-US/chrome/browser/migration/migration.dtd
+++ b/browser/locales/en-US/chrome/browser/migration/migration.dtd
@@ -16,16 +16,20 @@
 <!ENTITY importFromNothing.label        "Don’t import anything">
 <!ENTITY importFromNothing.accesskey    "D">
 <!ENTITY importFromSafari.label         "Safari">
 <!ENTITY importFromSafari.accesskey     "S">
 <!ENTITY importFromCanary.label         "Chrome Canary">
 <!ENTITY importFromCanary.accesskey     "n">
 <!ENTITY importFromChrome.label         "Chrome">
 <!ENTITY importFromChrome.accesskey     "C">
+<!ENTITY importFromChromeBeta.label     "Chrome Beta">
+<!ENTITY importFromChromeBeta.accesskey "B">
+<!ENTITY importFromChromeDev.label      "Chrome Dev">
+<!ENTITY importFromChromeDev.accesskey  "D">
 <!ENTITY importFromChromium.label       "Chromium">
 <!ENTITY importFromChromium.accesskey   "u">
 <!ENTITY importFromFirefox.label        "Firefox">
 <!ENTITY importFromFirefox.accesskey    "X">
 <!ENTITY importFrom360se.label          "360 Secure Browser">
 <!ENTITY importFrom360se.accesskey      "3">
 
 <!ENTITY noMigrationSources.label       "No programs that contain bookmarks, history or password data could be found.">
--- a/browser/locales/en-US/chrome/browser/migration/migration.properties
+++ b/browser/locales/en-US/chrome/browser/migration/migration.properties
@@ -5,16 +5,18 @@
 profileName_format=%S %S
 
 # Browser Specific
 sourceNameIE=Internet Explorer
 sourceNameEdge=Microsoft Edge
 sourceNameSafari=Safari
 sourceNameCanary=Google Chrome Canary
 sourceNameChrome=Google Chrome
+sourceNameChromeBeta=Google Chrome Beta
+sourceNameChromeDev=Google Chrome Dev
 sourceNameChromium=Chromium
 sourceNameFirefox=Mozilla Firefox
 sourceName360se=360 Secure Browser
 
 importedBookmarksFolder=From %S
 
 importedSafariReadingList=Reading List (From Safari)
 importedEdgeReadingList=Reading List (From Edge)