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

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

Issue 15255004: Refactor of BrowserDistribution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rework Created 7 years, 7 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 273c7f0324170eda2e0fbd7b474fd1c4ac6dc724..ec21a77c97b879652b49ded71ebe0ecdcf6769d6 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -218,7 +218,10 @@ class RegistryEntry {
const string16& suffix,
ScopedVector<RegistryEntry>* entries) {
string16 icon_path(
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex()));
+ ShellUtil::FormatIconLocation(
+ chrome_exe,
+ dist->GetShortcutInfo(
+ BrowserDistribution::SHORTCUT_CHROME).icon_index));
string16 open_cmd(ShellUtil::GetChromeShellOpenCmd(chrome_exe));
string16 delegate_command(ShellUtil::GetChromeDelegateCommand(chrome_exe));
// For user-level installs: entries for the app id and DelegateExecute verb
@@ -316,7 +319,7 @@ class RegistryEntry {
// resource for name, description, and company.
entries->push_back(new RegistryEntry(
chrome_application, ShellUtil::kRegApplicationName,
- dist->GetAppShortCutName()));
+ dist->GetDisplayName()));
entries->push_back(new RegistryEntry(
chrome_application, ShellUtil::kRegApplicationDescription,
dist->GetAppDescription()));
@@ -349,7 +352,8 @@ class RegistryEntry {
const string16& suffix,
ScopedVector<RegistryEntry>* entries) {
const string16 icon_path(
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex()));
+ ShellUtil::FormatIconLocation(chrome_exe, dist->
+ GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index));
const string16 quoted_exe_path(L"\"" + chrome_exe + L"\"");
// Register for the Start Menu "Internet" link (pre-Win7).
@@ -358,7 +362,8 @@ 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_back(new RegistryEntry(
- start_menu_entry, dist->GetAppShortCutName()));
+ start_menu_entry,
+ dist->GetDisplayName()));
// Register the "open" verb for launching Chrome via the "Internet" link.
entries->push_back(new RegistryEntry(
start_menu_entry + ShellUtil::kRegShellOpen, quoted_exe_path));
@@ -394,7 +399,7 @@ class RegistryEntry {
capabilities, ShellUtil::kRegApplicationIcon, icon_path));
entries->push_back(new RegistryEntry(
capabilities, ShellUtil::kRegApplicationName,
- dist->GetAppShortCutName()));
+ dist->GetDisplayName()));
entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu",
L"StartMenuInternet", reg_app_name));
@@ -500,7 +505,8 @@ class RegistryEntry {
// Protocols associations.
string16 chrome_open = ShellUtil::GetChromeShellOpenCmd(chrome_exe);
string16 chrome_icon =
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex());
+ ShellUtil::FormatIconLocation(chrome_exe, dist->
+ GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index);
for (int i = 0; ShellUtil::kBrowserProtocolAssociations[i] != NULL; i++) {
GetXPStyleUserProtocolEntries(ShellUtil::kBrowserProtocolAssociations[i],
chrome_icon, chrome_open, entries);
@@ -905,7 +911,9 @@ bool RegisterChromeAsDefaultProtocolClientXPStyle(BrowserDistribution* dist,
ScopedVector<RegistryEntry> entries;
const string16 chrome_open(ShellUtil::GetChromeShellOpenCmd(chrome_exe));
const string16 chrome_icon(
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex()));
+ ShellUtil::FormatIconLocation(chrome_exe,
+ dist->
+ GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).icon_index));
RegistryEntry::GetXPStyleUserProtocolEntries(protocol, chrome_icon,
chrome_open, &entries);
// Change the default protocol handler for current user.
@@ -918,17 +926,15 @@ bool RegisterChromeAsDefaultProtocolClientXPStyle(BrowserDistribution* dist,
}
// Returns |properties.shortcut_name| if the property is set, otherwise it
-// returns dist->GetAppShortcutName(). In any case, it makes sure the
-// return value is suffixed with ".lnk".
+// returns dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name. In
+// any case, it makes sure the return value is suffixed with ".lnk".
string16 ExtractShortcutNameFromProperties(
BrowserDistribution* dist,
const ShellUtil::ShortcutProperties& properties) {
DCHECK(dist);
- string16 shortcut_name;
- if (properties.has_shortcut_name())
- shortcut_name = properties.shortcut_name;
- else
- shortcut_name = dist->GetAppShortCutName();
+ string16 shortcut_name(
+ properties.has_shortcut_name() ? properties.shortcut_name :
+ dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name);
if (!EndsWith(shortcut_name, installer::kLnkExt, false))
shortcut_name.append(installer::kLnkExt);
@@ -1396,8 +1402,12 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location,
return false;
}
- if (add_folder_for_dist)
- *path = path->Append(dist->GetAppShortCutName());
+ if (add_folder_for_dist) {
+ // TODO(calamity): Change to GetStartMenuShortcutSubfolder() once it is
+ // implemented across all distributions.
+ *path = path->Append(
+ dist->GetShortcutInfo(BrowserDistribution::SHORTCUT_CHROME).name);
+ }
return true;
}
« chrome/installer/util/google_chrome_sxs_distribution.cc ('K') | « chrome/installer/util/product.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698