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

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

Issue 2751343002: Adds a basic offline check to InstallableManager. (Closed)
Patch Set: Rebase 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 4c4b34378e71134b176198178de891968474a2cb..b0bf4496513b77bdd42977cfe2e53435a498d2dc 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;
« no previous file with comments | « chrome/browser/installable/installable_manager.h ('k') | chrome/browser/installable/installable_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698