Chromium Code Reviews| Index: base/file_util_win.cc |
| diff --git a/base/file_util_win.cc b/base/file_util_win.cc |
| index b88e13169e8993db2ba2ebb48bd1090cbf355c3f..fa626ec17db0c52ec5e56dd875d2012af3cfbb41 100644 |
| --- a/base/file_util_win.cc |
| +++ b/base/file_util_win.cc |
| @@ -446,17 +446,24 @@ bool CreateOrUpdateShortcutLink(const wchar_t *source, |
| HRESULT result = i_persist_file->Save(destination, TRUE); |
| - // If we successfully updated the icon, notify the shell that we have done so. |
| - if (!create && SUCCEEDED(result)) { |
| - // Release the interfaces in case the SHChangeNotify call below depends on |
| - // the operations above being fully completed. |
| - i_persist_file.Release(); |
| - i_shell_link.Release(); |
| - |
| - SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
| + // Release the interfaces in case the SHChangeNotify call below depends on |
| + // the operations above being fully completed. |
| + i_persist_file.Release(); |
| + i_shell_link.Release(); |
| + |
| + // If we successfully created/updated the icon, notify the shell that we have |
| + // done so. |
| + const bool succeeded = SUCCEEDED(result); |
| + if (succeeded) { |
| + if (create) |
| + SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, destination, NULL); |
| + else |
|
grt (UTC plus 2)
2012/09/01 03:20:28
add braces here and to the if side unless you remo
gab
2012/09/01 22:28:40
Done.
|
| + // TODO(gab): Only use SHCNE_ASSOCCHANGED when the icon changed. |
|
grt (UTC plus 2)
2012/09/01 03:20:28
is it even possible to put icon change detection l
gab
2012/09/01 22:28:40
My goal is to modify this function to check (for u
grt (UTC plus 2)
2012/09/02 14:18:19
The last time the icon changed, there was nothing
grt (UTC plus 2)
2012/09/04 18:44:35
As discussed, it isn't practical to detect the ico
gab
2012/09/04 18:51:07
Done.
|
| + // Otherwise a simple SHCNE_UPDATEITEM should be sufficient. |
| + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
| } |
| - return SUCCEEDED(result); |
| + return succeeded; |
| } |
| bool TaskbarPinShortcutLink(const wchar_t* shortcut) { |