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

Unified Diff: chrome/installer/util/shell_util.cc

Issue 10446111: Abstract suffixing logic away from GetApplicationName (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2012 Created 8 years, 6 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/installer/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index bc3d86d46e19520edbb9ea6e8f0db1a4a48b46f4..53c63886429c221b2f311ea4a93f39bd892a9f8f 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -93,7 +93,7 @@ class RegistryEntry {
DCHECK(suffix.empty() || suffix[0] == L'.');
return string16(ShellUtil::kRegStartMenuInternet)
.append(1, L'\\')
- .append(dist->GetApplicationName())
+ .append(dist->GetBaseAppName())
.append(suffix);
}
@@ -197,7 +197,7 @@ class RegistryEntry {
// resource for name, description, and company.
entries->push_front(new RegistryEntry(
chrome_application, ShellUtil::kRegApplicationName,
- dist->GetApplicationName().append(suffix)));
+ dist->GetAppShortCutName().append(suffix)));
entries->push_front(new RegistryEntry(
chrome_application, ShellUtil::kRegApplicationDescription,
dist->GetAppDescription()));
@@ -236,7 +236,7 @@ class RegistryEntry {
// TODO(grt): http://crbug.com/75152 Also set LocalizedString; see
// http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109(v=VS.85).aspx#registering_the_display_name
entries->push_front(new RegistryEntry(
- start_menu_entry, dist->GetApplicationName()));
+ start_menu_entry, dist->GetAppShortCutName()));
// Register the "open" verb for launching Chrome via the "Internet" link.
entries->push_front(new RegistryEntry(
start_menu_entry + ShellUtil::kRegShellOpen, quoted_exe_path));
@@ -257,7 +257,7 @@ class RegistryEntry {
entries->push_front(new RegistryEntry(install_info, L"IconsVisible", 1));
// Register with Default Programs.
- string16 reg_app_name(dist->GetApplicationName().append(suffix));
+ string16 reg_app_name(dist->GetBaseAppName().append(suffix));
// Tell Windows where to find Chrome's Default Programs info.
string16 capabilities(GetCapabilitiesKey(dist, suffix));
entries->push_front(new RegistryEntry(ShellUtil::kRegRegisteredApplications,
@@ -366,7 +366,7 @@ class RegistryEntry {
// start->Internet shortcut.
string16 start_menu(ShellUtil::kRegStartMenuInternet);
- string16 app_name = dist->GetApplicationName() + suffix;
+ string16 app_name = dist->GetBaseAppName() + suffix;
entries->push_front(new RegistryEntry(start_menu, app_name));
return true;
}
@@ -930,7 +930,7 @@ void ShellUtil::GetRegisteredBrowsers(
continue;
}
if (!name.empty() && !command.empty() &&
- name.find(dist->GetApplicationName()) == string16::npos)
+ name.find(dist->GetBaseAppName()) == string16::npos)
(*browsers)[name] = command;
}
}
@@ -997,6 +997,13 @@ bool ShellUtil::QuickIsChromeRegistered(
return false;
}
+string16 ShellUtil::GetApplicationName(BrowserDistribution* dist,
+ const string16& chrome_exe) {
+ string16 app_name = dist->GetBaseAppName();
+ app_name += GetCurrentInstallationSuffix(dist, chrome_exe);
+ return app_name;
+}
+
bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
int shell_change,
const string16& chrome_exe,
@@ -1012,10 +1019,7 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
bool ret = true;
// First use the new "recommended" way on Vista to make Chrome default
// browser.
- string16 app_name = dist->GetApplicationName();
- const string16 app_suffix(
- ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe));
- app_name += app_suffix;
+ string16 app_name = GetApplicationName(dist, chrome_exe);
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
// On Windows 8, you can't set yourself as the default handler
@@ -1065,7 +1069,10 @@ bool ShellUtil::MakeChromeDefault(BrowserDistribution* dist,
std::list<RegistryEntry*> entries;
STLElementDeleter<std::list<RegistryEntry*> > entries_deleter(&entries);
- RegistryEntry::GetUserEntries(dist, chrome_exe, app_suffix, &entries);
+ RegistryEntry::GetUserEntries(dist,
+ chrome_exe,
+ GetCurrentInstallationSuffix(dist, chrome_exe),
+ &entries);
// Change the default browser for current user.
if ((shell_change & ShellUtil::CURRENT_USER) &&
!AddRegistryEntries(HKEY_CURRENT_USER, entries)) {
@@ -1104,9 +1111,7 @@ bool ShellUtil::MakeChromeDefaultProtocolClient(BrowserDistribution* dist,
HRESULT hr = pAAR.CreateInstance(CLSID_ApplicationAssociationRegistration,
NULL, CLSCTX_INPROC);
if (SUCCEEDED(hr)) {
- string16 app_name = dist->GetApplicationName();
- app_name += ShellUtil::GetCurrentInstallationSuffix(dist, chrome_exe);
-
+ string16 app_name = GetApplicationName(dist, chrome_exe);
hr = pAAR->SetAppAsDefault(app_name.c_str(), protocol.c_str(),
AT_URLPROTOCOL);
}
« chrome/installer/util/browser_distribution.h ('K') | « chrome/installer/util/shell_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698