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

Unified Diff: chrome/browser/shell_integration.cc

Issue 159172: Allow two user level installs of Chrome to have default browser settings. (Closed)
Patch Set: update comment. Created 11 years, 5 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
« no previous file with comments | « no previous file | chrome/installer/setup/install.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration.cc
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index ebcadbd1c45853cc25c1c4361ca6c8bb85c8be8d..6f1957a74f78536cee3f142d7f167773b7f65c64 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -33,15 +33,9 @@ bool ShellIntegration::SetAsDefaultBrowser() {
return false;
}
- ShellUtil::RegisterStatus register_status =
- ShellUtil::AddChromeToSetAccessDefaults(chrome_exe, false);
- if (register_status == ShellUtil::FAILURE) {
- LOG(ERROR) << "Chrome could not be registered on the machine.";
- return false;
- }
-
// From UI currently we only allow setting default browser for current user.
- if (!ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER, chrome_exe)) {
+ if (!ShellUtil::MakeChromeDefault(ShellUtil::CURRENT_USER,
+ chrome_exe, true)) {
LOG(ERROR) << "Chrome could not be set as default browser.";
return false;
}
@@ -77,14 +71,22 @@ bool ShellIntegration::IsDefaultBrowser() {
if (!SUCCEEDED(hr))
return false;
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring app_name = dist->GetApplicationName();
+ std::wstring app_name_with_suffix;
+ ShellUtil::GetUserSpecificDefaultBrowserSuffix(&app_name_with_suffix);
+ app_name_with_suffix = app_name + app_name_with_suffix;
for (int i = 0; i < _countof(kChromeProtocols); i++) {
BOOL result = TRUE;
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
hr = pAAR->QueryAppIsDefault(kChromeProtocols[i].c_str(), AT_URLPROTOCOL,
- AL_EFFECTIVE, dist->GetApplicationName().c_str(), &result);
+ AL_EFFECTIVE, app_name_with_suffix.c_str(), &result);
if (!SUCCEEDED(hr) || (result == FALSE)) {
- pAAR->Release();
- return false;
+ hr = pAAR->QueryAppIsDefault(kChromeProtocols[i].c_str(),
+ AT_URLPROTOCOL, AL_EFFECTIVE, app_name.c_str(), &result);
+ if (!SUCCEEDED(hr) || (result == FALSE)) {
+ pAAR->Release();
+ return false;
+ }
}
}
pAAR->Release();
« no previous file with comments | « no previous file | chrome/installer/setup/install.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698