| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "chrome/browser/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" | 
| 6 | 6 | 
| 7 #include <shlobj.h> | 7 #include <shlobj.h> | 
| 8 | 8 | 
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" | 
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" | 
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 147   std::vector<base::FilePath> shortcut_paths; | 147   std::vector<base::FilePath> shortcut_paths; | 
| 148   base::FilePath base_path = shortcut_path. | 148   base::FilePath base_path = shortcut_path. | 
| 149       Append(web_app::internals::GetSanitizedFileName(shortcut_name)). | 149       Append(web_app::internals::GetSanitizedFileName(shortcut_name)). | 
| 150       ReplaceExtension(FILE_PATH_LITERAL(".lnk")); | 150       ReplaceExtension(FILE_PATH_LITERAL(".lnk")); | 
| 151 | 151 | 
| 152   const int fileNamesToCheck = 10; | 152   const int fileNamesToCheck = 10; | 
| 153   for (int i = 0; i < fileNamesToCheck; ++i) { | 153   for (int i = 0; i < fileNamesToCheck; ++i) { | 
| 154     base::FilePath shortcut_file = base_path; | 154     base::FilePath shortcut_file = base_path; | 
| 155     if (i) { | 155     if (i) { | 
| 156       shortcut_file = shortcut_file.InsertBeforeExtensionASCII( | 156       shortcut_file = shortcut_file.InsertBeforeExtensionASCII( | 
| 157           StringPrintf(" (%d)", i)); | 157           base::StringPrintf(" (%d)", i)); | 
| 158     } | 158     } | 
| 159     if (file_util::PathExists(shortcut_file) && | 159     if (file_util::PathExists(shortcut_file) && | 
| 160         ShortcutIsForProfile(shortcut_file, profile_path)) { | 160         ShortcutIsForProfile(shortcut_file, profile_path)) { | 
| 161       shortcut_paths.push_back(shortcut_file); | 161       shortcut_paths.push_back(shortcut_file); | 
| 162     } | 162     } | 
| 163   } | 163   } | 
| 164   return shortcut_paths; | 164   return shortcut_paths; | 
| 165 } | 165 } | 
| 166 | 166 | 
| 167 }  // namespace | 167 }  // namespace | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 274     base::FilePath shortcut_file = shortcut_paths[i].Append(file_name). | 274     base::FilePath shortcut_file = shortcut_paths[i].Append(file_name). | 
| 275         ReplaceExtension(FILE_PATH_LITERAL(".lnk")); | 275         ReplaceExtension(FILE_PATH_LITERAL(".lnk")); | 
| 276 | 276 | 
| 277     int unique_number = | 277     int unique_number = | 
| 278         file_util::GetUniquePathNumber(shortcut_file, FILE_PATH_LITERAL("")); | 278         file_util::GetUniquePathNumber(shortcut_file, FILE_PATH_LITERAL("")); | 
| 279     if (unique_number == -1) { | 279     if (unique_number == -1) { | 
| 280       success = false; | 280       success = false; | 
| 281       continue; | 281       continue; | 
| 282     } else if (unique_number > 0) { | 282     } else if (unique_number > 0) { | 
| 283       shortcut_file = shortcut_file.InsertBeforeExtensionASCII( | 283       shortcut_file = shortcut_file.InsertBeforeExtensionASCII( | 
| 284           StringPrintf(" (%d)", unique_number)); | 284           base::StringPrintf(" (%d)", unique_number)); | 
| 285     } | 285     } | 
| 286 | 286 | 
| 287     base::win::ShortcutProperties shortcut_properties; | 287     base::win::ShortcutProperties shortcut_properties; | 
| 288     shortcut_properties.set_target(target_exe); | 288     shortcut_properties.set_target(target_exe); | 
| 289     shortcut_properties.set_working_dir(working_dir); | 289     shortcut_properties.set_working_dir(working_dir); | 
| 290     shortcut_properties.set_arguments(wide_switches); | 290     shortcut_properties.set_arguments(wide_switches); | 
| 291     shortcut_properties.set_description(description); | 291     shortcut_properties.set_description(description); | 
| 292     shortcut_properties.set_icon(icon_file, 0); | 292     shortcut_properties.set_icon(icon_file, 0); | 
| 293     shortcut_properties.set_app_id(app_id); | 293     shortcut_properties.set_app_id(app_id); | 
| 294     shortcut_properties.set_dual_mode(false); | 294     shortcut_properties.set_dual_mode(false); | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 356       // they are all unpinned. | 356       // they are all unpinned. | 
| 357       base::win::TaskbarUnpinShortcutLink(j->value().c_str()); | 357       base::win::TaskbarUnpinShortcutLink(j->value().c_str()); | 
| 358       file_util::Delete(*j, false); | 358       file_util::Delete(*j, false); | 
| 359     } | 359     } | 
| 360   } | 360   } | 
| 361 } | 361 } | 
| 362 | 362 | 
| 363 }  // namespace internals | 363 }  // namespace internals | 
| 364 | 364 | 
| 365 }  // namespace web_app | 365 }  // namespace web_app | 
| OLD | NEW | 
|---|