chrome/browser/profiles/profile_shortcut_manager_win.cc
// Deletes all desktop shortcuts for the specified profile and also removes the
// corresponding icon file. Must be called on the FILE thread.
Deletes all desktop shortcuts for the specified profile and also removes the
corresponding icon file. Must be called on the FILE thread.
Deletes all desktop shortcuts for the specified profile and also removes the corresponding icon file . Must be called on the FILE thread .
void DeleteDesktopShortcutsAndIconFile(const FilePath& profile_path,
                                       const FilePath& icon_path) {
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
  FilePath chrome_exe;
  if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
    NOTREACHED();
    return;
  }
  const string16 command_line =
      profiles::internal::CreateProfileShortcutFlags(profile_path);
  std::vector<FilePath> shortcuts;
  ListDesktopShortcutsWithCommandLine(chrome_exe, command_line, false,
                                      &shortcuts);
  BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
  for (size_t i = 0; i < shortcuts.size(); ++i) {
    const string16 shortcut_name =
        shortcuts[i].BaseName().RemoveExtension().value();
    ShellUtil::RemoveShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
                              distribution, chrome_exe.value(),
                              ShellUtil::CURRENT_USER,
                              &shortcut_name);
  }
  file_util::Delete(icon_path, false);
}
void DeleteDesktopShortcutsAndIconFile ( const FilePath & profile_path , const FilePath & icon_path ) { DCHECK ( BrowserThread :: CurrentlyOn ( BrowserThread :: FILE ) ) ; FilePath chrome_exe ; if ( ! PathService :: Get ( base :: FILE_EXE , & chrome_exe ) ) { NOTREACHED ( ) ; return ; } const string16 command_line = profiles :: internal :: CreateProfileShortcutFlags ( profile_path ) ; std :: vector < FilePath > shortcuts ; ListDesktopShortcutsWithCommandLine ( chrome_exe , command_line , false , & shortcuts ) ; BrowserDistribution * distribution = BrowserDistribution :: GetDistribution ( ) ; for ( size_t i = 0 ; i < shortcuts . size ( ) ; ++ i ) { const string16 shortcut_name = shortcuts [ i ] . BaseName ( ) . RemoveExtension ( ) . value ( ) ; ShellUtil :: RemoveShortcut ( ShellUtil :: SHORTCUT_LOCATION_DESKTOP , distribution , chrome_exe . value ( ) , ShellUtil :: CURRENT_USER , & shortcut_name ) ; } file_util :: Delete ( icon_path , false ) ; }
Deletes all desktop shortcuts for the specified profile and also removes the
corresponding icon file.
Deletes all desktop shortcuts for the specified profile and also removes the corresponding icon file .