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

Unified Diff: chrome/browser/android/webapk/webapk_installer.cc

Issue 2641973003: Implement server-suggested update check backoff (Closed)
Patch Set: Nits. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/webapk/webapk_installer.cc
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc
index de4e576dae33990cf76bf511467669cda4699df6..90ea2332001c96152df55b3422b0c0d2429f991d 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -57,6 +57,7 @@ const int kDownloadTimeoutMs = 60000;
const int kWorldReadableFilePermission = base::FILE_PERMISSION_READ_BY_USER |
base::FILE_PERMISSION_READ_BY_GROUP |
base::FILE_PERMISSION_READ_BY_OTHERS;
+const int kDefaultWebApkVersion = 1;
// Returns the WebAPK server URL based on the command line.
GURL GetServerUrl() {
@@ -349,6 +350,8 @@ WebApkInstaller::WebApkInstaller(content::BrowserContext* browser_context,
server_url_(GetServerUrl()),
webapk_download_url_timeout_ms_(kWebApkDownloadUrlTimeoutMs),
download_timeout_ms_(kDownloadTimeoutMs),
+ relax_updates_(false),
+ webapk_version_(kDefaultWebApkVersion),
task_type_(UNDEFINED),
weak_ptr_factory_(this) {
CreateJavaRef();
@@ -416,9 +419,10 @@ void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) {
}
GURL signed_download_url(response->signed_download_url());
- // https://crbug.com/680131. The server sends an empty URL if the server does
- // not have a newer WebAPK to update to.
if (task_type_ == UPDATE && signed_download_url.is_empty()) {
+ // https://crbug.com/680131. The server sends an empty URL if the server
+ // does not have a newer WebAPK to update to.
+ relax_updates_ = response->relax_updates();
OnSuccess();
return;
}
@@ -623,11 +627,11 @@ void WebApkInstaller::OnTimeout() {
}
void WebApkInstaller::OnSuccess() {
- finish_callback_.Run(true, webapk_package_);
+ finish_callback_.Run(true, relax_updates_, webapk_package_);
delete this;
}
void WebApkInstaller::OnFailure() {
- finish_callback_.Run(false, webapk_package_);
+ finish_callback_.Run(false, relax_updates_, webapk_package_);
delete this;
}

Powered by Google App Engine
This is Rietveld 408576698