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

Side by Side Diff: chrome/browser/android/webapk/webapk_update_data_fetcher.cc

Issue 2771793003: Move timeout timer into WebApkIconHasher (Closed)
Patch Set: Remove weakptr and use unretained Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/android/webapk/webapk_installer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/android/webapk/webapk_update_data_fetcher.h" 5 #include "chrome/browser/android/webapk/webapk_update_data_fetcher.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 !AreWebManifestUrlsWebApkCompatible(data.manifest)) { 145 !AreWebManifestUrlsWebApkCompatible(data.manifest)) {
146 OnWebManifestNotWebApkCompatible(); 146 OnWebManifestNotWebApkCompatible();
147 return; 147 return;
148 } 148 }
149 149
150 info_.UpdateFromManifest(data.manifest); 150 info_.UpdateFromManifest(data.manifest);
151 info_.manifest_url = data.manifest_url; 151 info_.manifest_url = data.manifest_url;
152 info_.best_primary_icon_url = data.primary_icon_url; 152 info_.best_primary_icon_url = data.primary_icon_url;
153 best_primary_icon_ = *data.primary_icon; 153 best_primary_icon_ = *data.primary_icon;
154 154
155 icon_hasher_.reset(new WebApkIconHasher());
156 Profile* profile = 155 Profile* profile =
157 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 156 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
158 icon_hasher_->DownloadAndComputeMurmur2Hash( 157
158 icon_hasher_.reset(new WebApkIconHasher(
159 profile->GetRequestContext(), data.primary_icon_url, 159 profile->GetRequestContext(), data.primary_icon_url,
160 base::Bind(&WebApkUpdateDataFetcher::OnGotIconMurmur2Hash, 160 base::Bind(&WebApkUpdateDataFetcher::OnGotIconMurmur2Hash,
161 weak_ptr_factory_.GetWeakPtr())); 161 weak_ptr_factory_.GetWeakPtr())));
162 icon_hasher_->DownloadAndComputeMurmur2Hash();
162 } 163 }
163 164
164 void WebApkUpdateDataFetcher::OnGotIconMurmur2Hash( 165 void WebApkUpdateDataFetcher::OnGotIconMurmur2Hash(
165 const std::string& best_primary_icon_murmur2_hash) { 166 const std::string& best_primary_icon_murmur2_hash) {
166 icon_hasher_.reset(); 167 icon_hasher_.reset();
167 168
168 if (best_primary_icon_murmur2_hash.empty()) { 169 if (best_primary_icon_murmur2_hash.empty()) {
169 OnWebManifestNotWebApkCompatible(); 170 OnWebManifestNotWebApkCompatible();
170 return; 171 return;
171 } 172 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 info.theme_color, info.background_color); 207 info.theme_color, info.background_color);
207 } 208 }
208 209
209 void WebApkUpdateDataFetcher::OnWebManifestNotWebApkCompatible() { 210 void WebApkUpdateDataFetcher::OnWebManifestNotWebApkCompatible() {
210 if (!is_initial_fetch_) 211 if (!is_initial_fetch_)
211 return; 212 return;
212 213
213 Java_WebApkUpdateDataFetcher_onWebManifestForInitialUrlNotWebApkCompatible( 214 Java_WebApkUpdateDataFetcher_onWebManifestForInitialUrlNotWebApkCompatible(
214 base::android::AttachCurrentThread(), java_ref_); 215 base::android::AttachCurrentThread(), java_ref_);
215 } 216 }
OLDNEW
« no previous file with comments | « chrome/browser/android/webapk/webapk_installer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698