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

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

Issue 2528073002: Add a flag in WebAPK's proto when the Web App Manifest is no longer available. (Closed)
Patch Set: Created 4 years 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.proto ('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_installer.h" 5 #include "chrome/browser/android/webapk/webapk_installer.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/path_utils.h" 10 #include "base/android/path_utils.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const std::string& shortcut_icon_murmur2_hash) { 115 const std::string& shortcut_icon_murmur2_hash) {
116 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 116 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
117 117
118 std::unique_ptr<webapk::WebApk> webapk(new webapk::WebApk); 118 std::unique_ptr<webapk::WebApk> webapk(new webapk::WebApk);
119 webapk->set_manifest_url(shortcut_info.manifest_url.spec()); 119 webapk->set_manifest_url(shortcut_info.manifest_url.spec());
120 webapk->set_requester_application_package( 120 webapk->set_requester_application_package(
121 base::android::BuildInfo::GetInstance()->package_name()); 121 base::android::BuildInfo::GetInstance()->package_name());
122 webapk->set_requester_application_version(version_info::GetVersionNumber()); 122 webapk->set_requester_application_version(version_info::GetVersionNumber());
123 webapk->set_android_abi(getCurrentAbi()); 123 webapk->set_android_abi(getCurrentAbi());
124 124
125 // TODO(hanxi): crbug.com/665078. Add a flag in WebAPK's proto to indicate 125 if (shortcut_icon_murmur2_hash.empty()) {
126 // that the Web Manifest data in the proto might be stale. 126 webapk->set_stale_manifest(true);
127 if (shortcut_icon_murmur2_hash.empty())
128 return webapk; 127 return webapk;
pkotwicz 2016/11/24 22:39:26 For the sake of simplicity, can we not do the retu
Xi Han 2016/11/28 16:34:33 We don't have the best_icon_url, so we can't reall
pkotwicz 2016/11/28 21:29:07 I agree that sending more data is not useful. Howe
Xi Han 2016/12/05 21:18:27 Done.
128 }
129 129
130 webapk::WebAppManifest* web_app_manifest = webapk->mutable_manifest(); 130 webapk::WebAppManifest* web_app_manifest = webapk->mutable_manifest();
131 web_app_manifest->set_name(base::UTF16ToUTF8(shortcut_info.name)); 131 web_app_manifest->set_name(base::UTF16ToUTF8(shortcut_info.name));
132 web_app_manifest->set_short_name( 132 web_app_manifest->set_short_name(
133 base::UTF16ToUTF8(shortcut_info.short_name)); 133 base::UTF16ToUTF8(shortcut_info.short_name));
134 web_app_manifest->set_start_url(shortcut_info.url.spec()); 134 web_app_manifest->set_start_url(shortcut_info.url.spec());
135 web_app_manifest->set_orientation( 135 web_app_manifest->set_orientation(
136 content::WebScreenOrientationLockTypeToString( 136 content::WebScreenOrientationLockTypeToString(
137 shortcut_info.orientation)); 137 shortcut_info.orientation));
138 web_app_manifest->set_display_mode( 138 web_app_manifest->set_display_mode(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // 248 //
249 // We redownload the icon in order to take the Murmur2 hash. The redownload 249 // We redownload the icon in order to take the Murmur2 hash. The redownload
250 // should be fast because the icon should be in the HTTP cache. 250 // should be fast because the icon should be in the HTTP cache.
251 DownloadAppIconAndComputeMurmur2Hash(); 251 DownloadAppIconAndComputeMurmur2Hash();
252 } 252 }
253 253
254 void WebApkInstaller::UpdateAsync(content::BrowserContext* browser_context, 254 void WebApkInstaller::UpdateAsync(content::BrowserContext* browser_context,
255 const FinishCallback& finish_callback, 255 const FinishCallback& finish_callback,
256 const std::string& icon_murmur2_hash, 256 const std::string& icon_murmur2_hash,
257 const std::string& webapk_package, 257 const std::string& webapk_package,
258 int webapk_version) { 258 int webapk_version) {
pkotwicz 2016/11/24 22:39:26 Can we pass whether the manifest is stale from Jav
Xi Han 2016/11/28 16:34:33 Done.
259 UpdateAsyncWithURLRequestContextGetter( 259 UpdateAsyncWithURLRequestContextGetter(
260 Profile::FromBrowserContext(browser_context)->GetRequestContext(), 260 Profile::FromBrowserContext(browser_context)->GetRequestContext(),
261 finish_callback, icon_murmur2_hash, webapk_package, webapk_version); 261 finish_callback, icon_murmur2_hash, webapk_package, webapk_version);
262 } 262 }
263 263
264 void WebApkInstaller::UpdateAsyncWithURLRequestContextGetter( 264 void WebApkInstaller::UpdateAsyncWithURLRequestContextGetter(
265 net::URLRequestContextGetter* request_context_getter, 265 net::URLRequestContextGetter* request_context_getter,
266 const FinishCallback& finish_callback, 266 const FinishCallback& finish_callback,
267 const std::string& icon_murmur2_hash, 267 const std::string& icon_murmur2_hash,
268 const std::string& webapk_package, 268 const std::string& webapk_package,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 517
518 void WebApkInstaller::OnSuccess() { 518 void WebApkInstaller::OnSuccess() {
519 finish_callback_.Run(true, webapk_package_); 519 finish_callback_.Run(true, webapk_package_);
520 delete this; 520 delete this;
521 } 521 }
522 522
523 void WebApkInstaller::OnFailure() { 523 void WebApkInstaller::OnFailure() {
524 finish_callback_.Run(false, webapk_package_); 524 finish_callback_.Run(false, webapk_package_);
525 delete this; 525 delete this;
526 } 526 }
OLDNEW
« no previous file with comments | « chrome/browser/android/webapk/webapk.proto ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698