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

Unified Diff: content/browser/service_worker/service_worker_version.h

Issue 2451373003: service worker: Implement NavigationPreloadManager.setHeaderValue (Closed)
Patch Set: rebase Created 4 years, 1 month 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: content/browser/service_worker/service_worker_version.h
diff --git a/content/browser/service_worker/service_worker_version.h b/content/browser/service_worker/service_worker_version.h
index b77d042b4f68fcd16e6304116eea0155920725d0..d628e08c56d71039d8dc428937dad6a403e6a581 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -170,17 +170,16 @@ class CONTENT_EXPORT ServiceWorkerVersion
foreign_fetch_origins_ = origins;
}
- // Only meaningful if this version is active.
- bool navigation_preload_enabled() const {
+ // Meaningful only if this version is active.
+ const NavigationPreloadState& navigation_preload_state() const {
DCHECK(status_ == ACTIVATING || status_ == ACTIVATED) << status_;
- return navigation_preload_enabled_;
+ return navigation_preload_state_;
}
// Only intended for use by ServiceWorkerRegistration. Generally use
- // ServiceWorkerRegistration::EnableNavigationPreload instead of this
+ // ServiceWorkerRegistration::EnableNavigationPreload or
+ // ServiceWorkerRegistration::SetNavigationPreloadHeader instead of this
// function.
- void set_navigation_preload_enabled(bool enabled) {
- navigation_preload_enabled_ = enabled;
- }
+ void SetNavigationPreloadState(const NavigationPreloadState& state);
ServiceWorkerMetrics::Site site_for_uma() const { return site_for_uma_; }
@@ -736,10 +735,10 @@ class CONTENT_EXPORT ServiceWorkerVersion
std::vector<url::Origin> foreign_fetch_origins_;
FetchHandlerExistence fetch_handler_existence_;
// The source of truth for navigation preload state is the
- // ServiceWorkerRegistration. |navigation_preload_enabled_| is essentially a
- // cache for the state because it must be looked up quickly and a live
- // registration doesn't necessarily exist whenever there is a live version.
- bool navigation_preload_enabled_ = false;
+ // ServiceWorkerRegistration. |navigation_preload_state_| is essentially a
+ // cached value because it must be looked up quickly and a live registration
+ // doesn't necessarily exist whenever there is a live version.
+ NavigationPreloadState navigation_preload_state_;
ServiceWorkerMetrics::Site site_for_uma_;
Status status_ = NEW;

Powered by Google App Engine
This is Rietveld 408576698