Index: chrome/installer/util/shell_util.cc |
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc |
index ef7177ec96fb95b042d23b8defb0c757c4323347..1033525b7c228cd6f6295d5058dda49c733bfb55 100644 |
--- a/chrome/installer/util/shell_util.cc |
+++ b/chrome/installer/util/shell_util.cc |
@@ -614,12 +614,13 @@ bool AnotherUserHasDefaultBrowser(BrowserDistribution* dist, |
// Launches the Windows 7 and Windows 8 application association dialog, which |
// is the only documented way to make a browser the default browser on |
// Windows 8. |
-bool LaunchApplicationAssociationDialog(const string16& app_id) { |
- base::win::ScopedComPtr<IApplicationAssociationRegistrationUI> aarui; |
- HRESULT hr = aarui.CreateInstance(CLSID_ApplicationAssociationRegistrationUI); |
- if (FAILED(hr)) |
- return false; |
- hr = aarui->LaunchAdvancedAssociationUI(app_id.c_str()); |
+bool LaunchApplicationAssociationDialog() { |
grt (UTC plus 2)
2012/05/28 20:47:02
please update the comment and function name since
gab
2012/05/29 16:05:19
Also, can you leave the old call around? It will n
motek.
2012/05/31 21:59:04
Done.
motek.
2012/05/31 21:59:04
Done.
|
+ const wchar_t* protocol = L"http"; |
grt (UTC plus 2)
2012/05/28 20:47:02
static const wchar_t protocol[] = L"http";
to be s
motek.
2012/05/31 21:59:04
Done.
|
+ OPENASINFO open_as_info = {}; |
+ open_as_info.pcszFile = protocol; |
+ open_as_info.oaifInFlags = |
+ OAIF_URL_PROTOCOL | OAIF_FORCE_REGISTRATION | OAIF_REGISTER_EXT; |
+ HRESULT hr = SHOpenWithDialog(NULL, &open_as_info); |
return SUCCEEDED(hr); |
grt (UTC plus 2)
2012/05/28 20:47:02
how about adding this just before the return:
DLOG
motek.
2012/05/31 21:59:04
Done.
|
} |
@@ -945,6 +946,12 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, |
if (!dist->CanSetAsDefault()) |
return false; |
+ // Windows 8 does not permit making a browser default just like that. |
+ // This process needs to be routed through the system's UI. Use |
+ // ShowMakeChromeDefaultSystemUI instead (below). |
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
+ return false; |
grt (UTC plus 2)
2012/05/28 20:47:02
should there be a NOTREACHED() here?
motek.
2012/05/31 21:59:04
Done.
|
+ |
ShellUtil::RegisterChromeBrowser(dist, chrome_exe, L"", elevate_if_not_admin); |
bool ret = true; |
@@ -955,17 +962,7 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, |
if (ShellUtil::GetUserSpecificDefaultBrowserSuffix(dist, &app_suffix)) |
app_name += app_suffix; |
- if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
- // On Windows 8, you can't set yourself as the default handler |
- // programatically. In other words IApplicationAssociationRegistration |
- // has been rendered useless. What you can do is to launch |
- // "Set Program Associations" section of the "Default Programs" |
- // control panel. This action does not require elevation and we |
- // don't get to control window activation. More info at: |
- // http://msdn.microsoft.com/en-us/library/cc144154(VS.85).aspx |
- return LaunchApplicationAssociationDialog(app_name.c_str()); |
- |
- } else if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
+ if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
// On Windows Vista and Win7 we still can set ourselves via the |
// the IApplicationAssociationRegistration interface. |
VLOG(1) << "Registering Chrome as default browser on Vista."; |
@@ -1027,6 +1024,24 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist, |
return ret; |
} |
+bool ShellUtil::ShowMakeChromeDefaultSystemUI( |
+ BrowserDistribution* dist, int shell_change, const string16& chrome_exe, |
grt (UTC plus 2)
2012/05/28 20:47:02
put each parameters on its own line, indented four
motek.
2012/05/31 21:59:04
Done.
|
+ bool elevate_if_not_admin) { |
+ if (!dist->CanSetAsDefault()) |
+ return false; |
+ |
gab
2012/05/29 16:05:19
This is only for Win8+ right? If so, can you add a
motek.
2012/05/31 21:59:04
I don't know. It is not only Windows 8. This dialo
gab
2012/05/31 22:17:20
Thanks, my point is that it will never be used on
|
+ ShellUtil::RegisterChromeBrowser(dist, chrome_exe, L"", elevate_if_not_admin); |
gab
2012/05/29 16:05:19
Note to self (and reminder to my future reviewers!
motek.
2012/05/31 21:59:04
Well, OK.
|
+ |
+ // On Windows 8, you can't set yourself as the default handler |
+ // programatically. In other words IApplicationAssociationRegistration |
+ // has been rendered useless. What you can do is to launch |
+ // "Set Program Associations" section of the "Default Programs" |
+ // control panel. This action does not require elevation and we |
grt (UTC plus 2)
2012/05/28 20:47:02
i suggest replacing the last few lines of this com
motek.
2012/05/31 21:59:04
Done.
|
+ // don't get to control window activation. More info at: |
+ // http://msdn.microsoft.com/en-us/library/cc144154(VS.85).aspx |
+ return LaunchApplicationAssociationDialog(); |
+} |
+ |
bool ShellUtil::MakeChromeDefaultProtocolClient(BrowserDistribution* dist, |
const string16& chrome_exe, |
const string16& protocol) { |