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

Side by Side Diff: chrome/browser/android/webapk/webapk_installer.h

Issue 2782313002: Add static method WebApkIconHasher::DownloadAndComputeMurmur2Hash (Closed)
Patch Set: Delete non-static download method` 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
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 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_
6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ 6 #define CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 namespace content { 28 namespace content {
29 class BrowserContext; 29 class BrowserContext;
30 } 30 }
31 31
32 namespace webapk { 32 namespace webapk {
33 class WebApk; 33 class WebApk;
34 } 34 }
35 35
36 class WebApkIconHasher;
37
38 // Talks to Chrome WebAPK server and Google Play to generate a WebAPK on the 36 // Talks to Chrome WebAPK server and Google Play to generate a WebAPK on the
39 // server, download it, and install it. The native WebApkInstaller owns the 37 // server, download it, and install it. The native WebApkInstaller owns the
40 // Java WebApkInstaller counterpart. 38 // Java WebApkInstaller counterpart.
41 class WebApkInstaller : public net::URLFetcherDelegate { 39 class WebApkInstaller : public net::URLFetcherDelegate {
42 public: 40 public:
43 using FinishCallback = WebApkInstallService::FinishCallback; 41 using FinishCallback = WebApkInstallService::FinishCallback;
44 42
45 ~WebApkInstaller() override; 43 ~WebApkInstaller() override;
46 44
47 // Creates a self-owned WebApkInstaller instance and talks to the Chrome 45 // Creates a self-owned WebApkInstaller instance and talks to the Chrome
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 void UpdateAsync( 151 void UpdateAsync(
154 const std::string& webapk_package, 152 const std::string& webapk_package,
155 int webapk_version, 153 int webapk_version,
156 const std::map<std::string, std::string>& icon_url_to_murmur2_hash, 154 const std::map<std::string, std::string>& icon_url_to_murmur2_hash,
157 bool is_manifest_stale, 155 bool is_manifest_stale,
158 const FinishCallback& callback); 156 const FinishCallback& callback);
159 157
160 // net::URLFetcherDelegate: 158 // net::URLFetcherDelegate:
161 void OnURLFetchComplete(const net::URLFetcher* source) override; 159 void OnURLFetchComplete(const net::URLFetcher* source) override;
162 160
163 // Downloads app icon in order to compute Murmur2 hash.
164 void DownloadAppIconAndComputeMurmur2Hash();
165
166 // Called with the computed Murmur2 hash for the app icon. 161 // Called with the computed Murmur2 hash for the app icon.
167 void OnGotIconMurmur2Hash(const std::string& icon_murmur2_hash); 162 void OnGotIconMurmur2Hash(const std::string& icon_murmur2_hash);
168 163
169 // Sends request to WebAPK server to create WebAPK. During a successful 164 // Sends request to WebAPK server to create WebAPK. During a successful
170 // request the WebAPK server responds with the URL of the generated WebAPK. 165 // request the WebAPK server responds with the URL of the generated WebAPK.
171 // |webapk| is the proto to send to the WebAPK server. 166 // |webapk| is the proto to send to the WebAPK server.
172 void SendCreateWebApkRequest(std::unique_ptr<webapk::WebApk> webapk_proto); 167 void SendCreateWebApkRequest(std::unique_ptr<webapk::WebApk> webapk_proto);
173 168
174 // Sends request to WebAPK server to update a WebAPK. During a successful 169 // Sends request to WebAPK server to update a WebAPK. During a successful
175 // request the WebAPK server responds with the URL of the generated WebAPK. 170 // request the WebAPK server responds with the URL of the generated WebAPK.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // |change_permission_success| is whether the WebAPK could be made world 208 // |change_permission_success| is whether the WebAPK could be made world
214 // readable. 209 // readable.
215 void OnWebApkMadeWorldReadable(const base::FilePath& file_path, 210 void OnWebApkMadeWorldReadable(const base::FilePath& file_path,
216 bool change_permission_success); 211 bool change_permission_success);
217 212
218 net::URLRequestContextGetter* request_context_getter_; 213 net::URLRequestContextGetter* request_context_getter_;
219 214
220 // Sends HTTP request to WebAPK server. 215 // Sends HTTP request to WebAPK server.
221 std::unique_ptr<net::URLFetcher> url_fetcher_; 216 std::unique_ptr<net::URLFetcher> url_fetcher_;
222 217
223 // Downloads app icon and computes Murmur2 hash.
224 std::unique_ptr<WebApkIconHasher> icon_hasher_;
225
226 // Downloads WebAPK. 218 // Downloads WebAPK.
227 std::unique_ptr<FileDownloader> downloader_; 219 std::unique_ptr<FileDownloader> downloader_;
228 220
229 // Fails WebApkInstaller if WebAPK server takes too long to respond or if the 221 // Fails WebApkInstaller if WebAPK server takes too long to respond or if the
230 // download takes too long. 222 // download takes too long.
231 base::OneShotTimer timer_; 223 base::OneShotTimer timer_;
232 224
233 // Callback to call once WebApkInstaller succeeds or fails. 225 // Callback to call once WebApkInstaller succeeds or fails.
234 FinishCallback finish_callback_; 226 FinishCallback finish_callback_;
235 227
(...skipping 28 matching lines...) Expand all
264 // Points to the Java Object. 256 // Points to the Java Object.
265 base::android::ScopedJavaGlobalRef<jobject> java_ref_; 257 base::android::ScopedJavaGlobalRef<jobject> java_ref_;
266 258
267 // Used to get |weak_ptr_|. 259 // Used to get |weak_ptr_|.
268 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_; 260 base::WeakPtrFactory<WebApkInstaller> weak_ptr_factory_;
269 261
270 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller); 262 DISALLOW_COPY_AND_ASSIGN(WebApkInstaller);
271 }; 263 };
272 264
273 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_ 265 #endif // CHROME_BROWSER_ANDROID_WEBAPK_WEBAPK_INSTALLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc ('k') | chrome/browser/android/webapk/webapk_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698