| Index: chrome/browser/ui/views/app_list/app_list_controller_win.cc
|
| 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 2574a61b48891eff8499c12630faa2ec18a975b3..78fca7a514473821aeadeb7b59770db3536e7788 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
|
| @@ -91,26 +91,6 @@ void MigrateAppLauncherEnabledPref() {
|
| }
|
| }
|
|
|
| -// Icons are added to the resources of the DLL using icon names. The icon index
|
| -// for the app list icon is named IDR_X_APP_LIST or (for official builds)
|
| -// IDR_X_APP_LIST_SXS for Chrome Canary. Creating shortcuts needs to specify a
|
| -// resource index, which are different to icon names. They are 0 based and
|
| -// contiguous. As Google Chrome builds have extra icons the icon for Google
|
| -// Chrome builds need to be higher. Unfortunately these indexes are not in any
|
| -// generated header file.
|
| -int GetAppListIconIndex() {
|
| - const int kAppListIconIndex = 5;
|
| - const int kAppListIconIndexSxS = 6;
|
| - const int kAppListIconIndexChromium = 1;
|
| -#if defined(GOOGLE_CHROME_BUILD)
|
| - if (InstallUtil::IsChromeSxSProcess())
|
| - return kAppListIconIndexSxS;
|
| - return kAppListIconIndex;
|
| -#else
|
| - return kAppListIconIndexChromium;
|
| -#endif
|
| -}
|
| -
|
| string16 GetAppListIconPath() {
|
| base::FilePath icon_path;
|
| if (!PathService::Get(base::FILE_EXE, &icon_path)) {
|
| @@ -118,8 +98,10 @@ string16 GetAppListIconPath() {
|
| return string16();
|
| }
|
|
|
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| +
|
| std::stringstream ss;
|
| - ss << "," << GetAppListIconIndex();
|
| + ss << "," << dist->GetIconIndex(BrowserDistribution::SHORTCUT_APP_LAUNCHER);
|
| string16 result = icon_path.value();
|
| result.append(UTF8ToUTF16(ss.str()));
|
| return result;
|
| @@ -216,12 +198,6 @@ gfx::Point FindAnchorPoint(
|
| anchor.SetToMin(bounds_rect.bottom_right());
|
| return anchor;
|
| }
|
| -string16 GetAppListShortcutName() {
|
| - chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
|
| - if (channel == chrome::VersionInfo::CHANNEL_CANARY)
|
| - return l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME_CANARY);
|
| - return l10n_util::GetStringUTF16(IDS_APP_LIST_SHORTCUT_NAME);
|
| -}
|
|
|
| CommandLine GetAppListCommandLine() {
|
| const char* const kSwitchesToCopy[] = { switches::kUserDataDir };
|
| @@ -302,18 +278,14 @@ void CreateAppListShortcuts(
|
| bool pin_to_taskbar = creation_locations.in_quick_launch_bar &&
|
| (base::win::GetVersion() >= base::win::VERSION_WIN7);
|
|
|
| - // Create a shortcut in the |user_data_dir| for taskbar pinning.
|
| - if (pin_to_taskbar)
|
| - shortcut_paths.push_back(user_data_dir);
|
| - bool success = true;
|
| -
|
| base::FilePath chrome_exe;
|
| if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
|
| NOTREACHED();
|
| return;
|
| }
|
| -
|
| - string16 app_list_shortcut_name = GetAppListShortcutName();
|
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| + string16 app_list_shortcut_name =
|
| + dist->GetShortcutName(BrowserDistribution::SHORTCUT_APP_LAUNCHER);
|
|
|
| string16 wide_switches(GetAppListCommandLine().GetArgumentsString());
|
|
|
| @@ -322,29 +294,37 @@ void CreateAppListShortcuts(
|
| shortcut_properties.set_working_dir(chrome_exe.DirName());
|
| shortcut_properties.set_arguments(wide_switches);
|
| shortcut_properties.set_description(app_list_shortcut_name);
|
| - shortcut_properties.set_icon(chrome_exe, GetAppListIconIndex());
|
| + shortcut_properties.set_icon(
|
| + chrome_exe,
|
| + dist->GetIconIndex(BrowserDistribution::SHORTCUT_APP_LAUNCHER));
|
| shortcut_properties.set_app_id(app_model_id);
|
|
|
| for (size_t i = 0; i < shortcut_paths.size(); ++i) {
|
| - base::FilePath shortcut_file =
|
| + base::FilePath shortcut_to_pin =
|
| shortcut_paths[i].Append(app_list_shortcut_name).
|
| AddExtension(installer::kLnkExt);
|
| - if (!base::PathExists(shortcut_file.DirName()) &&
|
| - !file_util::CreateDirectory(shortcut_file.DirName())) {
|
| + if (!base::PathExists(shortcut_to_pin.DirName()) &&
|
| + !file_util::CreateDirectory(shortcut_to_pin.DirName())) {
|
| NOTREACHED();
|
| - return;
|
| + continue;
|
| }
|
| - success = success && base::win::CreateOrUpdateShortcutLink(
|
| - shortcut_file, shortcut_properties,
|
| - base::win::SHORTCUT_CREATE_ALWAYS);
|
| + base::win::CreateOrUpdateShortcutLink(shortcut_to_pin,
|
| + shortcut_properties,
|
| + base::win::SHORTCUT_CREATE_ALWAYS);
|
| }
|
|
|
| - if (success && pin_to_taskbar) {
|
| + // Create a shortcut in the |user_data_dir| for taskbar pinning.
|
| + if (pin_to_taskbar) {
|
| base::FilePath shortcut_to_pin =
|
| user_data_dir.Append(app_list_shortcut_name).
|
| AddExtension(installer::kLnkExt);
|
| - success = base::win::TaskbarPinShortcutLink(
|
| - shortcut_to_pin.value().c_str()) && success;
|
| + if (base::win::CreateOrUpdateShortcutLink(
|
| + shortcut_to_pin,
|
| + shortcut_properties,
|
| + base::win::SHORTCUT_CREATE_ALWAYS)) {
|
| + base::win::TaskbarPinShortcutLink(shortcut_to_pin.value().c_str());
|
| + }
|
| +
|
| }
|
| }
|
|
|
| @@ -401,9 +381,13 @@ void SetWindowAttributes(HWND hwnd) {
|
|
|
| ui::win::SetAppIdForWindow(GetAppModelId(), hwnd);
|
| CommandLine relaunch = GetAppListCommandLine();
|
| - string16 app_name(GetAppListShortcutName());
|
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| + string16 app_name(
|
| + dist->GetShortcutName(BrowserDistribution::SHORTCUT_APP_LAUNCHER));
|
| ui::win::SetRelaunchDetailsForWindow(
|
| - relaunch.GetCommandLineString(), app_name, hwnd);
|
| + relaunch.GetCommandLineString(),
|
| + app_name,
|
| + hwnd);
|
| ::SetWindowText(hwnd, app_name.c_str());
|
| string16 icon_path = GetAppListIconPath();
|
| ui::win::SetAppIconForWindow(icon_path, hwnd);
|
| @@ -1057,11 +1041,7 @@ void AppListController::CreateShortcut() {
|
| ShellIntegration::ShortcutLocations shortcut_locations;
|
| shortcut_locations.on_desktop = true;
|
| shortcut_locations.in_quick_launch_bar = true;
|
| - shortcut_locations.in_applications_menu = true;
|
| - BrowserDistribution* dist = BrowserDistribution::GetDistribution();
|
| - shortcut_locations.applications_menu_subdir =
|
| - dist->GetStartMenuShortcutSubfolder(
|
| - BrowserDistribution::SUBFOLDER_CHROME);
|
| + shortcut_locations.in_applications_menu_chrome_subdir = true;
|
| base::FilePath user_data_dir(
|
| g_browser_process->profile_manager()->user_data_dir());
|
|
|
|
|