Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1999)

Unified Diff: chrome/browser/shell_integration_win.cc

Issue 200025: Allow the default browser check to return "unknown" and reflect that in the UI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/shell_integration_win.cc
===================================================================
--- chrome/browser/shell_integration_win.cc (revision 25499)
+++ chrome/browser/shell_integration_win.cc (working copy)
@@ -44,13 +44,13 @@
return true;
}
-bool ShellIntegration::IsDefaultBrowser() {
+ShellIntegration::DefaultBrowserState ShellIntegration::IsDefaultBrowser() {
// First determine the app path. If we can't determine what that is, we have
// bigger fish to fry...
std::wstring app_path;
if (!PathService::Get(base::FILE_EXE, &app_path)) {
LOG(ERROR) << "Error getting app exe path";
- return false;
+ return UNKNOWN_DEFAULT_BROWSER;
}
// 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,
@@ -69,7 +69,7 @@
NULL, CLSCTX_INPROC, __uuidof(IApplicationAssociationRegistration),
(void**)&pAAR);
if (!SUCCEEDED(hr))
- return false;
+ return UNKNOWN_DEFAULT_BROWSER;
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
std::wstring app_name = dist->GetApplicationName();
@@ -84,10 +84,14 @@
BOOL result = TRUE;
hr = pAAR->QueryAppIsDefault(kChromeProtocols[i].c_str(), AT_URLPROTOCOL,
AL_EFFECTIVE, app_name.c_str(), &result);
- if (!SUCCEEDED(hr) || (result == FALSE)) {
+ if (!SUCCEEDED(hr)) {
pAAR->Release();
- return false;
+ return UNKNOWN_DEFAULT_BROWSER;
}
+ if (result == FALSE) {
+ pAAR->Release();
+ return NOT_DEFAULT_BROWSER;
+ }
}
pAAR->Release();
} else {
@@ -105,7 +109,7 @@
RegKey key(root_key, key_path.c_str(), KEY_READ);
std::wstring value;
if (!key.Valid() || !key.ReadValue(L"", &value))
- return false;
+ return NOT_DEFAULT_BROWSER; // Or UNKNOWN_DEFAULT_BROWSER?
Evan Martin 2009/09/04 22:46:15 If this registry key is something we set when we *
Mike Mammarella 2009/09/04 22:56:27 I looked through the RegKey source but it wasn't c
kuchhal 2009/09/04 23:05:12 These are keys like <root>\Software\Classes\http\s
// Need to normalize path in case it's been munged.
CommandLine command_line(L"");
command_line.ParseFromString(value);
@@ -117,10 +121,10 @@
short_path.end(),
short_app_path.begin(),
CaseInsensitiveCompare<wchar_t>())))
- return false;
+ return NOT_DEFAULT_BROWSER;
}
}
- return true;
+ return IS_DEFAULT_BROWSER;
}
// There is no reliable way to say which browser is default on a machine (each

Powered by Google App Engine
This is Rietveld 408576698