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..b8a422f0eb9b566a6652099a4647b27149a626c6 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" |
benwells
2013/04/30 03:22:19
I think you'll need grit/google_chrome_strings.h a
Matt Giuca
2013/04/30 03:50:36
Hmm. I want to be sure about this because I don't
|
+#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,15 @@ 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)) { |
benwells
2013/04/30 03:22:19
Nit: remove braces around single line if
Matt Giuca
2013/04/30 03:50:36
Done.
|
+ file_util::Delete(chrome_apps_dir, false); |
+ } |
+ } |
} |
std::vector<base::FilePath> GetShortcutPaths( |