| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 std::vector<base::FilePath> shortcut_files = | 274 std::vector<base::FilePath> shortcut_files = |
| 275 MatchingShortcutsForProfileAndExtension(*i, profile_path, title); | 275 MatchingShortcutsForProfileAndExtension(*i, profile_path, title); |
| 276 if (shortcut_paths && !shortcut_files.empty()) { | 276 if (shortcut_paths && !shortcut_files.empty()) { |
| 277 shortcut_paths->push_back(*i); | 277 shortcut_paths->push_back(*i); |
| 278 } | 278 } |
| 279 for (std::vector<base::FilePath>::const_iterator j = shortcut_files.begin(); | 279 for (std::vector<base::FilePath>::const_iterator j = shortcut_files.begin(); |
| 280 j != shortcut_files.end(); ++j) { | 280 j != shortcut_files.end(); ++j) { |
| 281 // Any shortcut could have been pinned, either by chrome or the user, so | 281 // Any shortcut could have been pinned, either by chrome or the user, so |
| 282 // they are all unpinned. | 282 // they are all unpinned. |
| 283 base::win::TaskbarUnpinShortcutLink(j->value().c_str()); | 283 base::win::TaskbarUnpinShortcutLink(j->value().c_str()); |
| 284 file_util::Delete(*j, false); | 284 base::Delete(*j, false); |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace | 289 } // namespace |
| 290 | 290 |
| 291 namespace web_app { | 291 namespace web_app { |
| 292 | 292 |
| 293 base::FilePath CreateShortcutInWebAppDir( | 293 base::FilePath CreateShortcutInWebAppDir( |
| 294 const base::FilePath& web_app_dir, | 294 const base::FilePath& web_app_dir, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 const ShellIntegration::ShortcutInfo& shortcut_info) { | 412 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 413 GetShortcutLocationsAndDeleteShortcuts( | 413 GetShortcutLocationsAndDeleteShortcuts( |
| 414 web_app_path, shortcut_info.profile_path, shortcut_info.title, NULL, | 414 web_app_path, shortcut_info.profile_path, shortcut_info.title, NULL, |
| 415 NULL); | 415 NULL); |
| 416 | 416 |
| 417 // If there are no more shortcuts in the Chrome Apps subdirectory, remove it. | 417 // If there are no more shortcuts in the Chrome Apps subdirectory, remove it. |
| 418 base::FilePath chrome_apps_dir; | 418 base::FilePath chrome_apps_dir; |
| 419 if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) { | 419 if (PathService::Get(base::DIR_START_MENU, &chrome_apps_dir)) { |
| 420 chrome_apps_dir = chrome_apps_dir.Append(GetAppShortcutsSubdirName()); | 420 chrome_apps_dir = chrome_apps_dir.Append(GetAppShortcutsSubdirName()); |
| 421 if (file_util::IsDirectoryEmpty(chrome_apps_dir)) | 421 if (file_util::IsDirectoryEmpty(chrome_apps_dir)) |
| 422 file_util::Delete(chrome_apps_dir, false); | 422 base::Delete(chrome_apps_dir, false); |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 std::vector<base::FilePath> GetShortcutPaths( | 426 std::vector<base::FilePath> GetShortcutPaths( |
| 427 const ShellIntegration::ShortcutLocations& creation_locations) { | 427 const ShellIntegration::ShortcutLocations& creation_locations) { |
| 428 // Shortcut paths under which to create shortcuts. | 428 // Shortcut paths under which to create shortcuts. |
| 429 std::vector<base::FilePath> shortcut_paths; | 429 std::vector<base::FilePath> shortcut_paths; |
| 430 // Locations to add to shortcut_paths. | 430 // Locations to add to shortcut_paths. |
| 431 struct { | 431 struct { |
| 432 bool use_this_location; | 432 bool use_this_location; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 path = path.Append(locations[i].subdir); | 469 path = path.Append(locations[i].subdir); |
| 470 shortcut_paths.push_back(path); | 470 shortcut_paths.push_back(path); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 return shortcut_paths; | 473 return shortcut_paths; |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace internals | 476 } // namespace internals |
| 477 | 477 |
| 478 } // namespace web_app | 478 } // namespace web_app |
| OLD | NEW |