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

Unified Diff: chrome/browser/web_applications/web_app_win.cc

Issue 14533004: Start menu shortcuts for apps on Windows are now inside a "Chrome Apps" submenu. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor nit. Created 7 years, 8 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
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_applications/web_app_win.cc
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index 98d9e2c5bc9ffbfbe77b4e4fb721508e1844ccc5..cc5cb50ac861208aaef4fb7e1a788beb8fe9d649 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -19,6 +19,8 @@
#include "chrome/installer/launcher_support/chrome_launcher_support.h"
#include "chrome/installer/util/util_constants.h"
#include "content/public/browser/browser_thread.h"
+#include "grit/chromium_strings.h"
+#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/icon_util.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_family.h"
@@ -240,6 +242,11 @@ bool CreatePlatformShortcuts(
shortcut_properties.set_icon(icon_file, 0);
shortcut_properties.set_app_id(app_id);
shortcut_properties.set_dual_mode(false);
+ if (!file_util::PathExists(shortcut_file.DirName()) &&
+ !file_util::CreateDirectory(shortcut_file.DirName())) {
+ NOTREACHED();
+ return false;
+ }
success = base::win::CreateOrUpdateShortcutLink(
shortcut_file, shortcut_properties,
base::win::SHORTCUT_CREATE_ALWAYS) && success;
@@ -283,6 +290,12 @@ void DeletePlatformShortcuts(
all_shortcut_locations.in_applications_menu = true;
all_shortcut_locations.in_quick_launch_bar = true;
all_shortcut_locations.on_desktop = true;
+ // Delete shortcuts from the Chrome Apps subdirectory.
+ // This matches the subdir name set by CreateApplicationShortcutView::Accept
+ // for Chrome apps (not URL apps, but this function does not apply for them).
+ string16 start_menu_subdir =
+ l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME);
+ all_shortcut_locations.applications_menu_subdir = start_menu_subdir;
std::vector<base::FilePath> shortcut_paths = GetShortcutPaths(
all_shortcut_locations);
if (base::win::GetVersion() >= base::win::VERSION_WIN7)
@@ -301,6 +314,14 @@ void DeletePlatformShortcuts(
file_util::Delete(*j, false);
}
}
+
+ // If there are no more shortcuts in the Chrome Apps subdirectory, remove it.
+ base::FilePath chrome_apps_dir;
+ if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) {
+ chrome_apps_dir = chrome_apps_dir.Append(start_menu_subdir);
+ if (file_util::IsDirectoryEmpty(chrome_apps_dir))
+ file_util::Delete(chrome_apps_dir, false);
+ }
}
std::vector<base::FilePath> GetShortcutPaths(
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698