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

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

Issue 2675803004: Fall back to shortcut A2HS when Phonesky is out of date or unavailable. (Closed)
Patch Set: Rebase. Created 3 years, 10 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 #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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 417
418 GURL signed_download_url(response->signed_download_url()); 418 GURL signed_download_url(response->signed_download_url());
419 if (!signed_download_url.is_valid() || response->package_name().empty()) { 419 if (!signed_download_url.is_valid() || response->package_name().empty()) {
420 OnFailure(); 420 OnFailure();
421 return; 421 return;
422 } 422 }
423 423
424 if (CanUseGooglePlayInstallService()) { 424 if (CanUseGooglePlayInstallService()) {
425 int version = 1; 425 int version = 1;
426 base::StringToInt(response->version(), &version); 426 base::StringToInt(response->version(), &version);
427 if (!InstallOrUpdateWebApkFromGooglePlay(response->package_name(), version, 427 // TODO(hanxi): crbug.com/688759. Remove the return value of
428 response->token())) { 428 // InstallOrUpdateWebApkFromGooglePlay(), since a callback will be called
429 OnFailure(); 429 // asynchronously after the install or upidate has either failed or
430 } 430 // completed.
431 InstallOrUpdateWebApkFromGooglePlay(response->package_name(), version,
432 response->token());
431 return; 433 return;
432 } 434 }
433 435
434 OnGotWebApkDownloadUrl(signed_download_url, response->package_name()); 436 OnGotWebApkDownloadUrl(signed_download_url, response->package_name());
435 } 437 }
436 438
437 void WebApkInstaller::DownloadAppIconAndComputeMurmur2Hash() { 439 void WebApkInstaller::DownloadAppIconAndComputeMurmur2Hash() {
438 // Safeguard. WebApkIconHasher crashes if asked to fetch an invalid URL. 440 // Safeguard. WebApkIconHasher crashes if asked to fetch an invalid URL.
439 if (!shortcut_info_.best_primary_icon_url.is_valid()) { 441 if (!shortcut_info_.best_primary_icon_url.is_valid()) {
440 OnFailure(); 442 OnFailure();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 619
618 void WebApkInstaller::OnSuccess() { 620 void WebApkInstaller::OnSuccess() {
619 finish_callback_.Run(true, webapk_package_); 621 finish_callback_.Run(true, webapk_package_);
620 delete this; 622 delete this;
621 } 623 }
622 624
623 void WebApkInstaller::OnFailure() { 625 void WebApkInstaller::OnFailure() {
624 finish_callback_.Run(false, webapk_package_); 626 finish_callback_.Run(false, webapk_package_);
625 delete this; 627 delete this;
626 } 628 }
OLDNEW
« no previous file with comments | « chrome/browser/android/webapk/chrome_webapk_host.cc ('k') | chrome/browser/android/webapps/add_to_homescreen_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698