Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4905)

Unified Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 266353006: Add generateAppForLink function in chrome.management (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698