diff options
author | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-14 04:22:13 +0000 |
---|---|---|
committer | calamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-14 04:22:13 +0000 |
commit | 16fcc0d188d193f2c2963988cd62427d719c3c6c (patch) | |
tree | 98b877d7b991bfc95246ffbc840c0b5d276775c8 /chrome | |
parent | 98e469afcf1adef4e3f7d81f540e735070f41981 (diff) | |
download | chromium_src-16fcc0d188d193f2c2963988cd62427d719c3c6c.zip chromium_src-16fcc0d188d193f2c2963988cd62427d719c3c6c.tar.gz chromium_src-16fcc0d188d193f2c2963988cd62427d719c3c6c.tar.bz2 |
Refactor of BrowserDistribution.
This is a precursor to https://codereview.chromium.org/13864015/.
* Added GetStartMenuShortcutSubfolder, which returns the Start Menu
subfolder path for a given subfolder.
* GetShortcutName and GetIconIndex now return data specific to a type
of shortcut (browser, alternate name of browser, or app launcher).
* GetDisplayName is now used rather than GetAppShortcutName where a
localized name is needed (e.g., in logs and the registry).
BUG=233434,238895,161985
Review URL: https://chromiumcodereview.appspot.com/15255004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
36 files changed, 344 insertions, 215 deletions
diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index 7dea610..13e837d 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -223,7 +223,9 @@ class ProfileShortcutManagerTest : public testing::Test { ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)) << location.ToString(); const base::FilePath system_level_shortcut_path = GetSystemShortcutsDirectory().Append( - distribution->GetAppShortCutName() + installer::kLnkExt); + distribution-> + GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); EXPECT_TRUE(base::PathExists(system_level_shortcut_path)) << location.ToString(); return system_level_shortcut_path; @@ -311,7 +313,8 @@ TEST_F(ProfileShortcutManagerTest, ShortcutFilenameStripsReservedCharacters) { const string16 kSanitizedProfileName = L"Harry"; BrowserDistribution* distribution = GetDistribution(); const string16 expected_name = kSanitizedProfileName + L" - " + - distribution->GetAppShortCutName() + installer::kLnkExt; + distribution->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt; EXPECT_EQ(expected_name, profiles::internal::GetShortcutFilenameForProfile(kProfileName, distribution)); @@ -319,9 +322,11 @@ TEST_F(ProfileShortcutManagerTest, ShortcutFilenameStripsReservedCharacters) { TEST_F(ProfileShortcutManagerTest, UnbadgedShortcutFilename) { BrowserDistribution* distribution = GetDistribution(); - EXPECT_EQ(distribution->GetAppShortCutName() + installer::kLnkExt, - profiles::internal::GetShortcutFilenameForProfile(string16(), - distribution)); + EXPECT_EQ( + distribution->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt, + profiles::internal::GetShortcutFilenameForProfile(string16(), + distribution)); } TEST_F(ProfileShortcutManagerTest, ShortcutFlags) { @@ -579,7 +584,8 @@ TEST_F(ProfileShortcutManagerTest, UpdateShortcutWithNoFlags) { false)); const base::FilePath regular_shortcut_path = CreateRegularShortcutWithName(FROM_HERE, - GetDistribution()->GetAppShortCutName()); + GetDistribution()->GetShortcutName( + BrowserDistribution::SHORTCUT_CHROME)); // Add another profile and check that the shortcut was replaced with // a badged shortcut with the right command line for the profile @@ -597,7 +603,8 @@ TEST_F(ProfileShortcutManagerTest, UpdateTwoShortcutsWithNoFlags) { false)); const base::FilePath regular_shortcut_path = CreateRegularShortcutWithName(FROM_HERE, - GetDistribution()->GetAppShortCutName()); + GetDistribution()->GetShortcutName( + BrowserDistribution::SHORTCUT_CHROME)); const base::FilePath customized_regular_shortcut_path = CreateRegularShortcutWithName(FROM_HERE, L"MyChrome"); diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index 48e862b..4b65d8c 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc @@ -629,7 +629,8 @@ string16 GetShortcutFilenameForProfile(const string16& profile_name, shortcut_name.append(L" - "); shortcut_name.append(l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); } else { - shortcut_name.append(distribution->GetAppShortCutName()); + shortcut_name.append( + distribution->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME)); } return shortcut_name + installer::kLnkExt; } diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h index 9abd195..f855984 100644 --- a/chrome/browser/shell_integration.h +++ b/chrome/browser/shell_integration.h @@ -166,11 +166,6 @@ class ShellIntegration { static string16 GetAppListAppModelIdForProfile( const base::FilePath& profile_path); - // Returns the location (path and index) of the Chromium icon, (e.g., - // "C:\path\to\chrome.exe,0"). This is used to specify the icon to use - // for the taskbar group on Win 7. - static string16 GetChromiumIconLocation(); - // Migrates existing chrome shortcuts by tagging them with correct app id. // see http://crbug.com/28104 static void MigrateChromiumShortcuts(); diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index cece2f1..d6de8c5 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -361,20 +361,6 @@ string16 ShellIntegration::GetAppListAppModelIdForProfile( GetAppListAppName(), profile_path); } -string16 ShellIntegration::GetChromiumIconLocation() { - // Determine the path to chrome.exe. If we can't determine what that is, - // we have bigger fish to fry... - base::FilePath chrome_exe; - if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { - NOTREACHED(); - return string16(); - } - - return ShellUtil::FormatIconLocation( - chrome_exe.value(), - BrowserDistribution::GetDistribution()->GetIconIndex()); -} - void ShellIntegration::MigrateChromiumShortcuts() { if (base::win::GetVersion() < base::win::VERSION_WIN7) return; @@ -515,7 +501,8 @@ base::FilePath ShellIntegration::GetStartMenuShortcut( base::DIR_START_MENU, }; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - string16 shortcut_name(dist->GetAppShortCutName()); + string16 shortcut_name( + dist->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME)); base::FilePath shortcut; // Check both the common and the per-user Start Menu folders for system-level diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index 8091b6e..9dd3eff 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -1001,7 +1001,9 @@ void AppListController::CreateShortcut() { shortcut_locations.in_quick_launch_bar = true; shortcut_locations.in_applications_menu = true; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - shortcut_locations.applications_menu_subdir = dist->GetAppShortCutName(); + shortcut_locations.applications_menu_subdir = + dist->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME); base::FilePath user_data_dir( g_browser_process->profile_manager()->user_data_dir()); @@ -1009,7 +1011,7 @@ void AppListController::CreateShortcut() { content::BrowserThread::FILE, FROM_HERE, base::Bind(&CreateAppListShortcuts, - user_data_dir, GetAppModelId(), shortcut_locations)); + user_data_dir, GetAppModelId(), shortcut_locations)); } void AppListController::ScheduleWarmup() { diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 15e2062..688df1c 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -87,7 +87,7 @@ void LogShortcutOperation(ShellUtil::ShortcutLocation location, if (properties.has_shortcut_name()) message.append(UTF16ToUTF8(properties.shortcut_name)); else - message.append(UTF16ToUTF8(dist->GetAppShortCutName())); + message.append(UTF16ToUTF8(dist->GetDisplayName())); message.push_back('"'); message.append(" shortcut to "); @@ -330,7 +330,7 @@ bool CreateVisualElementsManifest(const base::FilePath& src_path, BrowserDistribution::CHROME_BROWSER); // TODO(grt): http://crbug.com/75152 Write a reference to a localized // resource for |display_name|. - string16 display_name(dist->GetAppShortCutName()); + string16 display_name(dist->GetDisplayName()); EscapeXmlAttributeValueInSingleQuotes(&display_name); // Fill the manifest with the desired values. @@ -411,8 +411,11 @@ void CreateOrUpdateShortcuts( if (!do_not_create_desktop_shortcut || shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { ShellUtil::ShortcutProperties desktop_properties(base_properties); - if (alternate_desktop_shortcut) - desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName()); + if (alternate_desktop_shortcut) { + desktop_properties.set_shortcut_name( + dist->GetShortcutName( + BrowserDistribution::SHORTCUT_CHROME_ALTERNATE)); + } ExecuteAndLogShortcutOperation( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, desktop_properties, shortcut_operation); @@ -421,7 +424,9 @@ void CreateOrUpdateShortcuts( // Desktop shortcut. if (!alternate_desktop_shortcut && shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING) { - desktop_properties.set_shortcut_name(dist->GetAlternateApplicationName()); + desktop_properties.set_shortcut_name( + dist->GetShortcutName( + BrowserDistribution::SHORTCUT_CHROME_ALTERNATE)); ExecuteAndLogShortcutOperation( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, desktop_properties, shortcut_operation); diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index e992aa9..40f6ab1 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -117,23 +117,30 @@ class InstallShortcutTest : public testing::Test { new base::ScopedPathOverride(base::DIR_COMMON_START_MENU, fake_common_start_menu_.path())); - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); string16 alternate_shortcut_name( - dist_->GetAlternateApplicationName() + installer::kLnkExt); + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME_ALTERNATE) + + installer::kLnkExt); user_desktop_shortcut_ = fake_user_desktop_.path().Append(shortcut_name); user_quick_launch_shortcut_ = fake_user_quick_launch_.path().Append(shortcut_name); user_start_menu_shortcut_ = - fake_start_menu_.path().Append(dist_->GetAppShortCutName()) + fake_start_menu_.path().Append( + dist_->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME)) .Append(shortcut_name); system_desktop_shortcut_ = fake_common_desktop_.path().Append(shortcut_name); system_quick_launch_shortcut_ = fake_default_user_quick_launch_.path().Append(shortcut_name); system_start_menu_shortcut_ = - fake_common_start_menu_.path().Append(dist_->GetAppShortCutName()) + fake_common_start_menu_.path().Append( + dist_->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME)) .Append(shortcut_name); user_alternate_desktop_shortcut_ = fake_user_desktop_.path().Append(alternate_shortcut_name); diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index b625954..d987670 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -438,7 +438,8 @@ void AddDeleteUninstallShortcutsForMSIWorkItems( LOG(ERROR) << "Failed to get location for shortcut."; } else { uninstall_link = uninstall_link.Append( - product.distribution()->GetAppShortCutName()); + product.distribution()->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME)); uninstall_link = uninstall_link.Append( product.distribution()->GetUninstallLinkName() + installer::kLnkExt); VLOG(1) << "Deleting old uninstall shortcut (if present): " @@ -722,8 +723,8 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, string16 uninstall_reg = browser_dist->GetUninstallRegPath(); install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, - installer::kUninstallDisplayNameField, - browser_dist->GetAppShortCutName(), true); + installer::kUninstallDisplayNameField, browser_dist->GetDisplayName(), + true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, installer::kUninstallStringField, quoted_uninstall_cmd.GetCommandLineString(), true); @@ -736,7 +737,7 @@ void AddUninstallShortcutWorkItems(const InstallerState& installer_state, BrowserDistribution* dist = product.distribution(); string16 chrome_icon = ShellUtil::FormatIconLocation( install_path.Append(dist->GetIconFilename()).value(), - dist->GetIconIndex()); + dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L"DisplayIcon", chrome_icon, true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, @@ -786,7 +787,7 @@ void AddVersionKeyWorkItems(HKEY root, string16 version_key(dist->GetVersionKey()); list->AddCreateRegKeyWorkItem(root, version_key); - string16 product_name(dist->GetAppShortCutName()); + string16 product_name(dist->GetDisplayName()); list->AddSetRegValueWorkItem(root, version_key, google_update::kRegNameField, product_name, true); // overwrite name also list->AddSetRegValueWorkItem(root, version_key, @@ -845,7 +846,7 @@ void AddOemInstallWorkItems(const InstallationState& original_state, if (source_product->GetOemInstall(&oem_install)) { VLOG(1) << "Mirroring oeminstall=\"" << oem_install << "\" from " << BrowserDistribution::GetSpecificDistribution(source_type)-> - GetAppShortCutName(); + GetDisplayName(); install_list->AddCreateRegKeyWorkItem(root_key, multi_key); // Always overwrite an old value. install_list->AddSetRegValueWorkItem(root_key, multi_key, @@ -900,7 +901,7 @@ void AddEulaAcceptedWorkItems(const InstallationState& original_state, if (have_eula_accepted) { VLOG(1) << "Mirroring eulaaccepted=" << eula_accepted << " from " << BrowserDistribution::GetSpecificDistribution(product_type)-> - GetAppShortCutName(); + GetDisplayName(); install_list->AddCreateRegKeyWorkItem(root_key, multi_key); install_list->AddSetRegValueWorkItem( root_key, multi_key, google_update::kRegEULAAceptedField, @@ -1433,13 +1434,13 @@ void AddDelegateExecuteWorkItems(const InstallerState& installer_state, const Product& product, WorkItemList* list) { string16 handler_class_uuid; - BrowserDistribution* distribution = product.distribution(); - if (!distribution->GetCommandExecuteImplClsid(&handler_class_uuid)) { + BrowserDistribution* dist = product.distribution(); + if (!dist->GetCommandExecuteImplClsid(&handler_class_uuid)) { if (InstallUtil::IsChromeSxSProcess()) { CleanupBadCanaryDelegateExecuteRegistration(target_path, list); } else { VLOG(1) << "No DelegateExecute verb handler processing to do for " - << distribution->GetAppShortCutName(); + << dist->GetDisplayName(); } return; } @@ -1495,25 +1496,24 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, const Product& product, WorkItemList* list) { DCHECK(installer_state.operation() != InstallerState::UNINSTALL); - BrowserDistribution* distribution = product.distribution(); + BrowserDistribution* dist = product.distribution(); if (!product.is_chrome() || !installer_state.system_install()) { const char* install_level = installer_state.system_install() ? "system" : "user"; VLOG(1) << "No Active Setup processing to do for " << install_level - << "-level " << distribution->GetAppShortCutName(); + << "-level " << dist->GetDisplayName(); return; } DCHECK(installer_state.RequiresActiveSetup()); const HKEY root = HKEY_LOCAL_MACHINE; - const string16 active_setup_path( - InstallUtil::GetActiveSetupPath(distribution)); + const string16 active_setup_path(InstallUtil::GetActiveSetupPath(dist)); VLOG(1) << "Adding registration items for Active Setup."; list->AddCreateRegKeyWorkItem(root, active_setup_path); list->AddSetRegValueWorkItem(root, active_setup_path, L"", - distribution->GetAppShortCutName(), true); + dist->GetDisplayName(), true); base::FilePath active_setup_exe(installer_state.GetInstallerDirectory( new_version).Append(kActiveSetupExe)); @@ -1528,7 +1528,7 @@ void AddActiveSetupWorkItems(const InstallerState& installer_state, // TODO(grt): http://crbug.com/75152 Write a reference to a localized // resource. list->AddSetRegValueWorkItem(root, active_setup_path, L"Localized Name", - distribution->GetAppShortCutName(), true); + dist->GetDisplayName(), true); list->AddSetRegValueWorkItem(root, active_setup_path, L"IsInstalled", static_cast<DWORD>(1U), true); diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index b02fb4e..171ac7c 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -204,7 +204,7 @@ void AddExistingMultiInstalls(const InstallationState& original_state, installer_state->AddProductFromState(type, *state); VLOG(1) << "Product already installed and must be included: " << BrowserDistribution::GetSpecificDistribution(type)-> - GetAppShortCutName(); + GetDisplayName(); } } } @@ -338,9 +338,9 @@ bool CheckGroupPolicySettings(const InstallationState& original_state, &is_overridden); if (is_overridden && app_policy != binaries_policy) { LOG(ERROR) << "Found legacy Group Policy setting for " - << dist->GetAppShortCutName() << " (value: " << app_policy + << dist->GetDisplayName() << " (value: " << app_policy << ") that does not match the setting for " - << binaries_dist->GetAppShortCutName() + << binaries_dist->GetDisplayName() << " (value: " << binaries_policy << ")."; settings_are_valid = false; } @@ -355,7 +355,7 @@ bool CheckGroupPolicySettings(const InstallationState& original_state, LOG(ERROR) << "Cannot apply update on account of inconsistent " "Google Update Group Policy settings. Use the Group Policy " "Editor to set the update policy override for the " - << binaries_dist->GetAppShortCutName() + << binaries_dist->GetDisplayName() << " application and try again."; *status = installer::INCONSISTENT_UPDATE_POLICY; installer_state.WriteInstallerResult( @@ -505,7 +505,7 @@ bool CheckMultiInstallConditions(const InstallationState& original_state, // Block downgrades from multi-install to single-install. if (product_state->is_multi_install()) { LOG(ERROR) << "Multi-install " - << products[0]->distribution()->GetAppShortCutName() + << products[0]->distribution()->GetDisplayName() << " exists; aborting single install."; *status = installer::MULTI_INSTALLATION_EXISTS; installer_state->WriteInstallerResult(*status, @@ -757,7 +757,7 @@ installer::InstallStatus UninstallProduct( VLOG(1) << "version on the system: " << product_state->version().GetString(); } else if (!force_uninstall) { - LOG(ERROR) << product.distribution()->GetAppShortCutName() + LOG(ERROR) << product.distribution()->GetDisplayName() << " not found for uninstall."; return installer::CHROME_NOT_INSTALLED; } @@ -929,7 +929,7 @@ installer::InstallStatus RegisterDevChrome( static const wchar_t kPleaseUninstallYourChromeMessage[] = L"You already have a full-installation (non-dev) of %1ls, please " L"uninstall it first using Add/Remove Programs in the control panel."; - string16 name(chrome_dist->GetAppShortCutName()); + string16 name(chrome_dist->GetDisplayName()); string16 message(base::StringPrintf(kPleaseUninstallYourChromeMessage, name.c_str())); @@ -1241,7 +1241,7 @@ bool HandleNonInstallCmdLineOptions(const InstallationState& original_state, InstallUtil::GetChromeVersion(browser_dist, true, &installed_version); if (!installed_version.IsValid()) { LOG(ERROR) << "No installation of " - << browser_dist->GetAppShortCutName() + << browser_dist->GetDisplayName() << " found for system-level toast."; } else { product.LaunchUserExperiment( @@ -1531,7 +1531,7 @@ installer::InstallStatus InstallProductsHelper( if (product_state != NULL && (product_state->version().CompareTo(*installer_version) > 0)) { LOG(ERROR) << "Higher version of " - << product.distribution()->GetAppShortCutName() + << product.distribution()->GetDisplayName() << " is already installed."; higher_products |= (1 << product.distribution()->GetType()); } @@ -1839,7 +1839,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, ::MessageBoxW(NULL, installer::GetLocalizedString( IDS_UNINSTALL_COMPLETE_BASE).c_str(), - cf_install->distribution()->GetAppShortCutName().c_str(), + cf_install->distribution()->GetDisplayName().c_str(), MB_OK); } } diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc index 3de04fb..8ecdcb6d 100644 --- a/chrome/installer/setup/setup_util.cc +++ b/chrome/installer/setup/setup_util.cc @@ -394,7 +394,7 @@ void MigrateGoogleUpdateStateMultiToSingle( KEY_SET_VALUE); if (result != ERROR_SUCCESS) { LOG(ERROR) << "Failed opening ClientState key for " - << dist->GetAppShortCutName() << " to migrate usagestats."; + << dist->GetDisplayName() << " to migrate usagestats."; } else { state_key.WriteValue(google_update::kRegUsageStatsField, usagestats); } @@ -416,7 +416,7 @@ void MigrateGoogleUpdateStateMultiToSingle( if (result == ERROR_SUCCESS && channel_info.Initialize(state_key) && product_to_migrate.SetChannelFlags(false, &channel_info)) { - VLOG(1) << "Moving " << dist->GetAppShortCutName() + VLOG(1) << "Moving " << dist->GetDisplayName() << " to channel: " << channel_info.value(); channel_info.Write(&state_key); } @@ -431,10 +431,10 @@ void MigrateGoogleUpdateStateMultiToSingle( if (result == ERROR_SUCCESS) { installer::ChannelInfo channel_info; if (!channel_info.Initialize(state_key)) { - LOG(ERROR) << "Failed reading " << dist->GetAppShortCutName() + LOG(ERROR) << "Failed reading " << dist->GetDisplayName() << " channel info."; } else if (channel_info.RemoveAllModifiersAndSuffixes()) { - VLOG(1) << "Moving " << dist->GetAppShortCutName() + VLOG(1) << "Moving " << dist->GetDisplayName() << " to channel: " << channel_info.value(); channel_info.Write(&state_key); } diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 30af416..7f8e7ce 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -103,7 +103,7 @@ void AddChannelValueUpdateWorkItems( product_state != NULL && product_state->is_multi_install()) << "Channel value for " << BrowserDistribution::GetSpecificDistribution( - dist_type)->GetAppShortCutName() + dist_type)->GetDisplayName() << " is somehow already set to the desired new value of " << channel_info.value(); } @@ -940,7 +940,7 @@ void UninstallActiveSetupEntries(const InstallerState& installer_state, const char* install_level = installer_state.system_install() ? "system" : "user"; VLOG(1) << "No Active Setup processing to do for " << install_level - << "-level " << distribution->GetAppShortCutName(); + << "-level " << distribution->GetDisplayName(); return; } @@ -1079,7 +1079,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, bool is_chrome = product.is_chrome(); - VLOG(1) << "UninstallProduct: " << browser_dist->GetAppShortCutName(); + VLOG(1) << "UninstallProduct: " << browser_dist->GetDisplayName(); if (force_uninstall) { // Since --force-uninstall command line option is used, we are going to diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 4f71141..8a24927 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -39,6 +39,9 @@ const wchar_t kChromiumActiveSetupGuid[] = const wchar_t kCommandExecuteImplUuid[] = L"{A2DF06F9-A21A-44A8-8A99-8B9C84F29160}"; +// The Chromium App Launcher icon is index 1; see chrome_exe.rc. +const int kAppLauncherIconIndex = 1; + // The BrowserDistribution objects are never freed. BrowserDistribution* g_browser_distribution = NULL; BrowserDistribution* g_chrome_frame_distribution = NULL; @@ -154,12 +157,42 @@ string16 BrowserDistribution::GetBaseAppName() { return L"Chromium"; } -string16 BrowserDistribution::GetAppShortCutName() { - return GetBaseAppName(); +string16 BrowserDistribution::GetDisplayName() { + return GetShortcutName(SHORTCUT_CHROME); +} + +string16 BrowserDistribution::GetShortcutName(ShortcutType shortcut_type) { + switch (shortcut_type) { + case SHORTCUT_CHROME_ALTERNATE: + // TODO(calamity): Change IDS_OEM_MAIN_SHORTCUT_NAME in + // chromium_strings.grd to "The Internet" (so that it doesn't collide with + // the value in google_chrome_strings.grd) then change this to + // installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE) + return L"The Internet"; + case SHORTCUT_APP_LAUNCHER: + return installer::GetLocalizedString(IDS_APP_LIST_SHORTCUT_NAME_BASE); + default: + DCHECK_EQ(shortcut_type, SHORTCUT_CHROME); + return GetBaseAppName(); + } } -string16 BrowserDistribution::GetAlternateApplicationName() { - return L"The Internet"; +int BrowserDistribution::GetIconIndex(ShortcutType shortcut_type) { + if (shortcut_type == SHORTCUT_APP_LAUNCHER) + return kAppLauncherIconIndex; + DCHECK(shortcut_type == SHORTCUT_CHROME || + shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type; + return 0; +} + +string16 BrowserDistribution::GetIconFilename() { + return installer::kChromeExe; +} + +string16 BrowserDistribution::GetStartMenuShortcutSubfolder( + Subfolder subfolder_type) { + DCHECK_EQ(subfolder_type, SUBFOLDER_CHROME); + return GetShortcutName(SHORTCUT_CHROME); } string16 BrowserDistribution::GetBaseAppId() { @@ -228,16 +261,6 @@ bool BrowserDistribution::CanCreateDesktopShortcuts() { return true; } -string16 BrowserDistribution::GetIconFilename() { - return string16(); -} - -int BrowserDistribution::GetIconIndex() { - // Assuming that main icon appears first alphabetically in the resource file - // for GetIconFilename(). - return 0; -} - bool BrowserDistribution::GetChromeChannel(string16* channel) { return false; } diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index ca67c0b..b308c04 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -29,6 +29,17 @@ class BrowserDistribution { NUM_TYPES }; + enum ShortcutType { + SHORTCUT_CHROME, + SHORTCUT_CHROME_ALTERNATE, + SHORTCUT_APP_LAUNCHER + }; + + enum Subfolder { + SUBFOLDER_CHROME, + // TODO(calamity): add SUBFOLDER_APPS when refactoring chrome app dir code. + }; + virtual ~BrowserDistribution() {} static BrowserDistribution* GetDistribution(); @@ -53,10 +64,24 @@ class BrowserDistribution { // at run-time. virtual string16 GetBaseAppName(); - // Returns the localized name of the program. - virtual string16 GetAppShortCutName(); + // Returns the localized display name of this distribution. + virtual string16 GetDisplayName(); - virtual string16 GetAlternateApplicationName(); + // Returns the localized name of the shortcut identified by |shortcut_type| + // for this distribution. + virtual string16 GetShortcutName(ShortcutType shortcut_type); + + // Returns the index of the icon for the product identified by + // |shortcut_type|, inside the file specified by GetIconFilename(). + virtual int GetIconIndex(ShortcutType shortcut_type); + + // Returns the executable filename (not path) that contains the product icon. + virtual string16 GetIconFilename(); + + // Returns the localized name of the subfolder in the Start Menu identified by + // |subfolder_type| that this distribution should create shortcuts in. For + // SUBFOLDER_CHROME this returns GetShortcutName(SHORTCUT_CHROME). + virtual string16 GetStartMenuShortcutSubfolder(Subfolder subfolder_type); // Returns the unsuffixed appid of this program. // The AppUserModelId is a property of Windows programs. @@ -96,13 +121,6 @@ class BrowserDistribution { virtual bool CanCreateDesktopShortcuts(); - // Returns the executable filename (not path) that contains the product icon. - virtual string16 GetIconFilename(); - - // Returns the index of the icon for the product, inside the file specified by - // GetIconFilename(). - virtual int GetIconIndex(); - virtual bool GetChromeChannel(string16* channel); // Returns true if this distribution includes a DelegateExecute verb handler, diff --git a/chrome/installer/util/chrome_app_host_distribution.cc b/chrome/installer/util/chrome_app_host_distribution.cc index 7c40326..1c4c0e1 100644 --- a/chrome/installer/util/chrome_app_host_distribution.cc +++ b/chrome/installer/util/chrome_app_host_distribution.cc @@ -38,16 +38,14 @@ string16 ChromeAppHostDistribution::GetBaseAppName() { return L"Google Chrome App Launcher"; } -string16 ChromeAppHostDistribution::GetAppShortCutName() { - const string16& product_name = - installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); - return product_name; +string16 ChromeAppHostDistribution::GetDisplayName() { + return GetShortcutName(SHORTCUT_APP_LAUNCHER); } -string16 ChromeAppHostDistribution::GetAlternateApplicationName() { - const string16& product_name = - installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); - return product_name; +string16 ChromeAppHostDistribution::GetShortcutName( + ShortcutType shortcut_type) { + DCHECK_EQ(shortcut_type, SHORTCUT_APP_LAUNCHER); + return installer::GetLocalizedString(IDS_PRODUCT_APP_LAUNCHER_NAME_BASE); } string16 ChromeAppHostDistribution::GetBaseAppId() { diff --git a/chrome/installer/util/chrome_app_host_distribution.h b/chrome/installer/util/chrome_app_host_distribution.h index 5648abd..24e007a 100644 --- a/chrome/installer/util/chrome_app_host_distribution.h +++ b/chrome/installer/util/chrome_app_host_distribution.h @@ -15,11 +15,14 @@ class ChromeAppHostDistribution : public BrowserDistribution { public: virtual string16 GetAppGuid() OVERRIDE; - virtual string16 GetBaseAppName() OVERRIDE; + virtual string16 GetDisplayName() OVERRIDE; + + // This can only be called with SHORTCUT_APP_LAUNCHER for |shortcut_type|. + virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; - virtual string16 GetAppShortCutName() OVERRIDE; + virtual string16 GetIconFilename() OVERRIDE; - virtual string16 GetAlternateApplicationName() OVERRIDE; + virtual string16 GetBaseAppName() OVERRIDE; virtual string16 GetBaseAppId() OVERRIDE; @@ -51,8 +54,6 @@ class ChromeAppHostDistribution : public BrowserDistribution { virtual bool CanCreateDesktopShortcuts() OVERRIDE; - virtual string16 GetIconFilename() OVERRIDE; - virtual bool GetCommandExecuteImplClsid( string16* handler_class_uuid) OVERRIDE; diff --git a/chrome/installer/util/chrome_app_host_operations.cc b/chrome/installer/util/chrome_app_host_operations.cc index 361f952..cfd9570 100644 --- a/chrome/installer/util/chrome_app_host_operations.cc +++ b/chrome/installer/util/chrome_app_host_operations.cc @@ -108,7 +108,8 @@ void ChromeAppHostOperations::AddDefaultShortcutProperties( } if (!properties->has_icon()) - properties->set_icon(target_exe, dist->GetIconIndex()); + properties->set_icon(target_exe, + dist->GetIconIndex(BrowserDistribution::SHORTCUT_APP_LAUNCHER)); if (!properties->has_app_id()) { std::vector<string16> components; diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index 59757e4..c376261 100644 --- a/chrome/installer/util/chrome_browser_operations.cc +++ b/chrome/installer/util/chrome_browser_operations.cc @@ -112,7 +112,8 @@ void ChromeBrowserOperations::AddDefaultShortcutProperties( properties->set_target(target_exe); if (!properties->has_icon()) { - int icon_index = dist->GetIconIndex(); + int icon_index = + dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME); base::FilePath prefs_path(target_exe.DirName().AppendASCII( installer::kDefaultMasterPrefs)); if (base::PathExists(prefs_path)) { diff --git a/chrome/installer/util/chrome_frame_distribution.cc b/chrome/installer/util/chrome_frame_distribution.cc index 68379d0..f968178 100644 --- a/chrome/installer/util/chrome_frame_distribution.cc +++ b/chrome/installer/util/chrome_frame_distribution.cc @@ -36,16 +36,15 @@ string16 ChromeFrameDistribution::GetBaseAppName() { return L"Google Chrome Frame"; } -string16 ChromeFrameDistribution::GetAppShortCutName() { - const string16& product_name = - installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); - return product_name; -} - -string16 ChromeFrameDistribution::GetAlternateApplicationName() { - const string16& product_name = - installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); - return product_name; +string16 ChromeFrameDistribution::GetShortcutName(ShortcutType shortcut_type) { + switch (shortcut_type) { + case SHORTCUT_CHROME: + case SHORTCUT_CHROME_ALTERNATE: + return installer::GetLocalizedString(IDS_PRODUCT_FRAME_NAME_BASE); + default: + NOTREACHED(); + return string16(); + } } string16 ChromeFrameDistribution::GetInstallSubDir() { @@ -112,8 +111,14 @@ string16 ChromeFrameDistribution::GetIconFilename() { return installer::kChromeExe; } -int ChromeFrameDistribution::GetIconIndex() { - return 0; +int ChromeFrameDistribution::GetIconIndex(ShortcutType shortcut_type) { + switch (shortcut_type) { + case SHORTCUT_CHROME: + return 0; + default: + NOTREACHED(); + return 0; + } } bool ChromeFrameDistribution::CanSetAsDefault() { diff --git a/chrome/installer/util/chrome_frame_distribution.h b/chrome/installer/util/chrome_frame_distribution.h index ff49036..fa891d6 100644 --- a/chrome/installer/util/chrome_frame_distribution.h +++ b/chrome/installer/util/chrome_frame_distribution.h @@ -15,11 +15,11 @@ class ChromeFrameDistribution : public BrowserDistribution { public: virtual string16 GetAppGuid() OVERRIDE; - virtual string16 GetBaseAppName() OVERRIDE; + virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; - virtual string16 GetAppShortCutName() OVERRIDE; + virtual int GetIconIndex(ShortcutType shortcut_type) OVERRIDE; - virtual string16 GetAlternateApplicationName() OVERRIDE; + virtual string16 GetBaseAppName() OVERRIDE; virtual string16 GetInstallSubDir() OVERRIDE; @@ -47,8 +47,6 @@ class ChromeFrameDistribution : public BrowserDistribution { virtual string16 GetIconFilename() OVERRIDE; - virtual int GetIconIndex() OVERRIDE; - virtual bool CanSetAsDefault() OVERRIDE; virtual bool CanCreateDesktopShortcuts() OVERRIDE; diff --git a/chrome/installer/util/chromium_binaries_distribution.cc b/chrome/installer/util/chromium_binaries_distribution.cc index 514dfa7..004e617 100644 --- a/chrome/installer/util/chromium_binaries_distribution.cc +++ b/chrome/installer/util/chromium_binaries_distribution.cc @@ -29,11 +29,12 @@ string16 ChromiumBinariesDistribution::GetBaseAppName() { return string16(); } -string16 ChromiumBinariesDistribution::GetAppShortCutName() { +string16 ChromiumBinariesDistribution::GetDisplayName() { return kChromiumBinariesName; } -string16 ChromiumBinariesDistribution::GetAlternateApplicationName() { +string16 ChromiumBinariesDistribution::GetShortcutName( + ShortcutType shortcut_type) { NOTREACHED(); return string16(); } @@ -93,7 +94,7 @@ bool ChromiumBinariesDistribution::CanSetAsDefault() { return false; } -int ChromiumBinariesDistribution::GetIconIndex() { +int ChromiumBinariesDistribution::GetIconIndex(ShortcutType shortcut_type) { NOTREACHED(); return 0; } diff --git a/chrome/installer/util/chromium_binaries_distribution.h b/chrome/installer/util/chromium_binaries_distribution.h index e78bf86..43c87cc 100644 --- a/chrome/installer/util/chromium_binaries_distribution.h +++ b/chrome/installer/util/chromium_binaries_distribution.h @@ -15,11 +15,13 @@ class ChromiumBinariesDistribution : public BrowserDistribution { public: virtual string16 GetAppGuid() OVERRIDE; - virtual string16 GetBaseAppName() OVERRIDE; + virtual string16 GetDisplayName() OVERRIDE; + + virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; - virtual string16 GetAppShortCutName() OVERRIDE; + virtual int GetIconIndex(ShortcutType shortcut_type) OVERRIDE; - virtual string16 GetAlternateApplicationName() OVERRIDE; + virtual string16 GetBaseAppName() OVERRIDE; virtual string16 GetBaseAppId() OVERRIDE; @@ -45,8 +47,6 @@ class ChromiumBinariesDistribution : public BrowserDistribution { virtual bool CanSetAsDefault() OVERRIDE; - virtual int GetIconIndex() OVERRIDE; - virtual bool GetChromeChannel(string16* channel) OVERRIDE; virtual bool GetCommandExecuteImplClsid( diff --git a/chrome/installer/util/google_chrome_binaries_distribution.cc b/chrome/installer/util/google_chrome_binaries_distribution.cc index 16c177d..e5ad751 100644 --- a/chrome/installer/util/google_chrome_binaries_distribution.cc +++ b/chrome/installer/util/google_chrome_binaries_distribution.cc @@ -25,10 +25,16 @@ string16 GoogleChromeBinariesDistribution::GetAppGuid() { return kChromeBinariesGuid; } -string16 GoogleChromeBinariesDistribution::GetAppShortCutName() { +string16 GoogleChromeBinariesDistribution::GetDisplayName() { return kChromeBinariesName; } +string16 GoogleChromeBinariesDistribution::GetShortcutName( + ShortcutType shortcut_type) { + NOTREACHED(); + return string16(); +} + string16 GoogleChromeBinariesDistribution::GetStateKey() { return string16(google_update::kRegPathClientState) .append(1, L'\\') diff --git a/chrome/installer/util/google_chrome_binaries_distribution.h b/chrome/installer/util/google_chrome_binaries_distribution.h index ded49b8..aa0a1ee 100644 --- a/chrome/installer/util/google_chrome_binaries_distribution.h +++ b/chrome/installer/util/google_chrome_binaries_distribution.h @@ -13,7 +13,9 @@ class GoogleChromeBinariesDistribution : public ChromiumBinariesDistribution { public: virtual string16 GetAppGuid(); - virtual string16 GetAppShortCutName(); + virtual string16 GetDisplayName(); + + virtual string16 GetShortcutName(ShortcutType shortcut_type); virtual string16 GetStateKey(); diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index c7a7c3e..2ae5338 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -38,6 +38,9 @@ const wchar_t kBrowserAppId[] = L"Chrome"; const wchar_t kCommandExecuteImplUuid[] = L"{5C65F4B0-3651-4514-B207-D10CB699B14B}"; +// The Google Chrome App Launcher icon is index 5; see chrome_exe.rc. +const int kAppLauncherIconIndex = 5; + // Substitute the locale parameter in uninstall URL with whatever // Google Update tells us is the locale. In case we fail to find // the locale, we use US English. @@ -125,16 +128,28 @@ string16 GoogleChromeDistribution::GetBaseAppName() { return L"Google Chrome"; } -string16 GoogleChromeDistribution::GetAppShortCutName() { - const string16& app_shortcut_name = - installer::GetLocalizedString(IDS_PRODUCT_NAME_BASE); - return app_shortcut_name; +string16 GoogleChromeDistribution::GetShortcutName(ShortcutType shortcut_type) { + int string_id = IDS_PRODUCT_NAME_BASE; + switch (shortcut_type) { + case SHORTCUT_CHROME_ALTERNATE: + string_id = IDS_OEM_MAIN_SHORTCUT_NAME_BASE; + break; + case SHORTCUT_APP_LAUNCHER: + string_id = IDS_APP_LIST_SHORTCUT_NAME_BASE; + break; + default: + DCHECK_EQ(shortcut_type, SHORTCUT_CHROME); + break; + } + return installer::GetLocalizedString(string_id); } -string16 GoogleChromeDistribution::GetAlternateApplicationName() { - const string16& alt_product_name = - installer::GetLocalizedString(IDS_OEM_MAIN_SHORTCUT_NAME_BASE); - return alt_product_name; +int GoogleChromeDistribution::GetIconIndex(ShortcutType shortcut_type) { + if (shortcut_type == SHORTCUT_APP_LAUNCHER) + return kAppLauncherIconIndex; + DCHECK(shortcut_type == SHORTCUT_CHROME || + shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type; + return 0; } string16 GoogleChromeDistribution::GetBaseAppId() { diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index d3f148f..a00a31e 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -36,11 +36,13 @@ class GoogleChromeDistribution : public BrowserDistribution { virtual string16 GetAppGuid() OVERRIDE; - virtual string16 GetBaseAppName() OVERRIDE; + virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; + + virtual string16 GetIconFilename() OVERRIDE; - virtual string16 GetAppShortCutName() OVERRIDE; + virtual int GetIconIndex(ShortcutType shortcut_type) OVERRIDE; - virtual string16 GetAlternateApplicationName() OVERRIDE; + virtual string16 GetBaseAppName() OVERRIDE; virtual string16 GetBaseAppId() OVERRIDE; @@ -71,8 +73,6 @@ class GoogleChromeDistribution : public BrowserDistribution { virtual string16 GetVersionKey() OVERRIDE; - virtual string16 GetIconFilename() OVERRIDE; - virtual bool GetCommandExecuteImplClsid( string16* handler_class_uuid) OVERRIDE; diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc index 623870c..ff7638a 100644 --- a/chrome/installer/util/google_chrome_distribution_dummy.cc +++ b/chrome/installer/util/google_chrome_distribution_dummy.cc @@ -41,14 +41,14 @@ string16 GoogleChromeDistribution::GetBaseAppName() { return string16(); } -string16 GoogleChromeDistribution::GetAppShortCutName() { +string16 GoogleChromeDistribution::GetShortcutName(ShortcutType shortcut_type) { NOTREACHED(); return string16(); } -string16 GoogleChromeDistribution::GetAlternateApplicationName() { +int GoogleChromeDistribution::GetIconIndex(ShortcutType shortcut_type) { NOTREACHED(); - return string16(); + return 0; } string16 GoogleChromeDistribution::GetBaseAppId() { diff --git a/chrome/installer/util/google_chrome_sxs_distribution.cc b/chrome/installer/util/google_chrome_sxs_distribution.cc index 5224a8c..1e623d9 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.cc +++ b/chrome/installer/util/google_chrome_sxs_distribution.cc @@ -18,6 +18,9 @@ const wchar_t kChannelName[] = L"canary"; const wchar_t kBrowserAppId[] = L"ChromeCanary"; const int kSxSIconIndex = 4; +// The Chrome App Launcher Canary icon is index 6; see chrome_exe.rc. +const int kSxSAppLauncherIconIndex = 6; + } // namespace GoogleChromeSxSDistribution::GoogleChromeSxSDistribution() @@ -29,10 +32,21 @@ string16 GoogleChromeSxSDistribution::GetBaseAppName() { return L"Google Chrome Canary"; } -string16 GoogleChromeSxSDistribution::GetAppShortCutName() { - const string16& shortcut_name = - installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); - return shortcut_name; +string16 GoogleChromeSxSDistribution::GetShortcutName( + ShortcutType shortcut_type) { + switch (shortcut_type) { + case SHORTCUT_CHROME_ALTERNATE: + // This should never be called. Returning the same string as Google Chrome + // preserves behavior, but it will result in a naming collision. + NOTREACHED(); + return GoogleChromeDistribution::GetShortcutName(shortcut_type); + case SHORTCUT_APP_LAUNCHER: + return installer::GetLocalizedString( + IDS_APP_LIST_SHORTCUT_NAME_CANARY_BASE); + default: + DCHECK_EQ(shortcut_type, SHORTCUT_CHROME); + return installer::GetLocalizedString(IDS_SXS_SHORTCUT_NAME_BASE); + } } string16 GoogleChromeSxSDistribution::GetBaseAppId() { @@ -53,7 +67,11 @@ bool GoogleChromeSxSDistribution::CanSetAsDefault() { return false; } -int GoogleChromeSxSDistribution::GetIconIndex() { +int GoogleChromeSxSDistribution::GetIconIndex(ShortcutType shortcut_type) { + if (shortcut_type == SHORTCUT_APP_LAUNCHER) + return kSxSAppLauncherIconIndex; + DCHECK(shortcut_type == SHORTCUT_CHROME || + shortcut_type == SHORTCUT_CHROME_ALTERNATE) << shortcut_type; return kSxSIconIndex; } diff --git a/chrome/installer/util/google_chrome_sxs_distribution.h b/chrome/installer/util/google_chrome_sxs_distribution.h index 74a0cc3..5261a7a 100644 --- a/chrome/installer/util/google_chrome_sxs_distribution.h +++ b/chrome/installer/util/google_chrome_sxs_distribution.h @@ -20,12 +20,12 @@ class GoogleChromeSxSDistribution : public GoogleChromeDistribution { public: virtual string16 GetBaseAppName() OVERRIDE; - virtual string16 GetAppShortCutName() OVERRIDE; + virtual string16 GetShortcutName(ShortcutType shortcut_type) OVERRIDE; + virtual int GetIconIndex(ShortcutType shortcut_type) OVERRIDE; virtual string16 GetBaseAppId() OVERRIDE; virtual string16 GetInstallSubDir() OVERRIDE; virtual string16 GetUninstallRegPath() OVERRIDE; virtual bool CanSetAsDefault() OVERRIDE; - virtual int GetIconIndex() OVERRIDE; virtual bool GetChromeChannel(string16* channel) OVERRIDE; virtual bool GetCommandExecuteImplClsid( string16* handler_class_uuid) OVERRIDE; diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index fd1ad19..c8c037d 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -223,12 +223,12 @@ void InstallUtil::GetChromeVersion(BrowserDistribution* dist, *version = Version(); if (result == ERROR_SUCCESS && !version_str.empty()) { - VLOG(1) << "Existing " << dist->GetAppShortCutName() << " version found " + VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " << version_str; *version = Version(WideToASCII(version_str)); } else { DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); - VLOG(1) << "No existing " << dist->GetAppShortCutName() + VLOG(1) << "No existing " << dist->GetDisplayName() << " install found."; } } @@ -249,12 +249,12 @@ void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, *version = Version(); if (result == ERROR_SUCCESS && !version_str.empty()) { - VLOG(1) << "Critical Update version for " << dist->GetAppShortCutName() + VLOG(1) << "Critical Update version for " << dist->GetDisplayName() << " found " << version_str; *version = Version(WideToASCII(version_str)); } else { DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); - VLOG(1) << "No existing " << dist->GetAppShortCutName() + VLOG(1) << "No existing " << dist->GetDisplayName() << " install found."; } } diff --git a/chrome/installer/util/installation_validator.cc b/chrome/installer/util/installation_validator.cc index f5fb140..649d792 100644 --- a/chrome/installer/util/installation_validator.cc +++ b/chrome/installer/util/installation_validator.cc @@ -211,7 +211,7 @@ void InstallationValidator::ValidateAppCommandFlags( bool expected = flags_exp.find(check_list[i].exp_key) != flags_exp.end(); if (check_list[i].val != expected) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() << ": " + LOG(ERROR) << ctx.dist->GetDisplayName() << ": " << name << " command should " << (expected ? "" : "not ") << check_list[i].msg << "."; } @@ -415,7 +415,7 @@ void InstallationValidator::ValidateAppCommandExpectations( the_expectations.erase(expectation); } else { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " has an unexpected Google Update product command named \"" << cmd_id << "\"."; } @@ -426,7 +426,7 @@ void InstallationValidator::ValidateAppCommandExpectations( CommandExpectations::const_iterator end(the_expectations.end()); for (; scan != end; ++scan) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " is missing the Google Update product command named \"" << scan->first << "\"."; } @@ -595,7 +595,7 @@ void InstallationValidator::ValidateSetupPath(const ProductContext& ctx, if (!base::FilePath::CompareEqualIgnoreCase(expected_path.value(), setup_exe.value())) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() << " path to " << purpose + LOG(ERROR) << ctx.dist->GetDisplayName() << " path to " << purpose << " is not " << expected_path.value() << ": " << setup_exe.value(); } @@ -613,7 +613,7 @@ void InstallationValidator::ValidateCommandExpectations( const SwitchExpectations::value_type& expectation = expected[i]; if (command.HasSwitch(expectation.first) != expectation.second) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() << " " << source + LOG(ERROR) << ctx.dist->GetDisplayName() << " " << source << (expectation.second ? " is missing" : " has") << " \"" << expectation.first << "\"" << (expectation.second ? "" : " but shouldn't") << ": " @@ -680,14 +680,14 @@ void InstallationValidator::ValidateOldVersionValues( if (ctx.state.old_version() == NULL) { if (!ctx.state.rename_cmd().empty()) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " has a rename command but no opv: " << ctx.state.rename_cmd(); } } else { if (ctx.state.rename_cmd().empty()) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " has an opv but no rename command: " << ctx.state.old_version()->GetString(); } else { @@ -714,14 +714,14 @@ void InstallationValidator::ValidateMultiInstallProduct( true, // system-level BrowserDistribution::CHROME_BROWSER)) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " (" << ctx.state.version().GetString() << ") is " << "installed without Chrome Binaries or a system-level " << "Chrome."; } } else { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " (" << ctx.state.version().GetString() << ") is installed " << "without Chrome Binaries."; } @@ -729,7 +729,7 @@ void InstallationValidator::ValidateMultiInstallProduct( // Version must match that of binaries. if (ctx.state.version().CompareTo(binaries->version()) != 0) { *is_valid = false; - LOG(ERROR) << "Version of " << ctx.dist->GetAppShortCutName() + LOG(ERROR) << "Version of " << ctx.dist->GetDisplayName() << " (" << ctx.state.version().GetString() << ") does not " "match that of Chrome Binaries (" << binaries->version().GetString() << ")."; @@ -738,7 +738,7 @@ void InstallationValidator::ValidateMultiInstallProduct( // Channel value must match that of binaries. if (!ctx.state.channel().Equals(binaries->channel())) { *is_valid = false; - LOG(ERROR) << "Channel name of " << ctx.dist->GetAppShortCutName() + LOG(ERROR) << "Channel name of " << ctx.dist->GetDisplayName() << " (" << ctx.state.channel().value() << ") does not match that of Chrome Binaries (" << binaries->channel().value() << ")."; @@ -772,12 +772,12 @@ void InstallationValidator::ValidateUsageStats(const ProductContext& ctx, if (ctx.state.GetUsageStats(&usagestats)) { if (!ctx.rules.UsageStatsAllowed(ctx)) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " has a usagestats value (" << usagestats << "), yet should not."; } else if (usagestats != 0 && usagestats != 1) { *is_valid = false; - LOG(ERROR) << ctx.dist->GetAppShortCutName() + LOG(ERROR) << ctx.dist->GetDisplayName() << " has an unsupported usagestats value (" << usagestats << ")."; } diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index 07b75b3..bba1e3b 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -123,20 +123,20 @@ void InstallerState::Initialize(const CommandLine& command_line, Product* p = AddProductFromPreferences( BrowserDistribution::CHROME_BROWSER, prefs, machine_state); VLOG(1) << (is_uninstall ? "Uninstall" : "Install") - << " distribution: " << p->distribution()->GetAppShortCutName(); + << " distribution: " << p->distribution()->GetDisplayName(); } if (prefs.install_chrome_frame()) { Product* p = AddProductFromPreferences( BrowserDistribution::CHROME_FRAME, prefs, machine_state); VLOG(1) << (is_uninstall ? "Uninstall" : "Install") - << " distribution: " << p->distribution()->GetAppShortCutName(); + << " distribution: " << p->distribution()->GetDisplayName(); } if (prefs.install_chrome_app_launcher()) { Product* p = AddProductFromPreferences( BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); VLOG(1) << (is_uninstall ? "Uninstall" : "Install") - << " distribution: " << p->distribution()->GetAppShortCutName(); + << " distribution: " << p->distribution()->GetDisplayName(); } if (!is_uninstall && is_multi_install()) { @@ -169,7 +169,7 @@ void InstallerState::Initialize(const CommandLine& command_line, Product* p = AddProductFromPreferences( BrowserDistribution::CHROME_BINARIES, prefs, machine_state); VLOG(1) << "Install distribution: " - << p->distribution()->GetAppShortCutName(); + << p->distribution()->GetDisplayName(); } } @@ -208,7 +208,7 @@ void InstallerState::Initialize(const CommandLine& command_line, Product* p = AddProductFromPreferences( conditional_additions[i].type, prefs, machine_state); VLOG(1) << "Uninstall distribution: " - << p->distribution()->GetAppShortCutName(); + << p->distribution()->GetDisplayName(); } } } @@ -271,7 +271,7 @@ void InstallerState::Initialize(const CommandLine& command_line, Product* p = AddProductFromPreferences( BrowserDistribution::CHROME_BINARIES, prefs, machine_state); VLOG(1) << (is_uninstall ? "Uninstall" : "Install") - << " distribution: " << p->distribution()->GetAppShortCutName(); + << " distribution: " << p->distribution()->GetDisplayName(); } } diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py index 12e68ce..03c17a0 100755 --- a/chrome/installer/util/prebuild/create_string_rc.py +++ b/chrome/installer/util/prebuild/create_string_rc.py @@ -78,6 +78,8 @@ kStringIds = [ 'IDS_APP_LAUNCHER_PRODUCT_DESCRIPTION', 'IDS_APP_LAUNCHER_SHORTCUT_TOOLTIP', 'IDS_UNINSTALL_APP_LAUNCHER', + 'IDS_APP_LIST_SHORTCUT_NAME', + 'IDS_APP_LIST_SHORTCUT_NAME_CANARY', ] # The ID of the first resource string. diff --git a/chrome/installer/util/product.cc b/chrome/installer/util/product.cc index dc70b16..44e7cef 100644 --- a/chrome/installer/util/product.cc +++ b/chrome/installer/util/product.cc @@ -168,7 +168,7 @@ void Product::LaunchUserExperiment(const base::FilePath& setup_path, bool system_level) const { if (distribution_->HasUserExperiments()) { VLOG(1) << "LaunchUserExperiment status: " << status << " product: " - << distribution_->GetAppShortCutName() + << distribution_->GetDisplayName() << " system_level: " << system_level; operations_->LaunchUserExperiment( setup_path, options_, status, system_level); diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 57521e8..b5fbe61 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -219,7 +219,9 @@ class RegistryEntry { const string16& suffix, ScopedVector<RegistryEntry>* entries) { string16 icon_path( - ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex())); + ShellUtil::FormatIconLocation( + chrome_exe, + dist->GetIconIndex(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 @@ -317,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())); @@ -350,7 +352,9 @@ class RegistryEntry { const string16& suffix, ScopedVector<RegistryEntry>* entries) { const string16 icon_path( - ShellUtil::FormatIconLocation(chrome_exe, dist->GetIconIndex())); + ShellUtil::FormatIconLocation( + chrome_exe, + dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME))); const string16 quoted_exe_path(L"\"" + chrome_exe + L"\""); // Register for the Start Menu "Internet" link (pre-Win7). @@ -359,7 +363,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_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)); @@ -395,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)); @@ -501,7 +505,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, + dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME)); for (int i = 0; ShellUtil::kBrowserProtocolAssociations[i] != NULL; i++) { GetXPStyleUserProtocolEntries(ShellUtil::kBrowserProtocolAssociations[i], chrome_icon, chrome_open, entries); @@ -906,7 +912,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->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME))); RegistryEntry::GetXPStyleUserProtocolEntries(protocol, chrome_icon, chrome_open, &entries); // Change the default protocol handler for current user. @@ -919,17 +927,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); @@ -1434,8 +1444,10 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, return false; } - if (add_folder_for_dist) - *path = path->Append(dist->GetAppShortCutName()); + if (add_folder_for_dist) { + *path = path->Append(dist->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME)); + } return true; } diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index c1d0c32..7d42c3c 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -127,7 +127,7 @@ class ShellUtil { } // Forces the shortcut's name to |shortcut_name_in|. - // Default: the current distribution's GetAppShortcutName(). + // Default: the current distribution's GetShortcutName(SHORTCUT_CHROME). // The ".lnk" extension will automatically be added to this name. void set_shortcut_name(const string16& shortcut_name_in) { shortcut_name = shortcut_name_in; diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 647ec28..4000813 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -104,7 +104,9 @@ class ShellUtilShortcutTest : public testing::Test { case ShellUtil::SHORTCUT_LOCATION_START_MENU: expected_path = (properties.level == ShellUtil::CURRENT_USER) ? fake_start_menu_.path() : fake_common_start_menu_.path(); - expected_path = expected_path.Append(dist_->GetAppShortCutName()); + expected_path = expected_path.Append( + dist_->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME)); break; default: ADD_FAILURE() << "Unknown location"; @@ -112,10 +114,12 @@ class ShellUtilShortcutTest : public testing::Test { } 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); + } shortcut_name.append(installer::kLnkExt); expected_path = expected_path.Append(shortcut_name); @@ -141,7 +145,7 @@ class ShellUtilShortcutTest : public testing::Test { if (properties.has_icon()) { expected_properties.set_icon(properties.icon, 0); } else { - int icon_index = dist->GetIconIndex(); + int icon_index = dist->GetIconIndex(BrowserDistribution::SHORTCUT_CHROME); expected_properties.set_icon(chrome_exe_, icon_index); } @@ -200,12 +204,16 @@ TEST_F(ShellUtilShortcutTest, GetShortcutPath) { ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, ShellUtil::SYSTEM_LEVEL, &path); EXPECT_EQ(fake_default_user_quick_launch_.path(), path); + string16 start_menu_subfolder = + dist_->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME); ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, &path); - EXPECT_EQ(fake_start_menu_.path().Append(dist_->GetAppShortCutName()), path); + EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), + path); ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::SYSTEM_LEVEL, &path); - EXPECT_EQ(fake_common_start_menu_.path().Append(dist_->GetAppShortCutName()), + EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), path); } @@ -308,7 +316,9 @@ TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { } TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) { - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); test_properties_.level = ShellUtil::SYSTEM_LEVEL; ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( @@ -335,7 +345,9 @@ TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { } TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); test_properties_.level = ShellUtil::SYSTEM_LEVEL; ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( @@ -357,7 +369,9 @@ TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); ASSERT_TRUE(base::PathExists(shortcut_path)); @@ -374,7 +388,9 @@ TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); base::FilePath shortcut_path( fake_common_desktop_.path().Append(shortcut_name)); ASSERT_TRUE(base::PathExists(shortcut_path)); @@ -423,7 +439,9 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); ASSERT_TRUE(base::PathExists(shortcut_path)); @@ -447,7 +465,9 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); base::FilePath shortcut_path( fake_common_desktop_.path().Append(shortcut_name)); ASSERT_TRUE(base::PathExists(shortcut_path)); @@ -525,7 +545,9 @@ TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); base::FilePath shortcut_folder( - fake_start_menu_.path().Append(dist_->GetAppShortCutName())); + fake_start_menu_.path().Append( + dist_->GetStartMenuShortcutSubfolder( + BrowserDistribution::SUBFOLDER_CHROME))); base::FileEnumerator file_counter(shortcut_folder, false, base::FileEnumerator::FILES); int count = 0; @@ -552,7 +574,9 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); + string16 shortcut_name( + dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); ASSERT_TRUE(base::PathExists(shortcut_path)); |