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 64b667f731a81fcf97fe0faef1019a20d9b4bd8e..9e004658f5c9cdd04e3b140c74e03358e96b7374 100644 |
--- a/chrome/browser/web_applications/web_app_win.cc |
+++ b/chrome/browser/web_applications/web_app_win.cc |
@@ -19,7 +19,9 @@ |
#include "chrome/installer/launcher_support/chrome_launcher_support.h" |
#include "chrome/installer/util/browser_distribution.h" |
#include "content/public/browser/browser_thread.h" |
+#include "ui/gfx/icon_family.h" |
#include "ui/gfx/icon_util.h" |
+#include "ui/gfx/image/image_skia.h" |
namespace { |
@@ -173,9 +175,14 @@ 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 SkBitmap& image) { |
- if (ShouldUpdateIcon(icon_file, image)) { |
- if (SaveIconWithCheckSum(icon_file, image)) { |
+bool CheckAndSaveIcon(const base::FilePath& icon_file, |
+ const gfx::IconFamily& image) { |
+ // TODO(mgiuca): Save an icon with all icon sizes, not just a hard-coded |
+ // 32x32 icon. http://crbug.com/180766. |
+ const gfx::ImageSkia* icon_32 = image.Get(32, 32); |
+ SkBitmap bitmap = icon_32 ? *icon_32->bitmap() : SkBitmap(); |
+ if (ShouldUpdateIcon(icon_file, bitmap)) { |
+ if (SaveIconWithCheckSum(icon_file, bitmap)) { |
// 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. |
@@ -237,8 +244,7 @@ bool CreatePlatformShortcuts( |
// Creates an ico file to use with shortcut. |
base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( |
FILE_PATH_LITERAL(".ico")); |
- if (!web_app::internals::CheckAndSaveIcon(icon_file, |
- *shortcut_info.favicon.ToSkBitmap())) { |
+ if (!web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon)) { |
return false; |
} |
@@ -325,8 +331,7 @@ void UpdatePlatformShortcuts( |
base::FilePath icon_file = web_app_path.Append(file_name).ReplaceExtension( |
FILE_PATH_LITERAL(".ico")); |
if (file_util::PathExists(icon_file)) { |
- web_app::internals::CheckAndSaveIcon(icon_file, |
- *shortcut_info.favicon.ToSkBitmap()); |
+ web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon); |
} |
} |