| 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/profiles/profile_shortcut_manager_win.h" | 5 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
| 6 | 6 |
| 7 #include <shlobj.h> // For SHChangeNotify(). | 7 #include <shlobj.h> // For SHChangeNotify(). |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } else { | 298 } else { |
| 299 // If the shortcut does not exist, it may have been renamed by the user. In | 299 // If the shortcut does not exist, it may have been renamed by the user. In |
| 300 // that case, its name should not be changed. | 300 // that case, its name should not be changed. |
| 301 // It's also possible that a system-level shortcut exists instead - this | 301 // It's also possible that a system-level shortcut exists instead - this |
| 302 // should only be the case for the original Chrome shortcut from an | 302 // should only be the case for the original Chrome shortcut from an |
| 303 // installation. If that's the case, copy that one over - it will get its | 303 // installation. If that's the case, copy that one over - it will get its |
| 304 // properties updated by |CreateOrUpdateDesktopShortcutsForProfile()|. | 304 // properties updated by |CreateOrUpdateDesktopShortcutsForProfile()|. |
| 305 const base::FilePath possible_old_system_shortcut = | 305 const base::FilePath possible_old_system_shortcut = |
| 306 system_shortcuts_directory.Append(old_shortcut_filename); | 306 system_shortcuts_directory.Append(old_shortcut_filename); |
| 307 if (file_util::PathExists(possible_old_system_shortcut)) | 307 if (file_util::PathExists(possible_old_system_shortcut)) |
| 308 file_util::CopyFile(possible_old_system_shortcut, new_shortcut_path); | 308 base::CopyFile(possible_old_system_shortcut, new_shortcut_path); |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 | 311 |
| 312 // Updates all desktop shortcuts for the given profile to have the specified | 312 // Updates all desktop shortcuts for the given profile to have the specified |
| 313 // parameters. If |create_mode| is CREATE_WHEN_NONE_FOUND, a new shortcut is | 313 // parameters. If |create_mode| is CREATE_WHEN_NONE_FOUND, a new shortcut is |
| 314 // created if no existing ones were found. Whether non-profile shortcuts should | 314 // created if no existing ones were found. Whether non-profile shortcuts should |
| 315 // be updated is specified by |action|. Must be called on the FILE thread. | 315 // be updated is specified by |action|. Must be called on the FILE thread. |
| 316 void CreateOrUpdateDesktopShortcutsForProfile( | 316 void CreateOrUpdateDesktopShortcutsForProfile( |
| 317 const base::FilePath& profile_path, | 317 const base::FilePath& profile_path, |
| 318 const string16& old_profile_name, | 318 const string16& old_profile_name, |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 BrowserThread::PostTask( | 696 BrowserThread::PostTask( |
| 697 BrowserThread::FILE, FROM_HERE, | 697 BrowserThread::FILE, FROM_HERE, |
| 698 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, | 698 base::Bind(&CreateOrUpdateDesktopShortcutsForProfile, profile_path, |
| 699 old_shortcut_appended_name, new_shortcut_appended_name, | 699 old_shortcut_appended_name, new_shortcut_appended_name, |
| 700 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, | 700 avatar_bitmap_copy_1x, avatar_bitmap_copy_2x, create_mode, |
| 701 action)); | 701 action)); |
| 702 | 702 |
| 703 cache->SetShortcutNameOfProfileAtIndex(profile_index, | 703 cache->SetShortcutNameOfProfileAtIndex(profile_index, |
| 704 new_shortcut_appended_name); | 704 new_shortcut_appended_name); |
| 705 } | 705 } |
| OLD | NEW |