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

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

Issue 2782313002: Add static method WebApkIconHasher::DownloadAndComputeMurmur2Hash (Closed)
Patch Set: Delete non-static download method` 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
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 2f24da1b1cf7ab5d8d4257f4e10afcbc6eacd6f6..04575686c1edd21dadc41a9a02ee8df08f6646ba 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -380,7 +380,10 @@ void WebApkInstaller::InstallAsync(const FinishCallback& finish_callback) {
//
// We redownload the icon in order to take the Murmur2 hash. The redownload
// should be fast because the icon should be in the HTTP cache.
- DownloadAppIconAndComputeMurmur2Hash();
+ WebApkIconHasher::DownloadAndComputeMurmur2Hash(
+ request_context_getter_, shortcut_info_.best_primary_icon_url,
+ base::Bind(&WebApkInstaller::OnGotIconMurmur2Hash,
+ weak_ptr_factory_.GetWeakPtr()));
}
void WebApkInstaller::UpdateAsync(
@@ -449,18 +452,8 @@ void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) {
OnGotWebApkDownloadUrl(signed_download_url, response->package_name());
}
-void WebApkInstaller::DownloadAppIconAndComputeMurmur2Hash() {
- icon_hasher_.reset(new WebApkIconHasher(
- request_context_getter_, shortcut_info_.best_primary_icon_url,
- base::Bind(&WebApkInstaller::OnGotIconMurmur2Hash,
- weak_ptr_factory_.GetWeakPtr())));
- icon_hasher_->DownloadAndComputeMurmur2Hash();
-}
-
void WebApkInstaller::OnGotIconMurmur2Hash(
const std::string& icon_murmur2_hash) {
- icon_hasher_.reset();
-
// An empty hash indicates that |icon_hasher_| encountered an error.
if (icon_murmur2_hash.empty()) {
OnResult(WebApkInstallResult::FAILURE);
« no previous file with comments | « chrome/browser/android/webapk/webapk_installer.h ('k') | chrome/browser/android/webapk/webapk_update_data_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698