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

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

Issue 10914109: Refactoring and tests for the highly undertested file_util::CreateOrUpdateShortcutLink() method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/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 8bf3b8f02b906831f87347d5fcbe1d583cdc55ed..b2e4c37635a2e9a070d656b1ee287b944f5f4cd9 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -229,7 +229,7 @@ bool CreatePlatformShortcuts(
return false;
// Working directory.
- FilePath chrome_folder = chrome_exe.DirName();
+ FilePath chrome_folder(chrome_exe.DirName());
CommandLine cmd_line(CommandLine::NO_PROGRAM);
cmd_line = ShellIntegration::CommandLineArgsForLauncher(shortcut_info.url,
@@ -248,10 +248,9 @@ bool CreatePlatformShortcuts(
description.resize(MAX_PATH - 1);
// Generates app id from web app url and profile path.
- std::string app_name =
- web_app::GenerateApplicationNameFromInfo(shortcut_info);
- string16 app_id = ShellIntegration::GetAppModelIdForProfile(
- UTF8ToUTF16(app_name), shortcut_info.profile_path);
+ std::string app_name(web_app::GenerateApplicationNameFromInfo(shortcut_info));
+ string16 app_id(ShellIntegration::GetAppModelIdForProfile(
+ UTF8ToUTF16(app_name), shortcut_info.profile_path));
FilePath shortcut_to_pin;
bool success = true;
@@ -269,15 +268,16 @@ bool CreatePlatformShortcuts(
StringPrintf(" (%d)", unique_number));
}
+ file_util::ShortcutProperties shortcut_properties;
+ shortcut_properties.set_target(chrome_exe.value());
+ shortcut_properties.set_working_dir(chrome_folder.value());
+ shortcut_properties.set_arguments(wide_switches);
+ shortcut_properties.set_description(description);
+ shortcut_properties.set_icon(icon_file.value(), 0);
+ shortcut_properties.set_app_id(app_id);
+ shortcut_properties.set_dual_mode(false);
success = file_util::CreateOrUpdateShortcutLink(
- chrome_exe.value().c_str(),
- shortcut_file.value().c_str(),
- chrome_folder.value().c_str(),
- wide_switches.c_str(),
- description.c_str(),
- icon_file.value().c_str(),
- 0,
- app_id.c_str(),
+ shortcut_file.value(), shortcut_properties,
file_util::SHORTCUT_CREATE_ALWAYS) && success;
// Any shortcut would work for the pinning. We use the first one.

Powered by Google App Engine
This is Rietveld 408576698