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

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

Issue 2231843003: Take Murmur2 hash of untransformed icon when creating WebAPK part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl2_hash Created 4 years, 4 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.h
diff --git a/chrome/browser/android/webapk/webapk_installer.h b/chrome/browser/android/webapk/webapk_installer.h
index 6b8f3633298dc6322404b1541e7635fdc46cab38..1eb591ea2370aa04e93759d936e07c490d48290a 100644
--- a/chrome/browser/android/webapk/webapk_installer.h
+++ b/chrome/browser/android/webapk/webapk_installer.h
@@ -35,6 +35,8 @@ namespace webapk {
class WebApk;
}
+class WebApkIconHasher;
+
// Talks to Chrome WebAPK server and Google Play to generate a WebAPK on the
// server, download it, and install it.
class WebApkInstaller : public net::URLFetcherDelegate {
@@ -73,6 +75,12 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;
+ // Downloads app icon in order to compute Murmur2 hash.
+ void DownloadAppIconAndComputeMurmur2Hash();
+
+ // Called with the computed Murmur2 hash for the app icon.
+ void OnGotIconMurmur2Hash(const std::string& icon_murmur2_hash);
+
// Sends request to WebAPK server to create WebAPK. During a successful
// request the WebAPK server responds with the URL of the generated WebAPK.
// |webapk| is the proto to send to the WebAPK server.
@@ -101,10 +109,6 @@ class WebApkInstaller : public net::URLFetcherDelegate {
const std::string& package_name,
bool change_permission_success);
- // Populates webapk::WebApk and returns it.
- // Must be called on a worker thread because it encodes an SkBitmap.
- std::unique_ptr<webapk::WebApk> BuildWebApkProtoInBackground();
-
// Called when the request to the WebAPK server times out or when the WebAPK
// download times out.
void OnTimeout();
@@ -123,6 +127,9 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// Sends HTTP request to WebAPK server.
std::unique_ptr<net::URLFetcher> url_fetcher_;
+ // Downloads app icon and computes Murmur2 hash.
+ std::unique_ptr<WebApkIconHasher> icon_hasher_;
+
// Downloads WebAPK.
std::unique_ptr<FileDownloader> downloader_;
@@ -139,6 +146,10 @@ class WebApkInstaller : public net::URLFetcherDelegate {
// WebAPK app icon.
const SkBitmap shortcut_icon_;
+ // Murmur2 hash of the bitmap at the app icon URL prior to any transformations
+ // being applied to the bitmap (such as encoding/decoding the icon bitmap).
+ std::string shortcut_icon_murmur2_hash_;
+
// WebAPK server URL.
GURL server_url_;

Powered by Google App Engine
This is Rietveld 408576698