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

Unified Diff: chrome/browser/android/webapk/webapk_installer.cc

Issue 2453423002: Send all of the icon URLs listed in Web Manifest to WebAPK Server. (Closed)
Patch Set: Created 4 years, 2 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/android/webapk/webapk_installer.cc
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc
index 175969f0a1107d157216b653ba12912cd702968c..77fa94d841fe744396af1a3d65be36187d6b7079 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -117,12 +117,19 @@ std::unique_ptr<webapk::WebApk> BuildWebApkProtoInBackground(
std::string* scope = web_app_manifest->add_scopes();
scope->assign(GetScope(shortcut_info).spec());
webapk::Image* image = web_app_manifest->add_icons();
pkotwicz 2016/11/01 00:29:50 Nit: Rename |image| -> |best_image|
Xi Han 2016/11/07 16:51:43 Done.
- image->set_src(shortcut_info.icon_url.spec());
+ image->set_src(shortcut_info.best_icon_url.spec());
image->set_hash(shortcut_icon_murmur2_hash);
std::vector<unsigned char> png_bytes;
gfx::PNGCodec::EncodeBGRASkBitmap(shortcut_icon, false, &png_bytes);
image->set_image_data(&png_bytes.front(), png_bytes.size());
+ for (const auto& icon_url : shortcut_info.icon_urls) {
pkotwicz 2016/11/01 00:29:50 Nit: "const auto& icon_url" -> "const GURL& icon_u
Xi Han 2016/11/07 16:51:43 Done.
+ if (icon_url == shortcut_info.best_icon_url)
+ continue;
+ webapk::Image* image = web_app_manifest->add_icons();
+ image->set_src(icon_url.spec());
+ }
pkotwicz 2016/11/01 00:29:49 Can you check with Glenn whether reordering is ok?
Xi Han 2016/11/07 16:51:43 I talked to Glenn and he prefers to have the best
+
return webapk;
}
@@ -311,7 +318,7 @@ void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) {
void WebApkInstaller::DownloadAppIconAndComputeMurmur2Hash() {
// Safeguard. WebApkIconHasher crashes if asked to fetch an invalid URL.
- if (!shortcut_info_.icon_url.is_valid()) {
+ if (!shortcut_info_.best_icon_url.is_valid()) {
OnFailure();
return;
}
@@ -322,7 +329,7 @@ void WebApkInstaller::DownloadAppIconAndComputeMurmur2Hash() {
icon_hasher_.reset(new WebApkIconHasher());
icon_hasher_->DownloadAndComputeMurmur2Hash(
- request_context_getter_, shortcut_info_.icon_url,
+ request_context_getter_, shortcut_info_.best_icon_url,
base::Bind(&WebApkInstaller::OnGotIconMurmur2Hash,
weak_ptr_factory_.GetWeakPtr()));
}

Powered by Google App Engine
This is Rietveld 408576698