Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5214)

Unified Diff: chrome/browser/web_applications/web_app_win.cc

Issue 1026113003: Don't send a SHChangeNotify for creating an app icon when creating a shortcut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/web_applications/web_app_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_applications/web_app_win.cc
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index 10bad7198f3101659a5f1bd4bf09e1e40b068141..45fdf5e921d7b1fdfb007d3b1660ddfc1fbe378d 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -183,7 +183,8 @@ bool CreateShortcutsInPaths(
// Generates file name to use with persisted ico and shortcut file.
base::FilePath icon_file =
web_app::internals::GetIconFilePath(web_app_path, shortcut_info.title);
- if (!web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon)) {
+ if (!web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon,
+ false)) {
return false;
}
@@ -357,7 +358,7 @@ void CreateIconAndSetRelaunchDetails(const base::FilePath& web_app_path,
return;
ui::win::SetAppIconForWindow(icon_file.value(), hwnd);
- web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon);
+ web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon, true);
}
void OnShortcutInfoLoadedForSetRelaunchDetails(
@@ -543,7 +544,7 @@ base::FilePath CreateShortcutInWebAppDir(const base::FilePath& web_app_dir,
} else {
internals::CheckAndSaveIcon(
internals::GetIconFilePath(web_app_dir, shortcut_info.title),
- shortcut_info.favicon);
+ shortcut_info.favicon, true);
}
return web_app_dir_shortcut;
}
@@ -564,23 +565,22 @@ void UpdateShortcutsForAllApps(Profile* profile,
namespace internals {
-// Saves |image| to |icon_file| if the file is outdated and refresh shell's
-// icon cache to ensure correct icon is displayed. Returns true if icon_file
-// is up to date or successfully updated.
bool CheckAndSaveIcon(const base::FilePath& icon_file,
- const gfx::ImageFamily& image) {
- if (ShouldUpdateIcon(icon_file, image)) {
- if (SaveIconWithCheckSum(icon_file, image)) {
- // Refresh shell's icon cache. This call is quite disruptive as user would
- // see explorer rebuilding the icon cache. It would be great that we find
- // a better way to achieve this.
- SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT,
- NULL, NULL);
- } else {
- return false;
- }
- }
+ const gfx::ImageFamily& image,
+ bool refresh_shell_icon_cache) {
+ if (!ShouldUpdateIcon(icon_file, image))
+ return true;
+
+ if (!SaveIconWithCheckSum(icon_file, image))
+ return false;
+ if (refresh_shell_icon_cache) {
+ // Refresh shell's icon cache. This call is quite disruptive as user would
+ // see explorer rebuilding the icon cache. It would be great that we find
+ // a better way to achieve this.
+ SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSHNOWAIT, NULL,
+ NULL);
+ }
return true;
}
@@ -674,7 +674,7 @@ void UpdatePlatformShortcuts(
// Update the icon if necessary.
base::FilePath icon_file = GetIconFilePath(web_app_path, shortcut_info.title);
- CheckAndSaveIcon(icon_file, shortcut_info.favicon);
+ CheckAndSaveIcon(icon_file, shortcut_info.favicon, true);
}
void DeletePlatformShortcuts(const base::FilePath& web_app_path,
« no previous file with comments | « chrome/browser/web_applications/web_app_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698