mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-30 20:37:31 +09:00
Mypal portable mode
This commit is contained in:
parent
32c50fd018
commit
633ef1c426
24 changed files with 299 additions and 25 deletions
|
|
@ -16,7 +16,8 @@ Cu.import("resource://gre/modules/AsyncPrefs.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
XPCOMUtils.defineLazyServiceGetter(this, "WindowsUIUtils", "@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils");
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-service;1", "nsIAlertsService");
|
XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-service;1", "nsIAlertsService");
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(this, "winShellService",
|
||||||
|
"@mozilla.org/browser/shell-service;1","nsIWindowsShellService");
|
||||||
// lazy module getters
|
// lazy module getters
|
||||||
[
|
[
|
||||||
["AboutHome", "resource:///modules/AboutHome.jsm"],
|
["AboutHome", "resource:///modules/AboutHome.jsm"],
|
||||||
|
|
@ -1029,6 +1030,8 @@ BrowserGlue.prototype = {
|
||||||
isDefaultError = true;
|
isDefaultError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var profService = Cc["@mozilla.org/toolkit/profile-service;1"].getService(Ci.nsIToolkitProfileService);
|
||||||
|
if (profService.portable()!=1) {
|
||||||
if (isDefault) {
|
if (isDefault) {
|
||||||
let now = (Math.floor(Date.now() / 1000)).toString();
|
let now = (Math.floor(Date.now() / 1000)).toString();
|
||||||
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
||||||
|
|
@ -1059,7 +1062,7 @@ BrowserGlue.prototype = {
|
||||||
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow());
|
||||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}}
|
||||||
|
|
||||||
E10SAccessibilityCheck.onWindowsRestored();
|
E10SAccessibilityCheck.onWindowsRestored();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -550,6 +550,8 @@ var gMainPane = {
|
||||||
defaultBrowserBox.hidden = true;
|
defaultBrowserBox.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var profService = Components.classes["@mozilla.org/toolkit/profile-service;1"].getService(Components.interfaces.nsIToolkitProfileService);
|
||||||
|
if (profService.portable()==1) return;
|
||||||
let setDefaultPane = document.getElementById("setDefaultPane");
|
let setDefaultPane = document.getElementById("setDefaultPane");
|
||||||
let isDefault = shellSvc.isDefaultBrowser(false, true);
|
let isDefault = shellSvc.isDefaultBrowser(false, true);
|
||||||
setDefaultPane.selectedIndex = isDefault ? 1 : 0;
|
setDefaultPane.selectedIndex = isDefault ? 1 : 0;
|
||||||
|
|
@ -568,10 +570,34 @@ var gMainPane = {
|
||||||
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
|
let alwaysCheckPref = document.getElementById("browser.shell.checkDefaultBrowser");
|
||||||
alwaysCheckPref.value = true;
|
alwaysCheckPref.value = true;
|
||||||
|
|
||||||
|
|
||||||
let shellSvc = getShellService();
|
let shellSvc = getShellService();
|
||||||
|
var profService = Components.classes["@mozilla.org/toolkit/profile-service;1"].getService(Components.interfaces.nsIToolkitProfileService);
|
||||||
|
let isPortable;
|
||||||
if (!shellSvc)
|
if (!shellSvc)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
|
isPortable = profService.portable();
|
||||||
|
if (isPortable==1) {
|
||||||
|
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
||||||
|
var win = RecentWindow.getMostRecentBrowserWindow();
|
||||||
|
var brandBundle = win.document.getElementById("bundle_brand");
|
||||||
|
var shellBundle = win.document.getElementById("bundle_shell");
|
||||||
|
|
||||||
|
var brandShortName = brandBundle.getString("brandShortName");
|
||||||
|
var promptTitle = shellBundle.getString("PortablemodeTitle");
|
||||||
|
var promptMessage = shellBundle.getFormattedString("PortablemodeMessage",
|
||||||
|
[brandShortName]);
|
||||||
|
// var checkEveryTime = { value: shouldCheck };
|
||||||
|
var ps = Services.prompt;
|
||||||
|
var rv = ps.confirmEx(win, promptTitle, promptMessage,
|
||||||
|
ps.STD_YES_NO_BUTTONS,
|
||||||
|
null, null, null, null, { });//, checkboxLabel, checkEveryTime);
|
||||||
|
if (rv == 0) {
|
||||||
|
shellSvc.cancelPortableMode();
|
||||||
|
isPortable=28;
|
||||||
|
} else return;
|
||||||
|
}
|
||||||
shellSvc.setDefaultBrowser(true, false);
|
shellSvc.setDefaultBrowser(true, false);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
Cu.reportError(ex);
|
Cu.reportError(ex);
|
||||||
|
|
@ -580,6 +606,7 @@ var gMainPane = {
|
||||||
|
|
||||||
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
let selectedIndex = shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
||||||
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
|
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
|
||||||
|
if (isPortable==28) Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestartNotSameProfile);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
[scriptable, uuid(f8a26b94-49e5-4441-8fbc-315e0b4f22ef)]
|
[scriptable, uuid(f8a26b94-49e5-4441-8fbc-315e0b4f22ef)]
|
||||||
interface nsIWindowsShellService : nsIShellService
|
interface nsIWindowsShellService : nsIShellService
|
||||||
{
|
{
|
||||||
|
void cancelPortableMode();
|
||||||
/**
|
/**
|
||||||
* Provides the shell service an opportunity to do some Win7+ shortcut
|
* Provides the shell service an opportunity to do some Win7+ shortcut
|
||||||
* maintenance needed on initial startup of the browser.
|
* maintenance needed on initial startup of the browser.
|
||||||
|
|
|
||||||
|
|
@ -369,6 +369,31 @@ IsDefaultBrowserWin8(bool aCheckAllTypes, bool* aIsDefaultBrowser)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsWindowsShellService::CancelPortableMode()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFile> portmodemark;
|
||||||
|
|
||||||
|
rv = NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
|
||||||
|
getter_AddRefs(portmodemark));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
rv = portmodemark->AppendNative(NS_LITERAL_CSTRING("pmprt.mod"));
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
bool fileExists;
|
||||||
|
rv = portmodemark->Exists(&fileExists);
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
if (fileExists)
|
||||||
|
portmodemark->Remove(false);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Query's the AAR for the default status.
|
* Query's the AAR for the default status.
|
||||||
* This only checks for BasiliskURL and if aCheckAllTypes is set, then
|
* This only checks for BasiliskURL and if aCheckAllTypes is set, then
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ Var AddDesktopSC
|
||||||
Var InstallMaintenanceService
|
Var InstallMaintenanceService
|
||||||
Var PageName
|
Var PageName
|
||||||
Var PreventRebootRequired
|
Var PreventRebootRequired
|
||||||
|
Var PrtChkb
|
||||||
|
|
||||||
; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for
|
; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for
|
||||||
; an application's Start Menu PROGRAMS directory and doesn't define the
|
; an application's Start Menu PROGRAMS directory and doesn't define the
|
||||||
|
|
@ -289,6 +290,15 @@ Section "-Application" APP_IDX
|
||||||
"$(ERROR_CREATE_DIRECTORY_PREFIX)" \
|
"$(ERROR_CREATE_DIRECTORY_PREFIX)" \
|
||||||
"$(ERROR_CREATE_DIRECTORY_SUFFIX)"
|
"$(ERROR_CREATE_DIRECTORY_SUFFIX)"
|
||||||
|
|
||||||
|
${If} $InstallType == ${INSTALLTYPE_PORTABLE}
|
||||||
|
${If} $PrtChkb == 1
|
||||||
|
FileOpen $0 "$INSTDIR\browser\pmprt.mod" w
|
||||||
|
FileClose $0
|
||||||
|
${Else}
|
||||||
|
FileOpen $0 "$INSTDIR\browser\pmundprt.mod" w
|
||||||
|
FileClose $0
|
||||||
|
${EndIf}
|
||||||
|
${Else}
|
||||||
; Register DLLs
|
; Register DLLs
|
||||||
; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but
|
; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but
|
||||||
; is only registered for the last application installed. When the last
|
; is only registered for the last application installed. When the last
|
||||||
|
|
@ -538,6 +548,7 @@ Section "-Application" APP_IDX
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${EndUnless}
|
${EndUnless}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
; Cleanup operations to perform at the end of the installation.
|
; Cleanup operations to perform at the end of the installation.
|
||||||
|
|
@ -856,6 +867,12 @@ Function leaveOptions
|
||||||
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State"
|
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State"
|
||||||
StrCmp $R0 "1" +1 +2
|
StrCmp $R0 "1" +1 +2
|
||||||
StrCpy $InstallType ${INSTALLTYPE_CUSTOM}
|
StrCpy $InstallType ${INSTALLTYPE_CUSTOM}
|
||||||
|
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 6" "State"
|
||||||
|
StrCmp $R0 "1" +1 +2
|
||||||
|
StrCpy $InstallType ${INSTALLTYPE_PORTABLE}
|
||||||
|
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 7" "State"
|
||||||
|
StrCmp $R0 "1" +1 +2
|
||||||
|
StrCpy $PrtChkb 1
|
||||||
|
|
||||||
${LeaveOptionsCommon}
|
${LeaveOptionsCommon}
|
||||||
|
|
||||||
|
|
@ -945,6 +962,7 @@ Function preSummary
|
||||||
DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4"
|
DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4"
|
||||||
|
|
||||||
; Check if it is possible to write to HKLM
|
; Check if it is possible to write to HKLM
|
||||||
|
${If} $InstallType != ${INSTALLTYPE_PORTABLE}
|
||||||
ClearErrors
|
ClearErrors
|
||||||
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
||||||
${Unless} ${Errors}
|
${Unless} ${Errors}
|
||||||
|
|
@ -991,6 +1009,7 @@ Function preSummary
|
||||||
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0"
|
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0"
|
||||||
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1"
|
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
!insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"
|
!insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"
|
||||||
|
|
||||||
|
|
@ -1113,7 +1132,7 @@ Function .onInit
|
||||||
!insertmacro InitInstallOptionsFile "shortcuts.ini"
|
!insertmacro InitInstallOptionsFile "shortcuts.ini"
|
||||||
!insertmacro InitInstallOptionsFile "summary.ini"
|
!insertmacro InitInstallOptionsFile "summary.ini"
|
||||||
|
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "7"
|
||||||
|
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)"
|
||||||
|
|
@ -1139,6 +1158,14 @@ Function .onInit
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
|
||||||
|
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Type "RadioButton"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Text "$(OPTION_PORTABLE_RADIO)"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Left "0"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Right "-1"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Top "85"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Bottom "95"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" State "0"
|
||||||
|
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15"
|
||||||
|
|
@ -1153,6 +1180,14 @@ Function .onInit
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87"
|
||||||
|
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Type "checkbox"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Text "$(OPTION_PORTABLE_DESC)"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Left "15"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Right "-1"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Top "97"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Bottom "117"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" State "0"
|
||||||
|
|
||||||
; Setup the shortcuts.ini file for the Custom Shortcuts Page
|
; Setup the shortcuts.ini file for the Custom Shortcuts Page
|
||||||
; Don't offer to install the quick launch shortcut on Windows 7
|
; Don't offer to install the quick launch shortcut on Windows 7
|
||||||
${If} ${AtLeastWin7}
|
${If} ${AtLeastWin7}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ setDefaultBrowserMessage=%S is not currently set as your default browser. Would
|
||||||
setDefaultBrowserDontAsk=Always perform this check when starting %S.
|
setDefaultBrowserDontAsk=Always perform this check when starting %S.
|
||||||
setDefaultBrowserAlertConfirm.label=Use %S as my default browser
|
setDefaultBrowserAlertConfirm.label=Use %S as my default browser
|
||||||
setDefaultBrowserAlertNotNow.label=Not now
|
setDefaultBrowserAlertNotNow.label=Not now
|
||||||
|
PortablemodeTitle=Portable Mode
|
||||||
|
PortablemodeMessage=By pressing Yes you switch %S into standart non-portable mode, and browser will restart.
|
||||||
|
|
||||||
desktopBackgroundLeafNameWin=Desktop Background.bmp
|
desktopBackgroundLeafNameWin=Desktop Background.bmp
|
||||||
DesktopBackgroundDownloading=Saving Picture…
|
DesktopBackgroundDownloading=Saving Picture…
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,8 @@ OPTION_STANDARD_RADIO=&Standard
|
||||||
# Two lines
|
# Two lines
|
||||||
OPTION_CUSTOM_DESC=You may choose individual options to be installed. Recommended for experienced users.
|
OPTION_CUSTOM_DESC=You may choose individual options to be installed. Recommended for experienced users.
|
||||||
OPTION_CUSTOM_RADIO=&Custom
|
OPTION_CUSTOM_RADIO=&Custom
|
||||||
|
OPTION_PORTABLE_DESC=Fully portable, disable system integration functionality (no-remote).
|
||||||
|
OPTION_PORTABLE_RADIO=&Portable
|
||||||
|
|
||||||
# LOCALIZATION NOTE:
|
# LOCALIZATION NOTE:
|
||||||
# The following text replaces the Install button text on the summary page.
|
# The following text replaces the Install button text on the summary page.
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,9 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||||
XPCOMUtils.defineLazyServiceGetter(this, "AlertsService",
|
XPCOMUtils.defineLazyServiceGetter(this, "AlertsService",
|
||||||
"@mozilla.org/alerts-service;1", "nsIAlertsService");
|
"@mozilla.org/alerts-service;1", "nsIAlertsService");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(this, "winShellService",
|
||||||
|
"@mozilla.org/browser/shell-service;1","nsIWindowsShellService");
|
||||||
|
|
||||||
// Define Lazy Module Getters
|
// Define Lazy Module Getters
|
||||||
[
|
[
|
||||||
["AddonManager", "resource://gre/modules/AddonManager.jsm"],
|
["AddonManager", "resource://gre/modules/AddonManager.jsm"],
|
||||||
|
|
@ -735,6 +738,8 @@ BrowserGlue.prototype = {
|
||||||
isDefaultError = true;
|
isDefaultError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var profService = Cc["@mozilla.org/toolkit/profile-service;1"].getService(Ci.nsIToolkitProfileService);
|
||||||
|
if (profService.portable()!=1) {
|
||||||
if (isDefault) {
|
if (isDefault) {
|
||||||
let now = (Math.floor(Date.now() / 1000)).toString();
|
let now = (Math.floor(Date.now() / 1000)).toString();
|
||||||
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
Services.prefs.setCharPref("browser.shell.mostRecentDateSetAsDefault", now);
|
||||||
|
|
@ -778,7 +783,7 @@ BrowserGlue.prototype = {
|
||||||
ShellService.shouldCheckDefaultBrowser = checkEveryTime.value;
|
ShellService.shouldCheckDefaultBrowser = checkEveryTime.value;
|
||||||
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
}.bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onQuitRequest: function(aCancelQuit, aQuitType) {
|
_onQuitRequest: function(aCancelQuit, aQuitType) {
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,9 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
|
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
|
||||||
Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
|
Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
|
||||||
|
|
||||||
|
XPCOMUtils.defineLazyServiceGetter(this, "winShellSvc",
|
||||||
|
"@mozilla.org/browser/shell-service;1","nsIWindowsShellService");
|
||||||
|
|
||||||
var gAdvancedPane = {
|
var gAdvancedPane = {
|
||||||
_inited: false,
|
_inited: false,
|
||||||
|
|
||||||
|
|
@ -745,6 +748,8 @@ var gAdvancedPane = {
|
||||||
document.getElementById("alwaysCheckDefault").disabled = true;
|
document.getElementById("alwaysCheckDefault").disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var profService = Components.classes["@mozilla.org/toolkit/profile-service;1"].getService(Components.interfaces.nsIToolkitProfileService);
|
||||||
|
if (profService.portable()==1) return;
|
||||||
let selectedIndex =
|
let selectedIndex =
|
||||||
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
||||||
setDefaultPane.selectedIndex = selectedIndex;
|
setDefaultPane.selectedIndex = selectedIndex;
|
||||||
|
|
@ -756,9 +761,32 @@ var gAdvancedPane = {
|
||||||
setDefaultBrowser: function()
|
setDefaultBrowser: function()
|
||||||
{
|
{
|
||||||
let shellSvc = getShellService();
|
let shellSvc = getShellService();
|
||||||
|
var profService = Components.classes["@mozilla.org/toolkit/profile-service;1"].getService(Components.interfaces.nsIToolkitProfileService);
|
||||||
|
let isPortable;
|
||||||
if (!shellSvc)
|
if (!shellSvc)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
|
isPortable = profService.portable();
|
||||||
|
if (isPortable==1) {
|
||||||
|
Components.utils.import("resource:///modules/RecentWindow.jsm");
|
||||||
|
var win = RecentWindow.getMostRecentBrowserWindow();
|
||||||
|
var brandBundle = win.document.getElementById("bundle_brand");
|
||||||
|
var shellBundle = win.document.getElementById("bundle_shell");
|
||||||
|
|
||||||
|
var brandShortName = brandBundle.getString("brandShortName");
|
||||||
|
var promptTitle = shellBundle.getString("PortablemodeTitle");
|
||||||
|
var promptMessage = shellBundle.getFormattedString("PortablemodeMessage",
|
||||||
|
[brandShortName]);
|
||||||
|
// var checkEveryTime = { value: shouldCheck };
|
||||||
|
var ps = Services.prompt;
|
||||||
|
var rv = ps.confirmEx(win, promptTitle, promptMessage,
|
||||||
|
ps.STD_YES_NO_BUTTONS,
|
||||||
|
null, null, null, null, { });//, checkboxLabel, checkEveryTime);
|
||||||
|
if (rv == 0) {
|
||||||
|
winShellSvc.cancelPortableMode();
|
||||||
|
isPortable=28;
|
||||||
|
} else return;
|
||||||
|
}
|
||||||
let claimAllTypes = true;
|
let claimAllTypes = true;
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
// In Windows 8+, the UI for selecting default protocol is much
|
// In Windows 8+, the UI for selecting default protocol is much
|
||||||
|
|
@ -776,6 +804,7 @@ var gAdvancedPane = {
|
||||||
let selectedIndex =
|
let selectedIndex =
|
||||||
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
shellSvc.isDefaultBrowser(false, true) ? 1 : 0;
|
||||||
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
|
document.getElementById("setDefaultPane").selectedIndex = selectedIndex;
|
||||||
|
if (isPortable==28) Application.quit();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
[scriptable, uuid(f8a26b94-49e5-4441-8fbc-315e0b4f22ef)]
|
[scriptable, uuid(f8a26b94-49e5-4441-8fbc-315e0b4f22ef)]
|
||||||
interface nsIWindowsShellService : nsIShellService
|
interface nsIWindowsShellService : nsIShellService
|
||||||
{
|
{
|
||||||
|
void cancelPortableMode();
|
||||||
/**
|
/**
|
||||||
* Provides the shell service an opportunity to do some Win7+ shortcut
|
* Provides the shell service an opportunity to do some Win7+ shortcut
|
||||||
* maintenance needed on initial startup of the browser.
|
* maintenance needed on initial startup of the browser.
|
||||||
|
|
|
||||||
|
|
@ -402,6 +402,31 @@ nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsWindowsShellService::CancelPortableMode()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFile> portmodemark;
|
||||||
|
|
||||||
|
rv = NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
|
||||||
|
getter_AddRefs(portmodemark));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
rv = portmodemark->AppendNative(NS_LITERAL_CSTRING("pmprt.mod"));
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
bool fileExists;
|
||||||
|
rv = portmodemark->Exists(&fileExists);
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
if (fileExists)
|
||||||
|
portmodemark->Remove(false);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
||||||
bool aForAllTypes,
|
bool aForAllTypes,
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ Var AddDesktopSC
|
||||||
Var InstallMaintenanceService
|
Var InstallMaintenanceService
|
||||||
Var PageName
|
Var PageName
|
||||||
Var PreventRebootRequired
|
Var PreventRebootRequired
|
||||||
|
Var PrtChkb
|
||||||
|
|
||||||
; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for
|
; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for
|
||||||
; an application's Start Menu PROGRAMS directory and doesn't define the
|
; an application's Start Menu PROGRAMS directory and doesn't define the
|
||||||
|
|
@ -287,6 +288,15 @@ Section "-Application" APP_IDX
|
||||||
"$(ERROR_CREATE_DIRECTORY_PREFIX)" \
|
"$(ERROR_CREATE_DIRECTORY_PREFIX)" \
|
||||||
"$(ERROR_CREATE_DIRECTORY_SUFFIX)"
|
"$(ERROR_CREATE_DIRECTORY_SUFFIX)"
|
||||||
|
|
||||||
|
${If} $InstallType == ${INSTALLTYPE_PORTABLE}
|
||||||
|
${If} $PrtChkb == 1
|
||||||
|
FileOpen $0 "$INSTDIR\browser\pmprt.mod" w
|
||||||
|
FileClose $0
|
||||||
|
${Else}
|
||||||
|
FileOpen $0 "$INSTDIR\browser\pmundprt.mod" w
|
||||||
|
FileClose $0
|
||||||
|
${EndIf}
|
||||||
|
${Else}
|
||||||
; Register DLLs
|
; Register DLLs
|
||||||
; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but
|
; XXXrstrong - AccessibleMarshal.dll can be used by multiple applications but
|
||||||
; is only registered for the last application installed. When the last
|
; is only registered for the last application installed. When the last
|
||||||
|
|
@ -532,6 +542,7 @@ Section "-Application" APP_IDX
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${EndUnless}
|
${EndUnless}
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
; Cleanup operations to perform at the end of the installation.
|
; Cleanup operations to perform at the end of the installation.
|
||||||
|
|
@ -850,6 +861,12 @@ Function leaveOptions
|
||||||
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State"
|
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State"
|
||||||
StrCmp $R0 "1" +1 +2
|
StrCmp $R0 "1" +1 +2
|
||||||
StrCpy $InstallType ${INSTALLTYPE_CUSTOM}
|
StrCpy $InstallType ${INSTALLTYPE_CUSTOM}
|
||||||
|
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 6" "State"
|
||||||
|
StrCmp $R0 "1" +1 +2
|
||||||
|
StrCpy $InstallType ${INSTALLTYPE_PORTABLE}
|
||||||
|
${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 7" "State"
|
||||||
|
StrCmp $R0 "1" +1 +2
|
||||||
|
StrCpy $PrtChkb 1
|
||||||
|
|
||||||
${LeaveOptionsCommon}
|
${LeaveOptionsCommon}
|
||||||
|
|
||||||
|
|
@ -939,6 +956,7 @@ Function preSummary
|
||||||
DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4"
|
DeleteINISec "$PLUGINSDIR\summary.ini" "Field 4"
|
||||||
|
|
||||||
; Check if it is possible to write to HKLM
|
; Check if it is possible to write to HKLM
|
||||||
|
${If} $InstallType != ${INSTALLTYPE_PORTABLE}
|
||||||
ClearErrors
|
ClearErrors
|
||||||
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
|
||||||
${Unless} ${Errors}
|
${Unless} ${Errors}
|
||||||
|
|
@ -985,6 +1003,7 @@ Function preSummary
|
||||||
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0"
|
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Left "0"
|
||||||
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1"
|
WriteINIStr "$PLUGINSDIR\summary.ini" "Field $0" Right "-1"
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
!insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"
|
!insertmacro MUI_HEADER_TEXT "$(SUMMARY_PAGE_TITLE)" "$(SUMMARY_PAGE_SUBTITLE)"
|
||||||
|
|
||||||
|
|
@ -1076,7 +1095,7 @@ Function .onInit
|
||||||
!insertmacro InitInstallOptionsFile "shortcuts.ini"
|
!insertmacro InitInstallOptionsFile "shortcuts.ini"
|
||||||
!insertmacro InitInstallOptionsFile "summary.ini"
|
!insertmacro InitInstallOptionsFile "summary.ini"
|
||||||
|
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "5"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Settings" NumFields "7"
|
||||||
|
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Type "label"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 1" Text "$(OPTIONS_SUMMARY)"
|
||||||
|
|
@ -1102,6 +1121,14 @@ Function .onInit
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" Bottom "65"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 3" State "0"
|
||||||
|
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Type "RadioButton"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Text "$(OPTION_PORTABLE_RADIO)"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Left "0"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Right "-1"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Top "85"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" Bottom "95"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 6" State "0"
|
||||||
|
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Type "label"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Text "$(OPTION_STANDARD_DESC)"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 4" Left "15"
|
||||||
|
|
@ -1116,6 +1143,14 @@ Function .onInit
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Top "67"
|
||||||
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87"
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 5" Bottom "87"
|
||||||
|
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Type "checkbox"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Text "$(OPTION_PORTABLE_DESC)"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Left "15"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Right "-1"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Top "97"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" Bottom "117"
|
||||||
|
WriteINIStr "$PLUGINSDIR\options.ini" "Field 7" State "0"
|
||||||
|
|
||||||
; Setup the shortcuts.ini file for the Custom Shortcuts Page
|
; Setup the shortcuts.ini file for the Custom Shortcuts Page
|
||||||
; Don't offer to install the quick launch shortcut on Windows 7
|
; Don't offer to install the quick launch shortcut on Windows 7
|
||||||
${If} ${AtLeastWin7}
|
${If} ${AtLeastWin7}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ setDefaultBrowserTitle=Default Browser
|
||||||
setDefaultBrowserMessage=%S is not currently set as your default browser. Would you like to make it your default browser?
|
setDefaultBrowserMessage=%S is not currently set as your default browser. Would you like to make it your default browser?
|
||||||
setDefaultBrowserDontAsk=Always perform this check when starting %S.
|
setDefaultBrowserDontAsk=Always perform this check when starting %S.
|
||||||
alreadyDefaultBrowser=%S is already set as your default browser.
|
alreadyDefaultBrowser=%S is already set as your default browser.
|
||||||
|
PortablemodeTitle=Portable Mode
|
||||||
|
PortablemodeMessage=By pressing Yes you switch %S into standart non-portable mode, and browser will quit.
|
||||||
desktopBackgroundLeafNameWin=Desktop Background.bmp
|
desktopBackgroundLeafNameWin=Desktop Background.bmp
|
||||||
DesktopBackgroundDownloading=Saving Picture…
|
DesktopBackgroundDownloading=Saving Picture…
|
||||||
DesktopBackgroundSet=Set Desktop Background
|
DesktopBackgroundSet=Set Desktop Background
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ OPTION_STANDARD_RADIO=&Standard
|
||||||
# Two lines
|
# Two lines
|
||||||
OPTION_CUSTOM_DESC=You may choose individual options to be installed. Recommended for experienced users.
|
OPTION_CUSTOM_DESC=You may choose individual options to be installed. Recommended for experienced users.
|
||||||
OPTION_CUSTOM_RADIO=&Custom
|
OPTION_CUSTOM_RADIO=&Custom
|
||||||
|
OPTION_PORTABLE_DESC=Fully portable, disable system integration functionality (no-remote).
|
||||||
|
OPTION_PORTABLE_RADIO=&Portable
|
||||||
|
|
||||||
# LOCALIZATION NOTE:
|
# LOCALIZATION NOTE:
|
||||||
# The following text replaces the Install button text on the summary page.
|
# The following text replaces the Install button text on the summary page.
|
||||||
|
|
|
||||||
|
|
@ -302,14 +302,14 @@ nsresult InitOSFileConstants()
|
||||||
// some platforms or in non-Firefox embeddings of Gecko).
|
// some platforms or in non-Firefox embeddings of Gecko).
|
||||||
|
|
||||||
GetPathToSpecialDir(NS_OS_TEMP_DIR, paths->tmpDir);
|
GetPathToSpecialDir(NS_OS_TEMP_DIR, paths->tmpDir);
|
||||||
GetPathToSpecialDir(NS_OS_HOME_DIR, paths->homeDir);
|
/* GetPathToSpecialDir(NS_OS_HOME_DIR, paths->homeDir);
|
||||||
GetPathToSpecialDir(NS_OS_DESKTOP_DIR, paths->desktopDir);
|
GetPathToSpecialDir(NS_OS_DESKTOP_DIR, paths->desktopDir);
|
||||||
GetPathToSpecialDir(XRE_USER_APP_DATA_DIR, paths->userApplicationDataDir);
|
GetPathToSpecialDir(XRE_USER_APP_DATA_DIR, paths->userApplicationDataDir);
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
GetPathToSpecialDir(NS_WIN_APPDATA_DIR, paths->winAppDataDir);
|
GetPathToSpecialDir(NS_WIN_APPDATA_DIR, paths->winAppDataDir);
|
||||||
GetPathToSpecialDir(NS_WIN_PROGRAMS_DIR, paths->winStartMenuProgsDir);
|
GetPathToSpecialDir(NS_WIN_PROGRAMS_DIR, paths->winStartMenuProgsDir);
|
||||||
#endif // defined(XP_WIN)
|
#endif // defined(XP_WIN)*/
|
||||||
|
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir);
|
GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir);
|
||||||
|
|
|
||||||
|
|
@ -4972,6 +4972,10 @@
|
||||||
!define INSTALLTYPE_CUSTOM 2
|
!define INSTALLTYPE_CUSTOM 2
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!ifndef INSTALLTYPE_PORTABLE
|
||||||
|
!define INSTALLTYPE_PORTABLE 3
|
||||||
|
!endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether to display the current page (e.g. if not performing a custom
|
* Checks whether to display the current page (e.g. if not performing a custom
|
||||||
* install don't display the custom pages).
|
* install don't display the custom pages).
|
||||||
|
|
@ -5649,6 +5653,7 @@
|
||||||
Push $R9
|
Push $R9
|
||||||
|
|
||||||
IntCmp $InstallType ${INSTALLTYPE_CUSTOM} end +1 +1
|
IntCmp $InstallType ${INSTALLTYPE_CUSTOM} end +1 +1
|
||||||
|
IntCmp $InstallType ${INSTALLTYPE_PORTABLE} end +1 +1
|
||||||
${CanWriteToInstallDir} $R9
|
${CanWriteToInstallDir} $R9
|
||||||
StrCmp "$R9" "false" end +1
|
StrCmp "$R9" "false" end +1
|
||||||
${CheckDiskSpace} $R9
|
${CheckDiskSpace} $R9
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,14 @@ function initWizard()
|
||||||
try {
|
try {
|
||||||
gProfileService = C[ToolkitProfileService].getService(I.nsIToolkitProfileService);
|
gProfileService = C[ToolkitProfileService].getService(I.nsIToolkitProfileService);
|
||||||
gProfileManagerBundle = document.getElementById("bundle_profileManager");
|
gProfileManagerBundle = document.getElementById("bundle_profileManager");
|
||||||
|
var pathProp="DefProfRt"
|
||||||
var dirService = C["@mozilla.org/file/directory_service;1"].getService(I.nsIProperties);
|
var dirService = C["@mozilla.org/file/directory_service;1"].getService(I.nsIProperties);
|
||||||
gDefaultProfileParent = dirService.get("DefProfRt", I.nsIFile);
|
var profService = C["@mozilla.org/toolkit/profile-service;1"].getService(I.nsIToolkitProfileService);
|
||||||
|
if (profService.portable()>0){
|
||||||
|
pathProp="CurProcD";
|
||||||
|
gDefaultProfileParent = dirService.get(pathProp, I.nsIFile).parent;
|
||||||
|
}
|
||||||
|
else gDefaultProfileParent = dirService.get(pathProp, I.nsIFile);
|
||||||
|
|
||||||
// Initialize the profile location display.
|
// Initialize the profile location display.
|
||||||
gProfileDisplay = document.getElementById("profileDisplay").firstChild;
|
gProfileDisplay = document.getElementById("profileDisplay").firstChild;
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,8 @@ interface nsIToolkitProfileService : nsISupports
|
||||||
* Flush the profiles list file.
|
* Flush the profiles list file.
|
||||||
*/
|
*/
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
|
uint32_t portable();
|
||||||
};
|
};
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ public:
|
||||||
private:
|
private:
|
||||||
friend class nsToolkitProfile;
|
friend class nsToolkitProfile;
|
||||||
friend class nsToolkitProfileFactory;
|
friend class nsToolkitProfileFactory;
|
||||||
friend nsresult NS_NewToolkitProfileService(nsIToolkitProfileService**);
|
friend nsresult NS_NewToolkitProfileService(nsIToolkitProfileService**,uint32_t);
|
||||||
|
|
||||||
nsToolkitProfileService() :
|
nsToolkitProfileService() :
|
||||||
mDirty(false),
|
mDirty(false),
|
||||||
|
|
@ -126,7 +126,7 @@ private:
|
||||||
gService = nullptr;
|
gService = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult Init();
|
nsresult Init(uint32_t portable);
|
||||||
|
|
||||||
nsresult CreateTimesInternal(nsIFile *profileDir);
|
nsresult CreateTimesInternal(nsIFile *profileDir);
|
||||||
|
|
||||||
|
|
@ -382,16 +382,30 @@ NS_IMPL_ISUPPORTS(nsToolkitProfileService,
|
||||||
nsIToolkitProfileService)
|
nsIToolkitProfileService)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsToolkitProfileService::Init()
|
nsToolkitProfileService::Init(uint32_t portable)
|
||||||
{
|
{
|
||||||
|
|
||||||
NS_ASSERTION(gDirServiceProvider, "No dirserviceprovider!");
|
NS_ASSERTION(gDirServiceProvider, "No dirserviceprovider!");
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
if(portable>0){
|
||||||
|
nsCOMPtr<nsIFile> appFile;
|
||||||
|
bool per = false;
|
||||||
|
rv = gDirServiceProvider->GetFile(XRE_EXECUTABLE_FILE, &per, getter_AddRefs(appFile));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = appFile->GetParent(getter_AddRefs(mAppData));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = appFile->GetParent(getter_AddRefs(mTempData));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
rv = gDirServiceProvider->GetUserAppDataDirectory(getter_AddRefs(mAppData));
|
rv = gDirServiceProvider->GetUserAppDataDirectory(getter_AddRefs(mAppData));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = gDirServiceProvider->GetUserLocalDataDirectory(getter_AddRefs(mTempData));
|
rv = gDirServiceProvider->GetUserLocalDataDirectory(getter_AddRefs(mTempData));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
rv = mAppData->Clone(getter_AddRefs(mListFile));
|
rv = mAppData->Clone(getter_AddRefs(mListFile));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
@ -969,6 +983,13 @@ nsToolkitProfileService::Flush()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsToolkitProfileService::Portable(uint32_t *aResult)
|
||||||
|
{
|
||||||
|
return gDirServiceProvider->Portable(aResult);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsToolkitProfileFactory, nsIFactory)
|
NS_IMPL_ISUPPORTS(nsToolkitProfileFactory, nsIFactory)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
@ -981,7 +1002,7 @@ nsToolkitProfileFactory::CreateInstance(nsISupports* aOuter, const nsID& aIID,
|
||||||
nsCOMPtr<nsIToolkitProfileService> profileService =
|
nsCOMPtr<nsIToolkitProfileService> profileService =
|
||||||
nsToolkitProfileService::gService;
|
nsToolkitProfileService::gService;
|
||||||
if (!profileService) {
|
if (!profileService) {
|
||||||
nsresult rv = NS_NewToolkitProfileService(getter_AddRefs(profileService));
|
nsresult rv = NS_NewToolkitProfileService(getter_AddRefs(profileService),0);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -1006,12 +1027,12 @@ NS_NewToolkitProfileFactory(nsIFactory* *aResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult)
|
NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult,uint32_t portable)
|
||||||
{
|
{
|
||||||
nsToolkitProfileService* profileService = new nsToolkitProfileService();
|
nsToolkitProfileService* profileService = new nsToolkitProfileService();
|
||||||
if (!profileService)
|
if (!profileService)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
nsresult rv = profileService->Init();
|
nsresult rv = profileService->Init(portable);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_ERROR("nsToolkitProfileService::Init failed!");
|
NS_ERROR("nsToolkitProfileService::Init failed!");
|
||||||
delete profileService;
|
delete profileService;
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,7 @@ char **gRestartArgv;
|
||||||
bool gIsGtest = false;
|
bool gIsGtest = false;
|
||||||
|
|
||||||
nsString gAbsoluteArgv0Path;
|
nsString gAbsoluteArgv0Path;
|
||||||
|
uint32_t portable;
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_GTK)
|
#if defined(MOZ_WIDGET_GTK)
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
@ -1984,6 +1985,14 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
||||||
return NS_LockProfilePath(lf, localDir, nullptr, aResult);
|
return NS_LockProfilePath(lf, localDir, nullptr, aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIFile> exeFile;
|
||||||
|
nsIFile* rootDir=nullptr;
|
||||||
|
if (portable>0){
|
||||||
|
XRE_GetBinaryPath(gArgv[0], getter_AddRefs(exeFile));
|
||||||
|
exeFile->GetParent(&rootDir);
|
||||||
|
rootDir->AppendNative(NS_LITERAL_CSTRING("Profile"));
|
||||||
|
}
|
||||||
|
|
||||||
ar = CheckArg("profile", true, &arg);
|
ar = CheckArg("profile", true, &arg);
|
||||||
if (ar == ARG_BAD) {
|
if (ar == ARG_BAD) {
|
||||||
PR_fprintf(PR_STDERR, "Error: argument --profile requires a path\n");
|
PR_fprintf(PR_STDERR, "Error: argument --profile requires a path\n");
|
||||||
|
|
@ -2040,7 +2049,15 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
||||||
// main profile directory.
|
// main profile directory.
|
||||||
rv = aProfileSvc->CreateProfile(lf, nsDependentCSubstring(arg, delim),
|
rv = aProfileSvc->CreateProfile(lf, nsDependentCSubstring(arg, delim),
|
||||||
getter_AddRefs(profile));
|
getter_AddRefs(profile));
|
||||||
} else {
|
}
|
||||||
|
else if(portable>0) {
|
||||||
|
nsCOMPtr<nsIFile> lf;
|
||||||
|
rootDir->GetParent(getter_AddRefs(lf));
|
||||||
|
lf->AppendNative(nsDependentCString(arg));
|
||||||
|
rv = aProfileSvc->CreateProfile(lf, nsDependentCString(arg),
|
||||||
|
getter_AddRefs(profile));
|
||||||
|
}
|
||||||
|
else {
|
||||||
rv = aProfileSvc->CreateProfile(nullptr, nsDependentCString(arg),
|
rv = aProfileSvc->CreateProfile(nullptr, nsDependentCString(arg),
|
||||||
getter_AddRefs(profile));
|
getter_AddRefs(profile));
|
||||||
}
|
}
|
||||||
|
|
@ -2168,7 +2185,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
||||||
|
|
||||||
// create a default profile
|
// create a default profile
|
||||||
nsCOMPtr<nsIToolkitProfile> profile;
|
nsCOMPtr<nsIToolkitProfile> profile;
|
||||||
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
|
nsresult rv = aProfileSvc->CreateProfile(rootDir, // choose a default dir for us
|
||||||
NS_LITERAL_CSTRING("default"),
|
NS_LITERAL_CSTRING("default"),
|
||||||
getter_AddRefs(profile));
|
getter_AddRefs(profile));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
@ -3061,6 +3078,12 @@ XREMain::XRE_mainInit(bool* aExitFlag)
|
||||||
} else if (ar == ARG_FOUND) {
|
} else if (ar == ARG_FOUND) {
|
||||||
SaveToEnv("MOZ_NO_REMOTE=1");
|
SaveToEnv("MOZ_NO_REMOTE=1");
|
||||||
}
|
}
|
||||||
|
//MYPAL CODE
|
||||||
|
//lstrcmpW(L"Teest",L"Teest");
|
||||||
|
|
||||||
|
mDirProvider.Portable(&portable);
|
||||||
|
|
||||||
|
if (portable==1) SaveToEnv("MOZ_NO_REMOTE=1");
|
||||||
|
|
||||||
ar = CheckArg("new-instance", true);
|
ar = CheckArg("new-instance", true);
|
||||||
if (ar == ARG_BAD) {
|
if (ar == ARG_BAD) {
|
||||||
|
|
@ -3435,7 +3458,7 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc));
|
rv = NS_NewToolkitProfileService(getter_AddRefs(mProfileSvc),portable);
|
||||||
if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
|
if (rv == NS_ERROR_FILE_ACCESS_DENIED) {
|
||||||
PR_fprintf(PR_STDERR, "Error: Access was denied while trying to open files in " \
|
PR_fprintf(PR_STDERR, "Error: Access was denied while trying to open files in " \
|
||||||
"your profile directory.\n");
|
"your profile directory.\n");
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ extern bool gIsGtest;
|
||||||
nsresult NS_CreateNativeAppSupport(nsINativeAppSupport* *aResult);
|
nsresult NS_CreateNativeAppSupport(nsINativeAppSupport* *aResult);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult);
|
NS_NewToolkitProfileService(nsIToolkitProfileService* *aResult,uint32_t portable);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewToolkitProfileFactory(nsIFactory* *aResult);
|
NS_NewToolkitProfileFactory(nsIFactory* *aResult);
|
||||||
|
|
|
||||||
|
|
@ -276,6 +276,26 @@ GetSystemParentDirectory(nsIFile** aFile)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsXREDirProvider::Portable(uint32_t *aResult)
|
||||||
|
{
|
||||||
|
bool portable;
|
||||||
|
nsCOMPtr<nsIFile> portmodemark;
|
||||||
|
GetAppDir()->Clone(getter_AddRefs(portmodemark));
|
||||||
|
portmodemark->AppendNative(NS_LITERAL_CSTRING("pmprt.mod"));
|
||||||
|
portmodemark->Exists(&portable);
|
||||||
|
if (portable){
|
||||||
|
*aResult=1;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
GetAppDir()->Clone(getter_AddRefs(portmodemark));
|
||||||
|
portmodemark->AppendNative(NS_LITERAL_CSTRING("pmundprt.mod"));
|
||||||
|
portmodemark->Exists(&portable);
|
||||||
|
if (portable) *aResult=2;
|
||||||
|
else *aResult=0;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
||||||
nsIFile** aFile)
|
nsIFile** aFile)
|
||||||
|
|
@ -1359,8 +1379,8 @@ nsXREDirProvider::GetSysUserExtensionsDirectory(nsIFile** aFile)
|
||||||
nsresult rv = GetUserDataDirectoryHome(getter_AddRefs(localDir), false);
|
nsresult rv = GetUserDataDirectoryHome(getter_AddRefs(localDir), false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = AppendSysUserExtensionPath(localDir);
|
//rv = AppendSysUserExtensionPath(localDir);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
//NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = EnsureDirectoryExists(localDir);
|
rv = EnsureDirectoryExists(localDir);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ public:
|
||||||
|
|
||||||
static nsXREDirProvider* GetSingleton();
|
static nsXREDirProvider* GetSingleton();
|
||||||
|
|
||||||
|
nsresult Portable(uint32_t *aResult);
|
||||||
|
|
||||||
nsresult GetUserProfilesRootDir(nsIFile** aResult,
|
nsresult GetUserProfilesRootDir(nsIFile** aResult,
|
||||||
const nsACString* aProfileName,
|
const nsACString* aProfileName,
|
||||||
const nsACString* aAppName,
|
const nsACString* aAppName,
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,8 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
|
DEFINES['MOZ_APP_BASENAME'] = '"%s"' % CONFIG['MOZ_APP_BASENAME']
|
||||||
|
|
||||||
if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
|
if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
|
||||||
DEFINES['HAVE_USR_LIB64_DIR'] = True
|
DEFINES['HAVE_USR_LIB64_DIR'] = True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue