Chromium Code Reviews| 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..ef881ceffefec3d2892202b3bf9f0087ffcf1857 100644 |
| --- a/chrome/installer/util/shell_util.cc |
| +++ b/chrome/installer/util/shell_util.cc |
| @@ -1257,7 +1257,8 @@ bool RemoveShortcutFolder(ShellUtil::ShortcutLocation location, |
| ShellUtil::ShellChange level) { |
| // Explicitly whitelist locations, since accidental calls can be very harmful. |
| - if (location != ShellUtil::SHORTCUT_LOCATION_START_MENU && |
| + if (location != ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR && |
| + location != ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR && |
| location != ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS) { |
| NOTREACHED(); |
| return false; |
| @@ -1346,7 +1347,9 @@ bool ShellUtil::ShortcutLocationIsSupported( |
| return true; |
| case SHORTCUT_LOCATION_QUICK_LAUNCH: |
| return true; |
| - case SHORTCUT_LOCATION_START_MENU: |
| + case SHORTCUT_LOCATION_START_MENU_ROOT: |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_DIR: |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
| return true; |
| case SHORTCUT_LOCATION_TASKBAR_PINS: |
| return base::win::GetVersion() >= base::win::VERSION_WIN7; |
| @@ -1364,7 +1367,6 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, |
| base::FilePath* path) { |
| DCHECK(path); |
| int dir_key = -1; |
| - bool add_folder_for_dist = false; |
| switch (location) { |
| case SHORTCUT_LOCATION_DESKTOP: |
| dir_key = (level == CURRENT_USER) ? base::DIR_USER_DESKTOP : |
| @@ -1374,10 +1376,11 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, |
| dir_key = (level == CURRENT_USER) ? base::DIR_USER_QUICK_LAUNCH : |
| base::DIR_DEFAULT_USER_QUICK_LAUNCH; |
| break; |
| - case SHORTCUT_LOCATION_START_MENU: |
| + case SHORTCUT_LOCATION_START_MENU_ROOT: |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_DIR: |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
| dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : |
| base::DIR_COMMON_START_MENU; |
| - add_folder_for_dist = true; |
| break; |
| case SHORTCUT_LOCATION_TASKBAR_PINS: |
| dir_key = base::DIR_TASKBAR_PINS; |
| @@ -1390,14 +1393,20 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, |
| NOTREACHED(); |
| return false; |
| } |
| - |
|
gab
2013/05/15 21:26:38
nit: I'd leave this empty line to separate from th
calamity
2013/08/27 07:59:35
Done.
|
| if (!PathService::Get(dir_key, path) || path->empty()) { |
| NOTREACHED() << dir_key; |
| return false; |
| } |
| - if (add_folder_for_dist) |
| - *path = path->Append(dist->GetAppShortCutName()); |
| + // Append application menu subdirectory. |
| + string16 folder_to_append; |
| + if (location == SHORTCUT_LOCATION_START_MENU_CHROME_DIR) { |
|
Matt Giuca
2013/05/15 05:19:45
Can you do this in the switch instead of having th
gab
2013/05/15 21:26:38
Should be easier with single GetStartMenuSubfolder
calamity
2013/08/27 07:59:35
Done.
|
| + folder_to_append = dist->GetAppShortCutName(); |
| + } else if (location == SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR) { |
| + folder_to_append = dist->GetAppShortcutsSubdirName(); |
| + } |
| + if (!folder_to_append.empty()) |
| + *path = path->Append(folder_to_append); |
| return true; |
| } |
| @@ -1410,7 +1419,9 @@ bool ShellUtil::CreateOrUpdateShortcut( |
| // Explicitly whitelist locations to which this is applicable. |
| if (location != SHORTCUT_LOCATION_DESKTOP && |
| location != SHORTCUT_LOCATION_QUICK_LAUNCH && |
| - location != SHORTCUT_LOCATION_START_MENU) { |
| + location != SHORTCUT_LOCATION_START_MENU_ROOT && |
| + location != SHORTCUT_LOCATION_START_MENU_CHROME_DIR && |
| + location != SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR) { |
| NOTREACHED(); |
| return false; |
| } |
| @@ -1990,7 +2001,8 @@ bool ShellUtil::RemoveShortcuts(ShellUtil::ShortcutLocation location, |
| return true; // Vacuous success. |
| switch (location) { |
| - case SHORTCUT_LOCATION_START_MENU: // Falls through. |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_DIR: // Falls through. |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
| case SHORTCUT_LOCATION_APP_SHORTCUTS: |
| return RemoveShortcutFolder(location, dist, level); |