Chromium Code Reviews| Index: chrome/browser/extensions/bookmark_app_helper.cc |
| =================================================================== |
| --- chrome/browser/extensions/bookmark_app_helper.cc (revision 271412) |
| +++ chrome/browser/extensions/bookmark_app_helper.cc (working copy) |
| @@ -182,6 +182,9 @@ |
| crx_installer_->set_error_on_unsupported_requirements(true); |
| + if (!contents) |
| + return; |
| + |
| // Add urls from the WebApplicationInfo. |
| std::vector<GURL> web_app_info_icon_urls; |
| for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it = |
| @@ -203,7 +206,11 @@ |
| void BookmarkAppHelper::Create(const CreateBookmarkAppCallback& callback) { |
| callback_ = callback; |
| - favicon_downloader_->Start(); |
| + |
| + if (favicon_downloader_.get()) |
| + favicon_downloader_->Start(); |
| + else |
| + OnIconsDownloaded(true, std::map<GURL, std::vector<SkBitmap> >()); |
| } |
| void BookmarkAppHelper::OnIconsDownloaded( |
| @@ -244,6 +251,15 @@ |
| std::map<int, SkBitmap> resized_bitmaps( |
| ConstrainBitmapsToSizes(downloaded_icons, allowed_sizes)); |
| + // Add the existing icon from WebApplicationInfo if there is no resized icon. |
| + if (resized_bitmaps.empty() && |
| + web_app_info_.icons.size() && |
| + !web_app_info_.icons[0].data.drawsNothing()) { |
| + SkBitmap* icon = &web_app_info_.icons[0].data; |
|
calamity
2014/05/27 05:32:12
Just use a const SkBitmap& here.
wjywbs
2014/05/27 06:22:32
Done.
|
| + DCHECK_EQ(icon->width(), icon->height()); |
| + resized_bitmaps[icon->width()] = *icon; |
| + } |
| + |
|
calamity
2014/05/27 05:32:12
It seems a little messy to just take the first ico
wjywbs
2014/05/27 06:22:32
Done, but can we clear the web_app_info_.icons? It
calamity
2014/05/27 07:18:48
Clearing the icons should be fine.
The icon URL i
wjywbs
2014/05/27 22:20:21
I added "web_app_info_.icons.clear();".
|
| // Generate container icons from smaller icons. |
| const int kIconSizesToGenerate[] = {extension_misc::EXTENSION_ICON_SMALL, |
| extension_misc::EXTENSION_ICON_MEDIUM, }; |