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 a547545aebd1cf5a5b015c9bf46f6d4a126fb163..d1ed6b2bff5cda7b959ee6005008f3caf03a5c0d 100644 |
--- a/chrome/browser/web_applications/web_app_win.cc |
+++ b/chrome/browser/web_applications/web_app_win.cc |
@@ -20,6 +20,8 @@ |
#include "chrome/installer/util/browser_distribution.h" |
#include "content/public/browser/browser_thread.h" |
#include "ui/gfx/icon_util.h" |
+#include "ui/gfx/image/image.h" |
+#include "ui/gfx/image/image_family.h" |
namespace { |
@@ -173,9 +175,15 @@ 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::ImageFamily& image) { |
+ // TODO(mgiuca): Save an icon with all icon sizes, not just a hard-coded |
+ // 32x32 icon. http://crbug.com/163864. |
+ const gfx::Image* icon_32 = image.Get(32, 32); |
benwells
2013/04/04 04:58:30
nit: add kIconSize = 32; and use that.
Matt Giuca
2013/04/04 05:15:36
Done.
|
+ SkBitmap bitmap = (icon_32 && !icon_32->IsEmpty()) ? *icon_32->ToSkBitmap() : |
+ 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. |
@@ -236,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; |
} |
@@ -319,8 +326,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); |
} |
} |