From 264f74d108c0ebe22e633735606a4b8515a34400 Mon Sep 17 00:00:00 2001 From: "mdm@chromium.org" Date: Fri, 4 Sep 2009 23:39:58 +0000 Subject: Allow the default browser check to return "unknown" and reflect that in the UI. On Linux this can happen for unsupported desktop environments. On Windows and Mac OS X this probably should not occur and likely indicates some sort of serious configuration error. This change avoids repeatedly bothering the user to set the default browser in cases where we're likely to fail at that, without incorrectly displaying that we are the default browser. BUG=none TEST=none Review URL: http://codereview.chromium.org/200025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25553 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/shell_integration_linux.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'chrome/browser/shell_integration_linux.cc') diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index c7077d1..fb3fef8 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -180,7 +180,7 @@ bool ShellIntegration::SetAsDefaultBrowser() { return LaunchXdgUtility(argv); } -bool ShellIntegration::IsDefaultBrowser() { +ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { std::vector argv; argv.push_back("xdg-settings"); argv.push_back("check"); @@ -189,15 +189,12 @@ bool ShellIntegration::IsDefaultBrowser() { std::string reply; if (!base::GetAppOutput(CommandLine(argv), &reply)) { - // If xdg-settings fails, we assume that we should pretend we're the default - // browser to avoid giving repeated prompts to set ourselves as the default. - // TODO(mdm): Really, being the default browser should be a ternary query: - // yes, no, and "don't know" so the UI can reflect this more accurately. - return true; + // xdg-settings failed: we can't determine or set the default browser. + return UNKNOWN_DEFAULT_BROWSER; } // Allow any reply that starts with "yes". - return reply.find("yes") == 0; + return (reply.find("yes") == 0) ? IS_DEFAULT_BROWSER : NOT_DEFAULT_BROWSER; } bool ShellIntegration::IsFirefoxDefaultBrowser() { -- cgit v1.1