Commit d3b68586 authored by calamity@chromium.org's avatar calamity@chromium.org

Fix shortcut name slicing for v2 apps on windows


BUG=172584


Review URL: https://chromiumcodereview.appspot.com/13620002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192495 0039d316-1c4b-4281-b951-d872f2087c98
parent bcf83b53
...@@ -147,7 +147,7 @@ std::vector<base::FilePath> MatchingShortcutsForProfileAndExtension( ...@@ -147,7 +147,7 @@ std::vector<base::FilePath> MatchingShortcutsForProfileAndExtension(
std::vector<base::FilePath> shortcut_paths; std::vector<base::FilePath> shortcut_paths;
base::FilePath base_path = shortcut_path. base::FilePath base_path = shortcut_path.
Append(web_app::internals::GetSanitizedFileName(shortcut_name)). Append(web_app::internals::GetSanitizedFileName(shortcut_name)).
ReplaceExtension(FILE_PATH_LITERAL(".lnk")); AddExtension(FILE_PATH_LITERAL(".lnk"));
const int fileNamesToCheck = 10; const int fileNamesToCheck = 10;
for (int i = 0; i < fileNamesToCheck; ++i) { for (int i = 0; i < fileNamesToCheck; ++i) {
...@@ -234,7 +234,7 @@ bool CreatePlatformShortcuts( ...@@ -234,7 +234,7 @@ bool CreatePlatformShortcuts(
web_app::internals::GetSanitizedFileName(shortcut_info.title); web_app::internals::GetSanitizedFileName(shortcut_info.title);
// Creates an ico file to use with shortcut. // Creates an ico file to use with shortcut.
base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( base::FilePath icon_file = web_app_path.Append(file_name).AddExtension(
FILE_PATH_LITERAL(".ico")); FILE_PATH_LITERAL(".ico"));
if (!web_app::internals::CheckAndSaveIcon(icon_file, if (!web_app::internals::CheckAndSaveIcon(icon_file,
*shortcut_info.favicon.ToSkBitmap())) { *shortcut_info.favicon.ToSkBitmap())) {
...@@ -270,7 +270,7 @@ bool CreatePlatformShortcuts( ...@@ -270,7 +270,7 @@ bool CreatePlatformShortcuts(
bool success = true; bool success = true;
for (size_t i = 0; i < shortcut_paths.size(); ++i) { for (size_t i = 0; i < shortcut_paths.size(); ++i) {
base::FilePath shortcut_file = shortcut_paths[i].Append(file_name). base::FilePath shortcut_file = shortcut_paths[i].Append(file_name).
ReplaceExtension(FILE_PATH_LITERAL(".lnk")); AddExtension(FILE_PATH_LITERAL(".lnk"));
if (shortcut_paths[i] != web_app_path) { if (shortcut_paths[i] != web_app_path) {
int unique_number = int unique_number =
file_util::GetUniquePathNumber(shortcut_file, FILE_PATH_LITERAL("")); file_util::GetUniquePathNumber(shortcut_file, FILE_PATH_LITERAL(""));
...@@ -299,7 +299,7 @@ bool CreatePlatformShortcuts( ...@@ -299,7 +299,7 @@ bool CreatePlatformShortcuts(
// Use the web app path shortcut for pinning to avoid having unique numbers // Use the web app path shortcut for pinning to avoid having unique numbers
// in the application name. // in the application name.
base::FilePath shortcut_to_pin = web_app_path.Append(file_name). base::FilePath shortcut_to_pin = web_app_path.Append(file_name).
ReplaceExtension(FILE_PATH_LITERAL(".lnk")); AddExtension(FILE_PATH_LITERAL(".lnk"));
success = base::win::TaskbarPinShortcutLink( success = base::win::TaskbarPinShortcutLink(
shortcut_to_pin.value().c_str()) && success; shortcut_to_pin.value().c_str()) && success;
} }
...@@ -316,7 +316,7 @@ void UpdatePlatformShortcuts( ...@@ -316,7 +316,7 @@ void UpdatePlatformShortcuts(
// If an icon file exists, and is out of date, replace it with the new icon // If an icon file exists, and is out of date, replace it with the new icon
// and let the shell know the icon has been modified. // and let the shell know the icon has been modified.
base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( base::FilePath icon_file = web_app_path.Append(file_name).AddExtension(
FILE_PATH_LITERAL(".ico")); FILE_PATH_LITERAL(".ico"));
if (file_util::PathExists(icon_file)) { if (file_util::PathExists(icon_file)) {
web_app::internals::CheckAndSaveIcon(icon_file, web_app::internals::CheckAndSaveIcon(icon_file,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment