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.h | |
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.h')
-rw-r--r-- | chrome/browser/shell_integration.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 2bc955c..daecacf 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -21,11 +21,21 @@ class ShellIntegration { // this operation fails. static bool SetAsDefaultBrowser(); - // Returns true if this instance of Chrome is the default browser. (Defined - // as being the handler for the http/https protocols... we don't want to - // report false here if the user has simply chosen to open HTML files in a - // text editor and ftp links with a FTP client). - static bool IsDefaultBrowser(); + // On Linux, it may not be possible to determine or set the default browser + // on some desktop environments or configurations. So, we use this enum and + // not a plain bool. (Note however that if used like a bool, this enum will + // have reasonable behavior.) + enum DefaultBrowserState { + NOT_DEFAULT_BROWSER = 0, + IS_DEFAULT_BROWSER, + UNKNOWN_DEFAULT_BROWSER + }; + + // Attempt to determine if this instance of Chrome is the default browser and + // return the appropriate state. (Defined as being the handler for HTTP/HTTPS + // protocols; we don't want to report "no" here if the user has simply chosen + // to open HTML files in a text editor and FTP links with an FTP client.) + static DefaultBrowserState IsDefaultBrowser(); // Returns true if Firefox is likely to be the default browser for the current // user. This method is very fast so it can be invoked in the UI thread. @@ -59,8 +69,9 @@ class ShellIntegration { // The current default browser UI state enum DefaultBrowserUIState { STATE_PROCESSING, - STATE_DEFAULT, - STATE_NOT_DEFAULT + STATE_NOT_DEFAULT, + STATE_IS_DEFAULT, + STATE_UNKNOWN }; class DefaultBrowserObserver { @@ -95,7 +106,7 @@ class ShellIntegration { // thread. |CompleteCheckDefaultBrowser| notifies the view to update on the // UI thread. void ExecuteCheckDefaultBrowser(); - void CompleteCheckDefaultBrowser(bool is_default); + void CompleteCheckDefaultBrowser(DefaultBrowserState state); // Functions that track the process of setting Chrome as the default // browser. |ExecuteSetAsDefaultBrowser| updates the registry on the file @@ -106,7 +117,7 @@ class ShellIntegration { // Updates the UI in our associated view with the current default browser // state. - void UpdateUI(bool is_default); + void UpdateUI(DefaultBrowserState state); DefaultBrowserObserver* observer_; |