Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Unified Diff: chrome/installer/util/shell_util.cc

Issue 13864015: Move app launcher and chrome apps shortcut strings into the installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_app_id_fix
Patch Set: make necessary linux changes Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index c74754770c40a1ceef2fcbfc360a90b075dd2737..480dba4deb8e0d9318bdbc2e005e8de280bed74f 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1318,7 +1318,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;
@@ -1389,11 +1390,11 @@ bool ShellUtil::QuickIsChromeRegisteredInHKLM(BrowserDistribution* dist,
bool ShellUtil::ShortcutLocationIsSupported(
ShellUtil::ShortcutLocation location) {
switch (location) {
- case SHORTCUT_LOCATION_DESKTOP:
- return true;
- case SHORTCUT_LOCATION_QUICK_LAUNCH:
- return true;
- case SHORTCUT_LOCATION_START_MENU:
+ case SHORTCUT_LOCATION_DESKTOP: // Falls through.
+ case SHORTCUT_LOCATION_QUICK_LAUNCH: // Falls through.
+ case SHORTCUT_LOCATION_START_MENU_ROOT: // Falls through.
+ case SHORTCUT_LOCATION_START_MENU_CHROME_DIR: // Falls through.
+ case SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR:
return true;
case SHORTCUT_LOCATION_TASKBAR_PINS:
return base::win::GetVersion() >= base::win::VERSION_WIN7;
@@ -1411,7 +1412,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 :
@@ -1421,10 +1422,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;
@@ -1443,10 +1455,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;
}
@@ -1459,7 +1469,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;
}
@@ -2047,7 +2059,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);
}

Powered by Google App Engine
This is Rietveld 408576698