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

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

Issue 2782313002: Add static method WebApkIconHasher::DownloadAndComputeMurmur2Hash (Closed)
Patch Set: Add static method WebApkIconHasher::DownloadAndComputeMurmur2Hash Created 3 years, 9 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 | « no previous file | chrome/browser/android/webapk/webapk_icon_hasher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/webapk/webapk_icon_hasher.h
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher.h b/chrome/browser/android/webapk/webapk_icon_hasher.h
index 4a337106990f5d977c70017b18143d053a1906c2..9e8a242a4d51f354b28b96ccc1fb8ab2af0c20f6 100644
--- a/chrome/browser/android/webapk/webapk_icon_hasher.h
+++ b/chrome/browser/android/webapk/webapk_icon_hasher.h
@@ -25,11 +25,23 @@ class WebApkIconHasher : public net::URLFetcherDelegate {
using Murmur2HashCallback =
base::Callback<void(const std::string& /* icon_murmur2_hash */)>;
+ ~WebApkIconHasher() override;
dominickn 2017/03/29 23:27:00 Can this be declared private? Or is it called by t
F 2017/03/30 00:20:13 Done. This can be declared private.
+
+ // Creates a self-owned WebApkIconHasher instance. The instance downloads
+ // |icon_url| and calls |callback| with the Murmur2 hash of the downloaded
+ // image. The hash is taken over the raw image bytes (no image
+ // encoding/decoding beforehand). |callback| is called with an empty string if
+ // the image cannot not be downloaded in time (e.g. 404 HTTP error code).
+ static void DownloadAndComputeMurmur2Hash(
+ net::URLRequestContextGetter* request_context_getter,
+ const GURL& icon_url,
+ const Murmur2HashCallback& callback);
+
+ private:
WebApkIconHasher(
net::URLRequestContextGetter* request_context_getter,
const GURL& icon_url,
const Murmur2HashCallback& callback);
- ~WebApkIconHasher() override;
// Downloads |icon_url_|. Calls |callback_| with the Murmur2 hash of the
// downloaded image. The hash is taken over the raw image bytes (no image
@@ -37,7 +49,6 @@ class WebApkIconHasher : public net::URLFetcherDelegate {
// if the image cannot not be downloaded in time (e.g. 404 HTTP error code).
void DownloadAndComputeMurmur2Hash();
dominickn 2017/03/29 23:27:00 You could remove this method and do all of its wor
F 2017/03/30 00:20:13 After experimenting with it, I think maybe we shou
dominickn 2017/03/30 00:26:46 That's a good point. You could get around it by mo
pkotwicz 2017/03/30 14:47:25 In my opinion, we should try to avoid having const
F 2017/03/30 15:52:46 For now I kept the current code structure and adde
- private:
// net::URLFetcherDelegate:
void OnURLFetchComplete(const net::URLFetcher* source) override;
« no previous file with comments | « no previous file | chrome/browser/android/webapk/webapk_icon_hasher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698