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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 if ((shortcut_command_line.empty() && include_empty_command_lines) || | 248 if ((shortcut_command_line.empty() && include_empty_command_lines) || |
249 (shortcut_command_line.find(command_line) != string16::npos)) { | 249 (shortcut_command_line.find(command_line) != string16::npos)) { |
250 paths->push_back(path); | 250 paths->push_back(path); |
251 } | 251 } |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 // Renames the given desktop shortcut and informs the shell of this change. | 255 // Renames the given desktop shortcut and informs the shell of this change. |
256 bool RenameDesktopShortcut(const base::FilePath& old_shortcut_path, | 256 bool RenameDesktopShortcut(const base::FilePath& old_shortcut_path, |
257 const base::FilePath& new_shortcut_path) { | 257 const base::FilePath& new_shortcut_path) { |
258 if (!file_util::Move(old_shortcut_path, new_shortcut_path)) | 258 if (!base::Move(old_shortcut_path, new_shortcut_path)) |
259 return false; | 259 return false; |
260 | 260 |
261 // Notify the shell of the rename, which allows the icon to keep its position | 261 // Notify the shell of the rename, which allows the icon to keep its position |
262 // on the desktop when renamed. Note: This only works if either SHCNF_FLUSH or | 262 // on the desktop when renamed. Note: This only works if either SHCNF_FLUSH or |
263 // SHCNF_FLUSHNOWAIT is specified as a flag. | 263 // SHCNF_FLUSHNOWAIT is specified as a flag. |
264 SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, | 264 SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, |
265 old_shortcut_path.value().c_str(), | 265 old_shortcut_path.value().c_str(), |
266 new_shortcut_path.value().c_str()); | 266 new_shortcut_path.value().c_str()); |
267 return true; | 267 return true; |
268 } | 268 } |
(...skipping 427 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 |