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

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
« chrome/installer/util/shell_util.h ('K') | « chrome/installer/util/shell_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6df41f6de6b0d9435efb01d970efda17c375695f 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -39,7 +39,6 @@
#include "base/win/windows_version.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/master_preferences.h"
@@ -218,7 +217,9 @@ class RegistryEntry {
const string16& suffix,
ScopedVector<RegistryEntry>* entries) {
string16 icon_path(
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex()));
+ ShellUtil::FormatIconLocation(
+ chrome_exe,
+ BrowserDistribution::SHORTCUT_CHROME));
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 +317,7 @@ class RegistryEntry {
// resource for name, description, and company.
entries->push_back(new RegistryEntry(
chrome_application, ShellUtil::kRegApplicationName,
- dist->GetAppShortCutName()));
+ dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME)));
gab 2013/06/18 19:50:29 DisplayName()
calamity 2013/06/27 01:27:44 Done.
entries->push_back(new RegistryEntry(
chrome_application, ShellUtil::kRegApplicationDescription,
dist->GetAppDescription()));
@@ -349,7 +350,9 @@ class RegistryEntry {
const string16& suffix,
ScopedVector<RegistryEntry>* entries) {
const string16 icon_path(
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex()));
+ ShellUtil::FormatIconLocation(
+ chrome_exe,
+ BrowserDistribution::SHORTCUT_CHROME));
const string16 quoted_exe_path(L"\"" + chrome_exe + L"\"");
// Register for the Start Menu "Internet" link (pre-Win7).
@@ -358,7 +361,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->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME)));
gab 2013/06/18 19:50:29 DisplayName()
calamity 2013/06/27 01:27:44 Done.
// 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 +398,7 @@ class RegistryEntry {
capabilities, ShellUtil::kRegApplicationIcon, icon_path));
entries->push_back(new RegistryEntry(
capabilities, ShellUtil::kRegApplicationName,
- dist->GetAppShortCutName()));
+ dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME)));
gab 2013/06/18 19:50:29 DisplayName()
calamity 2013/06/27 01:27:44 Done.
entries->push_back(new RegistryEntry(capabilities + L"\\Startmenu",
L"StartMenuInternet", reg_app_name));
@@ -500,7 +504,9 @@ class RegistryEntry {
// Protocols associations.
string16 chrome_open = ShellUtil::GetChromeShellOpenCmd(chrome_exe);
string16 chrome_icon =
- ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex());
+ ShellUtil::FormatIconLocation(
+ chrome_exe,
+ BrowserDistribution::SHORTCUT_CHROME);
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,
+ BrowserDistribution::SHORTCUT_CHROME));
RegistryEntry::GetXPStyleUserProtocolEntries(protocol, chrome_icon,
chrome_open, &entries);
// Change the default protocol handler for current user.
@@ -918,17 +926,19 @@ 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->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME). 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())
+ if (properties.has_shortcut_name()) {
shortcut_name = properties.shortcut_name;
- else
- shortcut_name = dist->GetAppShortCutName();
+ } else {
+ shortcut_name =
+ dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME);
+ }
if (!EndsWith(shortcut_name, installer::kLnkExt, false))
shortcut_name.append(installer::kLnkExt);
@@ -1396,8 +1406,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.
gab 2013/06/18 19:50:29 Isn't this the case already?
calamity 2013/06/27 01:27:44 Done.
+ *path = path->Append(
+ dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME));
+ }
return true;
}
@@ -1490,11 +1504,13 @@ bool ShellUtil::CreateOrUpdateShortcut(
return ret;
}
-string16 ShellUtil::FormatIconLocation(const string16& icon_path,
- int icon_index) {
+string16 ShellUtil::FormatIconLocation(
+ const string16& icon_path,
+ BrowserDistribution::ShortcutEnum shortcut_enum) {
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
string16 icon_string(icon_path);
icon_string.append(L",");
- icon_string.append(base::IntToString16(icon_index));
+ icon_string.append(base::IntToString16(dist->GetIconIndex(shortcut_enum)));
return icon_string;
}
« chrome/installer/util/shell_util.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