diff options
author | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 23:39:58 +0000 |
---|---|---|
committer | mdm@chromium.org <mdm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-04 23:39:58 +0000 |
commit | 264f74d108c0ebe22e633735606a4b8515a34400 (patch) | |
tree | 7bbe511e816955a1bac5cac1cf043d521b69ba4b /chrome/browser/shell_integration.cc | |
parent | 8ecce8712d3f7ff8051340dfbebf20872b86e372 (diff) | |
download | chromium_src-264f74d108c0ebe22e633735606a4b8515a34400.zip chromium_src-264f74d108c0ebe22e633735606a4b8515a34400.tar.gz chromium_src-264f74d108c0ebe22e633735606a4b8515a34400.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/shell_integration.cc')
-rw-r--r-- | chrome/browser/shell_integration.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index 219ce77..66833854 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -44,15 +44,15 @@ void ShellIntegration::DefaultBrowserWorker::ObserverDestroyed() { void ShellIntegration::DefaultBrowserWorker::ExecuteCheckDefaultBrowser() { DCHECK(MessageLoop::current() == file_loop_); - bool is_default = ShellIntegration::IsDefaultBrowser(); + DefaultBrowserState state = ShellIntegration::IsDefaultBrowser(); ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &DefaultBrowserWorker::CompleteCheckDefaultBrowser, is_default)); + &DefaultBrowserWorker::CompleteCheckDefaultBrowser, state)); } void ShellIntegration::DefaultBrowserWorker::CompleteCheckDefaultBrowser( - bool is_default) { + DefaultBrowserState state) { DCHECK(MessageLoop::current() == ui_loop_); - UpdateUI(is_default); + UpdateUI(state); } void ShellIntegration::DefaultBrowserWorker::ExecuteSetAsDefaultBrowser() { @@ -70,10 +70,21 @@ void ShellIntegration::DefaultBrowserWorker::CompleteSetAsDefaultBrowser() { } } -void ShellIntegration::DefaultBrowserWorker::UpdateUI(bool is_default) { +void ShellIntegration::DefaultBrowserWorker::UpdateUI( + DefaultBrowserState state) { if (observer_) { - DefaultBrowserUIState state = - is_default ? STATE_DEFAULT : STATE_NOT_DEFAULT; - observer_->SetDefaultBrowserUIState(state); + switch (state) { + case NOT_DEFAULT_BROWSER: + observer_->SetDefaultBrowserUIState(STATE_NOT_DEFAULT); + break; + case IS_DEFAULT_BROWSER: + observer_->SetDefaultBrowserUIState(STATE_IS_DEFAULT); + break; + case UNKNOWN_DEFAULT_BROWSER: + observer_->SetDefaultBrowserUIState(STATE_UNKNOWN); + break; + default: + break; + } } } |