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

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

Issue 2632243004: Don't download identical APKs on update. (Closed)
Patch Set: Created 3 years, 11 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 source->GetResponseAsString(&response_string); 411 source->GetResponseAsString(&response_string);
412 412
413 std::unique_ptr<webapk::WebApkResponse> response( 413 std::unique_ptr<webapk::WebApkResponse> response(
414 new webapk::WebApkResponse); 414 new webapk::WebApkResponse);
415 if (!response->ParseFromString(response_string)) { 415 if (!response->ParseFromString(response_string)) {
416 OnFailure(); 416 OnFailure();
417 return; 417 return;
418 } 418 }
419 419
420 GURL signed_download_url(response->signed_download_url()); 420 GURL signed_download_url(response->signed_download_url());
421 // https://crbug.com/680131. Don't download identical APKs on update.
pkotwicz 2017/01/17 02:37:10 How about: "The server sends an empty URL if the s
Xi Han 2017/01/17 16:45:12 Done.
422 if (task_type_ == UPDATE && signed_download_url.is_empty()) {
423 OnSuccess();
424 return;
425 }
426
421 if (!signed_download_url.is_valid() || response->package_name().empty()) { 427 if (!signed_download_url.is_valid() || response->package_name().empty()) {
422 OnFailure(); 428 OnFailure();
423 return; 429 return;
424 } 430 }
425 431
426 if (HasGooglePlayWebApkInstallDelegate()) { 432 if (HasGooglePlayWebApkInstallDelegate()) {
427 int version = 1; 433 int version = 1;
428 base::StringToInt(response->version(), &version); 434 base::StringToInt(response->version(), &version);
429 if (!InstallOrUpdateWebApkFromGooglePlay( 435 if (!InstallOrUpdateWebApkFromGooglePlay(
430 response->package_name(), version, response->token())) { 436 response->package_name(), version, response->token())) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 621
616 void WebApkInstaller::OnSuccess() { 622 void WebApkInstaller::OnSuccess() {
617 finish_callback_.Run(true, webapk_package_); 623 finish_callback_.Run(true, webapk_package_);
618 delete this; 624 delete this;
619 } 625 }
620 626
621 void WebApkInstaller::OnFailure() { 627 void WebApkInstaller::OnFailure() {
622 finish_callback_.Run(false, webapk_package_); 628 finish_callback_.Run(false, webapk_package_);
623 delete this; 629 delete this;
624 } 630 }
OLDNEW
« no previous file with comments | « chrome/browser/android/webapk/webapk.proto ('k') | chrome/browser/android/webapk/webapk_installer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698