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

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: fix win compile, change LOG(INFO)s to VLOG(1) Created 7 years 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
« no previous file with comments | « chrome/installer/util/shell_util.h ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 9530126b7318169759180891b14a698b21a43ce7..51c25a55fc0b43e22793fbe3b5225bc6741211ed 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1317,7 +1317,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;
@@ -1388,11 +1389,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;
@@ -1410,7 +1411,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 :
@@ -1420,10 +1421,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;
@@ -1442,10 +1454,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;
}
@@ -1458,7 +1468,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;
}
@@ -2070,7 +2082,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);
}
« no previous file with comments | « chrome/installer/util/shell_util.h ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698