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

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
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper.h ('k') | chrome/common/extensions/api/_api_features.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, };
« no previous file with comments | « chrome/browser/extensions/bookmark_app_helper.h ('k') | chrome/common/extensions/api/_api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698