summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorcpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 21:55:44 +0000
committercpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 21:55:44 +0000
commitcdd24e1db2da2fa61261ff78278ce2961a320b84 (patch)
treec47786e883c99acca5fe520055ed6a42184b16e3 /chrome/installer
parent11c49d070cd2b1468a8224aabfabef24a094a488 (diff)
downloadchromium_src-cdd24e1db2da2fa61261ff78278ce2961a320b84.zip
chromium_src-cdd24e1db2da2fa61261ff78278ce2961a320b84.tar.gz
chromium_src-cdd24e1db2da2fa61261ff78278ce2961a320b84.tar.bz2
Wire the alternate desktop shortcut text
- second set of changes, one small one to come - adds a parameter on the desktop shortcut creator function that indicate the text to use - plumbs the master preference and the command line parameter BUG=1522969 Review URL: http://codereview.chromium.org/42586 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/main.cc4
-rw-r--r--chrome/installer/setup/setup.cc7
-rw-r--r--chrome/installer/setup/uninstall.cc14
-rw-r--r--chrome/installer/util/browser_distribution.cc4
-rw-r--r--chrome/installer/util/browser_distribution.h2
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc5
-rw-r--r--chrome/installer/util/google_chrome_distribution.h2
-rw-r--r--chrome/installer/util/google_chrome_distribution_unittest.cc11
-rw-r--r--chrome/installer/util/shell_util.cc17
-rw-r--r--chrome/installer/util/shell_util.h13
-rw-r--r--chrome/installer/util/util_constants.cc3
-rw-r--r--chrome/installer/util/util_constants.h7
12 files changed, 70 insertions, 19 deletions
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 3341a06..2b57887 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -254,6 +254,10 @@ int GetInstallOptions(const CommandLine& cmd_line) {
cmd_line.HasSwitch(installer_util::switches::kVerboseLogging))
options |= installer_util::VERBOSE_LOGGING;
+ if (preferences & installer_util::MASTER_PROFILE_ALT_SHORTCUT_TXT ||
+ cmd_line.HasSwitch(installer_util::switches::kAltDesktopShortcut))
+ options |= installer_util::ALT_DESKTOP_SHORTCUT;
+
return options;
}
diff --git a/chrome/installer/setup/setup.cc b/chrome/installer/setup/setup.cc
index 2ef653a..32aa152 100644
--- a/chrome/installer/setup/setup.cc
+++ b/chrome/installer/setup/setup.cc
@@ -164,14 +164,17 @@ bool CreateOrUpdateChromeShortcuts(const std::wstring& exe_path,
// is specified we want to create them, otherwise we update them only if
// they exist.
bool create = (options & installer_util::CREATE_ALL_SHORTCUTS) != 0;
+ // In some cases the main desktop shortcut has an alternate name.
+ bool alt_shortcut = (options & installer_util::ALT_DESKTOP_SHORTCUT) != 0;
+
if (system_install) {
ret = ret && ShellUtil::CreateChromeDesktopShortcut(chrome_exe,
- product_desc, ShellUtil::SYSTEM_LEVEL, create);
+ product_desc, ShellUtil::SYSTEM_LEVEL, alt_shortcut, create);
ret = ret && ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe,
ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, create);
} else {
ret = ret && ShellUtil::CreateChromeDesktopShortcut(chrome_exe,
- product_desc, ShellUtil::CURRENT_USER, create);
+ product_desc, ShellUtil::CURRENT_USER, alt_shortcut, create);
ret = ret && ShellUtil::CreateChromeQuickLaunchShortcut(chrome_exe,
ShellUtil::CURRENT_USER, create);
}
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index e2ec9d18..138f1da 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -60,17 +60,25 @@ void CloseAllChromeProcesses() {
// This method deletes Chrome shortcut folder from Windows Start menu. It
// checks system_uninstall to see if the shortcut is in all users start menu
// or current user start menu.
+// We try to remove the standard desktop shortcut but if that fails we try
+// to remove the alternate desktop shortcut. Only one of them should be
+// present in a given install but at this point we don't know which one.
void DeleteChromeShortcut(bool system_uninstall) {
std::wstring shortcut_path;
if (system_uninstall) {
PathService::Get(base::DIR_COMMON_START_MENU, &shortcut_path);
- ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER |
- ShellUtil::SYSTEM_LEVEL);
+ if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER |
+ ShellUtil::SYSTEM_LEVEL, false))
+ ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER |
+ ShellUtil::SYSTEM_LEVEL, true);
+
ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER |
ShellUtil::SYSTEM_LEVEL);
} else {
PathService::Get(base::DIR_START_MENU, &shortcut_path);
- ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER);
+ if (!ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, false))
+ ShellUtil::RemoveChromeDesktopShortcut(ShellUtil::CURRENT_USER, true);
+
ShellUtil::RemoveChromeQuickLaunchShortcut(ShellUtil::CURRENT_USER);
}
if (shortcut_path.empty()) {
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index f98e366..fa7faae 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -30,6 +30,10 @@ std::wstring BrowserDistribution::GetApplicationName() {
return L"Chromium";
}
+std::wstring BrowserDistribution::GetAlternateApplicationName() {
+ return L"The Internet";
+}
+
std::wstring BrowserDistribution::GetInstallSubDir() {
return L"Chromium";
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 3ff74a3..3746517 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -22,6 +22,8 @@ class BrowserDistribution {
virtual std::wstring GetApplicationName();
+ virtual std::wstring GetAlternateApplicationName();
+
virtual std::wstring GetInstallSubDir();
virtual std::wstring GetPublisherName();
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index b3ad065..d2fb9f51 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -164,6 +164,11 @@ std::wstring GoogleChromeDistribution::GetApplicationName() {
return product_name;
}
+std::wstring GoogleChromeDistribution::GetAlternateApplicationName() {
+ // TODO(cpu): return the right localized strings when it arrives.
+ return L"";
+}
+
std::wstring GoogleChromeDistribution::GetInstallSubDir() {
return L"Google\\Chrome";
}
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index 1dc53a5..b2f67c6 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -22,6 +22,8 @@ class GoogleChromeDistribution : public BrowserDistribution {
virtual std::wstring GetApplicationName();
+ virtual std::wstring GetAlternateApplicationName();
+
virtual std::wstring GetInstallSubDir();
// This method generates the new value for Google Update "ap" key for Chrome
diff --git a/chrome/installer/util/google_chrome_distribution_unittest.cc b/chrome/installer/util/google_chrome_distribution_unittest.cc
index de437f4..c2064c3 100644
--- a/chrome/installer/util/google_chrome_distribution_unittest.cc
+++ b/chrome/installer/util/google_chrome_distribution_unittest.cc
@@ -14,6 +14,7 @@
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_chrome_distribution.h"
#include "chrome/installer/util/master_preferences.h"
+#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/work_item_list.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -275,5 +276,15 @@ TEST(BrowserDistribution, StringsTest) {
ASSERT_TRUE(dist != NULL);
std::wstring name = dist->GetApplicationName();
std::wstring desc = dist->GetAppDescription();
+ std::wstring alt_name = dist->GetAlternateApplicationName();
// TODO(cpu) finish the test when the translated strings arrive.
}
+
+TEST(BrowserDistribution, AlternateAndNormalShortcutName) {
+ std::wstring normal_name;
+ std::wstring alternate_name;
+ EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&normal_name, false));
+ EXPECT_TRUE(ShellUtil::GetChromeShortcutName(&alternate_name, true));
+ EXPECT_NE(normal_name, alternate_name);
+}
+
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 5627cc3..290ad17 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -445,9 +445,10 @@ std::wstring ShellUtil::GetChromeInstallExtensionCmd(
return L"\"" + chrome_exe + L"\" --install-extension=\"%1\"";
}
-bool ShellUtil::GetChromeShortcutName(std::wstring* shortcut) {
+bool ShellUtil::GetChromeShortcutName(std::wstring* shortcut, bool alternate) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- shortcut->assign(dist->GetApplicationName());
+ shortcut->assign(alternate ? dist->GetAlternateApplicationName() :
+ dist->GetApplicationName());
shortcut->append(L".lnk");
return true;
}
@@ -494,10 +495,10 @@ bool ShellUtil::GetQuickLaunchPath(bool system_level, std::wstring* path) {
bool ShellUtil::CreateChromeDesktopShortcut(const std::wstring& chrome_exe,
const std::wstring& description,
- int shell_change,
+ int shell_change, bool alternate,
bool create_new) {
std::wstring shortcut_name;
- if (!ShellUtil::GetChromeShortcutName(&shortcut_name))
+ if (!ShellUtil::GetChromeShortcutName(&shortcut_name, alternate))
return false;
bool ret = true;
@@ -530,7 +531,7 @@ bool ShellUtil::CreateChromeQuickLaunchShortcut(const std::wstring& chrome_exe,
int shell_change,
bool create_new) {
std::wstring shortcut_name;
- if (!ShellUtil::GetChromeShortcutName(&shortcut_name))
+ if (!ShellUtil::GetChromeShortcutName(&shortcut_name, false))
return false;
bool ret = true;
@@ -604,9 +605,9 @@ bool ShellUtil::MakeChromeDefault(int shell_change,
return ret;
}
-bool ShellUtil::RemoveChromeDesktopShortcut(int shell_change) {
+bool ShellUtil::RemoveChromeDesktopShortcut(int shell_change, bool alternate) {
std::wstring shortcut_name;
- if (!ShellUtil::GetChromeShortcutName(&shortcut_name))
+ if (!ShellUtil::GetChromeShortcutName(&shortcut_name, alternate))
return false;
bool ret = true;
@@ -634,7 +635,7 @@ bool ShellUtil::RemoveChromeDesktopShortcut(int shell_change) {
bool ShellUtil::RemoveChromeQuickLaunchShortcut(int shell_change) {
std::wstring shortcut_name;
- if (!ShellUtil::GetChromeShortcutName(&shortcut_name))
+ if (!ShellUtil::GetChromeShortcutName(&shortcut_name, false))
return false;
bool ret = true;
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index f8d015d..6b2d3cc 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -109,11 +109,12 @@ class ShellUtil {
// Desktop folder of current user's profile.
// If shell_change is SYSTEM_LEVEL, the shortcut is created in the
// Desktop folder of "All Users" profile.
+ // If alternate is true, an alternate text for the shortcut is used.
// create_new: If false, will only update the shortcut. If true, the function
// will create a new shortcut if it doesn't exist already.
static bool CreateChromeDesktopShortcut(const std::wstring& chrome_exe,
const std::wstring& description,
- int shell_change,
+ int shell_change, bool alternate,
bool create_new);
// Create Chrome shortcut on Quick Launch Bar.
@@ -145,8 +146,10 @@ class ShellUtil {
static std::wstring GetChromeInstallExtensionCmd(
const std::wstring& chrome_exe);
- // Returns the localized name of Chrome shortcut.
- static bool GetChromeShortcutName(std::wstring* shortcut);
+ // Returns the localized name of Chrome shortcut. If |alternate| is true
+ // it returns a second localized text that is better suited for certain
+ // scenarios.
+ static bool GetChromeShortcutName(std::wstring* shortcut, bool alternate);
// Gets the desktop path for the current user or all users (if system_level
// is true) and returns it in 'path' argument. Return true if successful,
@@ -177,7 +180,9 @@ class ShellUtil {
// Desktop folder of current user's profile.
// If shell_change is SYSTEM_LEVEL, the shortcut is removed from the
// Desktop folder of "All Users" profile.
- static bool RemoveChromeDesktopShortcut(int shell_change);
+ // If alternate is true, the shortcut with the alternate name is removed. See
+ // CreateChromeDesktopShortcut() for more information.
+ static bool RemoveChromeDesktopShortcut(int shell_change, bool alternate);
// Remove Chrome shortcut from Quick Launch Bar.
// If shell_change is CURRENT_USER, the shortcut is removed from
diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc
index e10a284..d667cbb 100644
--- a/chrome/installer/util/util_constants.cc
+++ b/chrome/installer/util/util_constants.cc
@@ -69,6 +69,9 @@ const wchar_t kVerboseLogging[] = L"verbose-logging";
// Show the embedded EULA dialog.
const wchar_t kShowEula[] = L"show-eula";
+// Use the alternate desktop shortcut name
+const wchar_t kAltDesktopShortcut[] = L"alt-desktop-shortcut";
+
} // namespace switches
const wchar_t kInstallBinaryDir[] = L"Application";
diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h
index b9d7275..3cc3fb6 100644
--- a/chrome/installer/util/util_constants.h
+++ b/chrome/installer/util/util_constants.h
@@ -40,7 +40,7 @@ enum InstallStatus {
INSTALL_DIR_IN_USE // Installation directory is in use by another process
};
-// These are distibution related install options specified through command
+// These are distribution related install options specified through command
// line switches (see below) or master preference file (see
// chrome/installer/util/master_preference.h). The options can be combined,
// so they are bit flags.
@@ -60,7 +60,9 @@ enum InstallOption {
// Run installer in verbose mode.
VERBOSE_LOGGING = 0x1 << 6,
// Show the EULA dialog.
- SHOW_EULA_DIALOG = 0x1 << 7
+ SHOW_EULA_DIALOG = 0x1 << 7,
+ // Use alternate dekstop shortcut text.
+ ALT_DESKTOP_SHORTCUT = 0x1 << 8
};
namespace switches {
@@ -81,6 +83,7 @@ extern const wchar_t kSystemLevel[];
extern const wchar_t kUninstall[];
extern const wchar_t kVerboseLogging[];
extern const wchar_t kShowEula[];
+extern const wchar_t kAltDesktopShortcut[];
} // namespace switches
extern const wchar_t kInstallBinaryDir[];