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

Unified Diff: chrome/browser/installable/installable_manager.cc

Issue 2751343002: Adds a basic offline check to InstallableManager. (Closed)
Patch Set: Updating comments 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/installable/installable_manager.cc
diff --git a/chrome/browser/installable/installable_manager.cc b/chrome/browser/installable/installable_manager.cc
index a4990888722e0e1366dcdd520e21f0d47b68ed2d..d57b8e755ed6a2c34e808494a0b97eb926d02120 100644
--- a/chrome/browser/installable/installable_manager.cc
+++ b/chrome/browser/installable/installable_manager.cc
@@ -412,15 +412,23 @@ void InstallableManager::CheckServiceWorker() {
weak_factory_.GetWeakPtr()));
}
-void InstallableManager::OnDidCheckHasServiceWorker(bool has_service_worker) {
+void InstallableManager::OnDidCheckHasServiceWorker(
+ content::ServiceWorkerCapability capability) {
if (!GetWebContents())
return;
- if (has_service_worker) {
- installable_->installable = true;
- } else {
- installable_->installable = false;
- installable_->error = NO_MATCHING_SERVICE_WORKER;
+ switch (capability) {
+ case content::ServiceWorkerCapability::SERVICE_WORKER_WITH_FETCH_HANDLER:
+ installable_->installable = true;
+ break;
+ case content::ServiceWorkerCapability::SERVICE_WORKER_NO_FETCH_HANDLER:
+ installable_->installable = false;
+ installable_->error = NOT_OFFLINE_CAPABLE;
+ break;
+ case content::ServiceWorkerCapability::NO_SERVICE_WORKER:
+ installable_->installable = false;
+ installable_->error = NO_MATCHING_SERVICE_WORKER;
+ break;
}
installable_->fetched = true;

Powered by Google App Engine
This is Rietveld 408576698