| Index: chrome/browser/ui/web_applications/web_app_ui.cc
|
| diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc
|
| index 34ad3d0994fe056d0662e1e20e848ba65cea95bc..7e2ae049b84de6b022ef2c7b8ebd0d1951f94493 100644
|
| --- a/chrome/browser/ui/web_applications/web_app_ui.cc
|
| +++ b/chrome/browser/ui/web_applications/web_app_ui.cc
|
| @@ -194,8 +194,8 @@ void UpdateShortcutWorker::DidDownloadFavicon(
|
|
|
| if (!bitmaps.empty() && !bitmaps[closest_index].isNull()) {
|
| // Update icon with download image and update shortcut.
|
| - shortcut_info_.favicon =
|
| - gfx::Image::CreateFrom1xBitmap(bitmaps[closest_index]);
|
| + shortcut_info_.favicon.Add(
|
| + gfx::ImageSkia::CreateFrom1xBitmap(bitmaps[closest_index]));
|
| extensions::TabHelper* extensions_tab_helper =
|
| extensions::TabHelper::FromWebContents(web_contents_);
|
| extensions_tab_helper->SetAppIcon(bitmaps[closest_index]);
|
| @@ -269,8 +269,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() {
|
|
|
| base::FilePath icon_file = web_app_path.Append(file_name_).ReplaceExtension(
|
| FILE_PATH_LITERAL(".ico"));
|
| - web_app::internals::CheckAndSaveIcon(icon_file,
|
| - *shortcut_info_.favicon.ToSkBitmap());
|
| + web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info_.favicon);
|
|
|
| // Update existing shortcuts' description, icon and app id.
|
| CheckExistingShortcuts();
|
| @@ -331,9 +330,21 @@ void OnImageLoaded(ShellIntegration::ShortcutInfo shortcut_info,
|
| SkBitmap bmp = skia::ImageOperations::Resize(
|
| *default_icon.ToSkBitmap(), skia::ImageOperations::RESIZE_BEST,
|
| size, size);
|
| - shortcut_info.favicon = gfx::Image::CreateFrom1xBitmap(bmp);
|
| + shortcut_info.favicon.Add(gfx::ImageSkia::CreateFrom1xBitmap(bmp));
|
| } else {
|
| - shortcut_info.favicon = image;
|
| + // As described in UpdateShortcutInfoAndIconForApp, image contains all of
|
| + // the icons, hackily put into a single ImageSkia. Separate them out into
|
| + // individual ImageSkias and insert them into the icon family.
|
| + const gfx::ImageSkia& multires_image_skia = *(image.ToImageSkia());
|
| + std::vector<gfx::ImageSkiaRep> image_reps =
|
| + multires_image_skia.image_reps();
|
| + for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin();
|
| + it != image_reps.end(); ++it) {
|
| + const gfx::ImageSkiaRep& image = *it;
|
| + gfx::ImageSkia image_skia(image);
|
| + image_skia.MakeThreadSafe();
|
| + shortcut_info.favicon.Add(image_skia);
|
| + }
|
| }
|
|
|
| callback.Run(shortcut_info);
|
| @@ -367,7 +378,7 @@ void GetShortcutInfoForTab(WebContents* web_contents,
|
| web_contents->GetTitle()) :
|
| app_info.title;
|
| info->description = app_info.description;
|
| - info->favicon = gfx::Image(favicon_tab_helper->GetFavicon());
|
| + info->favicon.Add(favicon_tab_helper->GetFavicon());
|
|
|
| Profile* profile =
|
| Profile::FromBrowserContext(web_contents->GetBrowserContext());
|
| @@ -401,6 +412,11 @@ void UpdateShortcutInfoAndIconForApp(
|
| ShellIntegration::ShortcutInfo shortcut_info =
|
| ShortcutInfoForExtensionAndProfile(&extension, profile);
|
|
|
| + // We want to load each icon into a separate ImageSkia to insert into an
|
| + // IconFamily, but LoadImagesAsync currently only builds a single ImageSkia.
|
| + // Hack around this by loading all images into the ImageSkia as 100%
|
| + // representations, and later (in OnImageLoaded), pulling them out and
|
| + // individually inserting them into an IconFamily.
|
| std::vector<extensions::ImageLoader::ImageRepresentation> info_list;
|
| for (size_t i = 0; i < arraysize(kDesiredSizes); ++i) {
|
| int size = kDesiredSizes[i];
|
|
|