Index: chrome/browser/extensions/bookmark_app_helper.cc |
=================================================================== |
--- chrome/browser/extensions/bookmark_app_helper.cc (revision 274309) |
+++ chrome/browser/extensions/bookmark_app_helper.cc (working copy) |
@@ -183,6 +183,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 = |
@@ -204,7 +207,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( |
@@ -239,6 +246,18 @@ |
} |
} |
+ // Add all existing icons from WebApplicationInfo. |
+ for (std::vector<WebApplicationInfo::IconInfo>::const_iterator it = |
+ web_app_info_.icons.begin(); |
+ it != web_app_info_.icons.end(); |
+ ++it) { |
+ const SkBitmap& icon = it->data; |
+ if (!icon.drawsNothing() && icon.width() == icon.height()) |
+ downloaded_icons.push_back(icon); |
+ } |
+ |
+ web_app_info_.icons.clear(); |
+ |
// If there are icons that don't match the accepted icon sizes, find the |
// closest bigger icon to the accepted sizes and resize the icon to it. An |
// icon will be resized and used for at most one size. |