зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1167294 - Launch the modern Settings app when setting the default browser on Windows 10. r=jimm,Gijs
--HG-- extra : rebase_source : 4739b173a9885404a6393f47416904f6f7604891
This commit is contained in:
Родитель
e8b7d81356
Коммит
f3d985358c
|
@ -2626,16 +2626,16 @@ let DefaultBrowserCheck = {
|
|||
|
||||
setAsDefault: function() {
|
||||
let claimAllTypes = true;
|
||||
#ifdef XP_WIN
|
||||
try {
|
||||
// In Windows 8, the UI for selecting default protocol is much
|
||||
// nicer than the UI for setting file type associations. So we
|
||||
// only show the protocol association screen on Windows 8.
|
||||
// Windows 8 is version 6.2.
|
||||
let version = Services.sysinfo.getProperty("version");
|
||||
claimAllTypes = (parseFloat(version) < 6.2);
|
||||
} catch (ex) { }
|
||||
#endif
|
||||
if (AppConstants.platform == "win") {
|
||||
try {
|
||||
// In Windows 8+, the UI for selecting default protocol is much
|
||||
// nicer than the UI for setting file type associations. So we
|
||||
// only show the protocol association screen on Windows 8+.
|
||||
// Windows 8 is version 6.2.
|
||||
let version = Services.sysinfo.getProperty("version");
|
||||
claimAllTypes = (parseFloat(version) < 6.2);
|
||||
} catch (ex) { }
|
||||
}
|
||||
try {
|
||||
ShellService.setDefaultBrowser(claimAllTypes, false);
|
||||
} catch (ex) {
|
||||
|
|
|
@ -713,7 +713,16 @@ var gMainPane = {
|
|||
if (!shellSvc)
|
||||
return;
|
||||
try {
|
||||
shellSvc.setDefaultBrowser(true, false);
|
||||
let claimAllTypes = true;
|
||||
if (AppConstants.platform == "win") {
|
||||
// In Windows 8+, the UI for selecting default protocol is much
|
||||
// nicer than the UI for setting file type associations. So we
|
||||
// only show the protocol association screen on Windows 8+.
|
||||
// Windows 8 is version 6.2.
|
||||
let version = Services.sysinfo.getProperty("version");
|
||||
claimAllTypes = (parseFloat(version) < 6.2);
|
||||
}
|
||||
shellSvc.setDefaultBrowser(claimAllTypes, false);
|
||||
} catch (ex) {
|
||||
Cu.reportError(ex);
|
||||
return;
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
#endif
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define INITGUID
|
||||
#undef NTDDI_VERSION
|
||||
#define NTDDI_VERSION NTDDI_WIN8
|
||||
// Needed for access to IApplicationActivationManager
|
||||
#include <shlobj.h>
|
||||
|
||||
#include <mbstring.h>
|
||||
|
@ -662,6 +665,28 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindowsShellService::LaunchModernSettingsDialogDefaultApps()
|
||||
{
|
||||
IApplicationActivationManager* pActivator;
|
||||
HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
|
||||
nullptr,
|
||||
CLSCTX_INPROC,
|
||||
IID_IApplicationActivationManager,
|
||||
(void**)&pActivator);
|
||||
|
||||
if (SUCCEEDED(hr)) {
|
||||
DWORD pid;
|
||||
hr = pActivator->ActivateApplication(
|
||||
L"windows.immersivecontrolpanel_cw5n1h2txyewy"
|
||||
L"!microsoft.windows.immersivecontrolpanel",
|
||||
L"page=SettingsPageAppsDefaults", AO_NONE, &pid);
|
||||
pActivator->Release();
|
||||
return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindowsShellService::LaunchHTTPHandlerPane()
|
||||
{
|
||||
|
@ -697,9 +722,17 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
|
|||
rv = LaunchHTTPHandlerPane();
|
||||
}
|
||||
} else {
|
||||
rv = LaunchHTTPHandlerPane();
|
||||
// The above calls hould never really fail, but just in case
|
||||
// fallb ack to showing control panel for all defaults
|
||||
// Windows 10 blocks attempts to load the HTTP Handler
|
||||
// association dialog, so the modern Settings dialog
|
||||
// is opened with the Default Apps view loaded.
|
||||
if (IsWin10OrLater()) {
|
||||
rv = LaunchModernSettingsDialogDefaultApps();
|
||||
} else {
|
||||
rv = LaunchHTTPHandlerPane();
|
||||
}
|
||||
|
||||
// The above call should never really fail, but just in case
|
||||
// fall back to showing control panel for all defaults
|
||||
if (NS_FAILED(rv)) {
|
||||
rv = LaunchControlPanelDefaultPrograms();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
protected:
|
||||
bool IsDefaultBrowserVista(bool aCheckAllTypes, bool* aIsDefaultBrowser);
|
||||
nsresult LaunchControlPanelDefaultPrograms();
|
||||
nsresult LaunchModernSettingsDialogDefaultApps();
|
||||
nsresult LaunchHTTPHandlerPane();
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче