| 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_win.h" | 5 #include "chrome/browser/web_applications/web_app_win.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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 const base::FilePath& web_app_path, | 453 const base::FilePath& web_app_path, |
| 454 const ShellIntegration::ShortcutInfo& shortcut_info) { | 454 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 455 GetShortcutLocationsAndDeleteShortcuts( | 455 GetShortcutLocationsAndDeleteShortcuts( |
| 456 web_app_path, shortcut_info.profile_path, shortcut_info.title, NULL, | 456 web_app_path, shortcut_info.profile_path, shortcut_info.title, NULL, |
| 457 NULL); | 457 NULL); |
| 458 | 458 |
| 459 // If there are no more shortcuts in the Chrome Apps subdirectory, remove it. | 459 // If there are no more shortcuts in the Chrome Apps subdirectory, remove it. |
| 460 base::FilePath chrome_apps_dir; | 460 base::FilePath chrome_apps_dir; |
| 461 if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) { | 461 if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) { |
| 462 chrome_apps_dir = chrome_apps_dir.Append(GetAppShortcutsSubdirName()); | 462 chrome_apps_dir = chrome_apps_dir.Append(GetAppShortcutsSubdirName()); |
| 463 if (file_util::IsDirectoryEmpty(chrome_apps_dir)) | 463 if (base::IsDirectoryEmpty(chrome_apps_dir)) |
| 464 base::DeleteFile(chrome_apps_dir, false); | 464 base::DeleteFile(chrome_apps_dir, false); |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 | 467 |
| 468 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { | 468 void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { |
| 469 GetShortcutLocationsAndDeleteShortcuts(base::FilePath(), profile_path, L"", | 469 GetShortcutLocationsAndDeleteShortcuts(base::FilePath(), profile_path, L"", |
| 470 NULL, NULL); | 470 NULL, NULL); |
| 471 | 471 |
| 472 // If there are no more shortcuts in the Chrome Apps subdirectory, remove it. | 472 // If there are no more shortcuts in the Chrome Apps subdirectory, remove it. |
| 473 base::FilePath chrome_apps_dir; | 473 base::FilePath chrome_apps_dir; |
| 474 if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) { | 474 if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) { |
| 475 chrome_apps_dir = chrome_apps_dir.Append(GetAppShortcutsSubdirName()); | 475 chrome_apps_dir = chrome_apps_dir.Append(GetAppShortcutsSubdirName()); |
| 476 if (file_util::IsDirectoryEmpty(chrome_apps_dir)) | 476 if (base::IsDirectoryEmpty(chrome_apps_dir)) |
| 477 base::DeleteFile(chrome_apps_dir, false); | 477 base::DeleteFile(chrome_apps_dir, false); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 std::vector<base::FilePath> GetShortcutPaths( | 481 std::vector<base::FilePath> GetShortcutPaths( |
| 482 const ShellIntegration::ShortcutLocations& creation_locations) { | 482 const ShellIntegration::ShortcutLocations& creation_locations) { |
| 483 // Shortcut paths under which to create shortcuts. | 483 // Shortcut paths under which to create shortcuts. |
| 484 std::vector<base::FilePath> shortcut_paths; | 484 std::vector<base::FilePath> shortcut_paths; |
| 485 // Locations to add to shortcut_paths. | 485 // Locations to add to shortcut_paths. |
| 486 struct { | 486 struct { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 path = path.Append(locations[i].subdir); | 524 path = path.Append(locations[i].subdir); |
| 525 shortcut_paths.push_back(path); | 525 shortcut_paths.push_back(path); |
| 526 } | 526 } |
| 527 } | 527 } |
| 528 return shortcut_paths; | 528 return shortcut_paths; |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace internals | 531 } // namespace internals |
| 532 | 532 |
| 533 } // namespace web_app | 533 } // namespace web_app |
| OLD | NEW |