Chromium Code Reviews| Index: chrome/browser/shell_integration_win.cc |
| diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc |
| index 869b5b51311f5ff8019a259bc8d3301c07c44629..9921f40c26afaa955de1161e5edd0ba36575aa8a 100644 |
| --- a/chrome/browser/shell_integration_win.cc |
| +++ b/chrome/browser/shell_integration_win.cc |
| @@ -389,8 +389,17 @@ void MigrateChromiumShortcutsCallback() { |
| } // namespace |
| -bool ShellIntegration::CanSetAsDefaultBrowser() { |
| - return BrowserDistribution::GetDistribution()->CanSetAsDefault(); |
| +ShellIntegration::DefaultSettingsChangePermission |
| + ShellIntegration::CanSetAsDefaultBrowser() { |
| + if (!BrowserDistribution::GetDistribution()->CanSetAsDefault()) { |
|
grt (UTC plus 2)
2012/05/25 20:27:38
no braces for these one-liners
motek.
2012/05/28 17:40:33
Done.
|
| + return CHANGE_DEFAULT_NOT_ALLOWED; |
| + } |
| + |
| + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
|
grt (UTC plus 2)
2012/05/25 20:27:38
no braces for these
motek.
2012/05/28 17:40:33
Done.
|
| + return CHANGE_DEFAULT_INTERACTIVE; |
| + } else { |
| + return CHANGE_DEFAULT_UNATTENDED; |
| + } |
| } |
| bool ShellIntegration::SetAsDefaultBrowser() { |
| @@ -435,6 +444,24 @@ bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) { |
| return true; |
| } |
| +bool ShellIntegration::StartSetAsDefaultBrowserInteractive() { |
| + FilePath chrome_exe; |
| + if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { |
| + LOG(ERROR) << "Error getting app exe path"; |
|
grt (UTC plus 2)
2012/05/25 20:27:38
i think NOTREACHED(); or LOG(DFATAL) << ...; would
motek.
2012/05/28 17:40:33
Fair enough. I just copied&pasted this without giv
|
| + return false; |
| + } |
| + |
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| + if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, ShellUtil::CURRENT_USER, |
| + chrome_exe.value(), true)) { |
| + LOG(ERROR) << "Failed to launch the set-default-browser Windows UI."; |
| + return false; |
| + } |
| + |
| + VLOG(1) << "Set-as-default Windows UI triggered."; |
| + return true; |
| +} |
| + |
| ShellIntegration::DefaultWebClientState ShellIntegration::IsDefaultBrowser() { |
| // When we check for default browser we don't necessarily want to count file |
| // type handlers and icons as having changed the default browser status, |
| @@ -446,7 +473,6 @@ ShellIntegration::DefaultWebClientState ShellIntegration::IsDefaultBrowser() { |
| // flag. There is doubtless some other key we can hook into to cause "Repair" |
| // to show up in Add/Remove programs for us. |
| static const wchar_t* const kChromeProtocols[] = { L"http", L"https" }; |
| - |
|
grt (UTC plus 2)
2012/05/25 20:27:38
nit: please add this newline back. it was my favo
motek.
2012/05/28 17:40:33
Done.
|
| return ProbeProtocolHandlers(kChromeProtocols, arraysize(kChromeProtocols)); |
| } |