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 a5122d50ad4c3fa472a15585b3bbac1e020d3a8e..fea7e86a86a3607521d2b3e2f92184ba6c779a81 100644 |
| --- a/chrome/installer/util/shell_util.cc |
| +++ b/chrome/installer/util/shell_util.cc |
| @@ -1307,7 +1307,8 @@ bool RemoveShortcutFolderIfEmpty(ShellUtil::ShortcutLocation location, |
| BrowserDistribution* dist, |
| 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; |
| @@ -1397,7 +1398,9 @@ bool ShellUtil::ShortcutLocationIsSupported( |
| return true; |
| case SHORTCUT_LOCATION_QUICK_LAUNCH: |
| return true; |
|
gab
2013/08/28 19:52:27
Also collapse above two cases into the same case.
|
| - case SHORTCUT_LOCATION_START_MENU: |
| + case SHORTCUT_LOCATION_START_MENU_ROOT: |
|
gab
2013/08/28 19:52:27
Add explicit comment after falling through case st
calamity
2013/10/02 01:08:05
Done.
|
| + 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; |
| @@ -1415,7 +1418,7 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, |
| base::FilePath* path) { |
| DCHECK(path); |
| int dir_key = -1; |
| - bool add_folder_for_dist = false; |
| + base::string16 folder_to_append; |
| switch (location) { |
| case SHORTCUT_LOCATION_DESKTOP: |
| dir_key = (level == CURRENT_USER) ? base::DIR_USER_DESKTOP : |
| @@ -1425,10 +1428,21 @@ 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: |
| dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : |
| base::DIR_COMMON_START_MENU; |
| - add_folder_for_dist = true; |
| + break; |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_DIR: |
| + dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : |
| + base::DIR_COMMON_START_MENU; |
| + folder_to_append = dist->GetStartMenuShortcutSubfolder( |
| + BrowserDistribution::SUBFOLDER_CHROME); |
| + break; |
| + case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR: |
| + dir_key = (level == CURRENT_USER) ? base::DIR_START_MENU : |
| + base::DIR_COMMON_START_MENU; |
| + folder_to_append = dist->GetStartMenuShortcutSubfolder( |
| + BrowserDistribution::SUBFOLDER_APPS); |
| break; |
| case SHORTCUT_LOCATION_TASKBAR_PINS: |
| dir_key = base::DIR_TASKBAR_PINS; |
| @@ -1447,10 +1461,8 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location, |
| return false; |
| } |
| - if (add_folder_for_dist) { |
| - *path = path->Append(dist->GetStartMenuShortcutSubfolder( |
| - BrowserDistribution::SUBFOLDER_CHROME)); |
| - } |
| + if (!folder_to_append.empty()) |
| + *path = path->Append(folder_to_append); |
| return true; |
| } |
| @@ -1463,7 +1475,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; |
| } |
| @@ -2051,7 +2065,8 @@ bool ShellUtil::RemoveShortcuts(ShellUtil::ShortcutLocation location, |
| shortcut_operation, location, dist, level); |
| // Remove chrome-specific shortcut folders if they are now empty. |
| if (success && |
| - (location == SHORTCUT_LOCATION_START_MENU || |
| + (location == SHORTCUT_LOCATION_START_MENU_CHROME_DIR || |
| + location == SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR || |
| location == SHORTCUT_LOCATION_APP_SHORTCUTS)) { |
| success = RemoveShortcutFolderIfEmpty(location, dist, level); |
| } |