diff options
author | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 22:54:00 +0000 |
---|---|---|
committer | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-25 22:54:00 +0000 |
commit | fe989f1881aad3beb18ed86b18f8cb19a11910ea (patch) | |
tree | d05decd90135a3a7c2f257ef5c9dfb3ff7306738 /chrome/browser | |
parent | cfe8a11e7670c898b60961bd6f8740be3e0d0244 (diff) | |
download | chromium_src-fe989f1881aad3beb18ed86b18f8cb19a11910ea.zip chromium_src-fe989f1881aad3beb18ed86b18f8cb19a11910ea.tar.gz chromium_src-fe989f1881aad3beb18ed86b18f8cb19a11910ea.tar.bz2 |
Be more paranoid when checking the default browser in Windows and return "not default" rather than "can't tell" in most cases.
Also undo previous fixes that worked around an incorrect return value; one of them (the infobar change) regresses the Linux version to display the infobar in cases where we would not be able to set ourselves as the default anyway (which was the original reason for the change that broke things on Windows).
BUG=28429, 27403
TEST=(windows) install chrome but don't set it as the default during install, then restart it and verify that the infobar shows and chrome can still be set as the default
TEST=(linux) run chrome in an unsupported desktop environment and verify that it neither displays the infobar asking to be made the default browser nor claims that it is the default browser in options
Review URL: http://codereview.chromium.org/434022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_init.cc | 4 | ||||
-rw-r--r-- | chrome/browser/shell_integration_win.cc | 10 | ||||
-rw-r--r-- | chrome/browser/views/options/general_page_view.cc | 2 |
3 files changed, 5 insertions, 11 deletions
diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 6cb475f..847e966 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -180,10 +180,8 @@ class CheckDefaultBrowserTask : public Task { } virtual void Run() { - if (ShellIntegration::IsDefaultBrowser() == - ShellIntegration::IS_DEFAULT_BROWSER) { + if (ShellIntegration::IsDefaultBrowser()) return; - } ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, new NotifyNotDefaultBrowserTask()); diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index b340c95..1042cd4 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -69,7 +69,7 @@ ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { NULL, CLSCTX_INPROC, __uuidof(IApplicationAssociationRegistration), (void**)&pAAR); if (!SUCCEEDED(hr)) - return UNKNOWN_DEFAULT_BROWSER; + return NOT_DEFAULT_BROWSER; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); std::wstring app_name = dist->GetApplicationName(); @@ -84,11 +84,7 @@ ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { BOOL result = TRUE; hr = pAAR->QueryAppIsDefault(kChromeProtocols[i].c_str(), AT_URLPROTOCOL, AL_EFFECTIVE, app_name.c_str(), &result); - if (!SUCCEEDED(hr)) { - pAAR->Release(); - return UNKNOWN_DEFAULT_BROWSER; - } - if (result == FALSE) { + if (!SUCCEEDED(hr) || result == FALSE) { pAAR->Release(); return NOT_DEFAULT_BROWSER; } @@ -109,7 +105,7 @@ ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() { RegKey key(root_key, key_path.c_str(), KEY_READ); std::wstring value; if (!key.Valid() || !key.ReadValue(L"", &value)) - return UNKNOWN_DEFAULT_BROWSER; + return NOT_DEFAULT_BROWSER; // Need to normalize path in case it's been munged. CommandLine command_line = CommandLine::FromString(value); std::wstring short_path; diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index b672e15..305c1a2 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -645,7 +645,7 @@ void GeneralPageView::Layout() { void GeneralPageView::SetDefaultBrowserUIState( ShellIntegration::DefaultBrowserUIState state) { - bool button_enabled = state != ShellIntegration::STATE_IS_DEFAULT; + bool button_enabled = state == ShellIntegration::STATE_NOT_DEFAULT; default_browser_use_as_default_button_->SetEnabled(button_enabled); if (state == ShellIntegration::STATE_IS_DEFAULT) { default_browser_status_label_->SetText( |