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

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

Issue 2627023002: Introduce Origin-Trial for Service Worker Navigation Preload (Closed)
Patch Set: add LayoutTests 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 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 57ac26103f94e93dbb8a8c7dc900aa3961bce276..701e08adb06ad5756c52665fca512ca69f38ae92 100644
--- a/content/browser/service_worker/service_worker_version.h
+++ b/content/browser/service_worker/service_worker_version.h
@@ -427,6 +427,36 @@ class CONTENT_EXPORT ServiceWorkerVersion
void NotifyMainScriptJobCreated(
ServiceWorkerContextRequestHandler::CreateJobStatus status);
+ // Returns true if the service worker should support Navigation Preload.
+ // There are three possible states:
+ // - A: Navigation Preload related methods and attributes are available in JS
+ // and work correctly.
+ // - B: Navigation Preload related methods and attributes are available in
+ // JS. But NavigationPreloadManager's enable, disable and setHeaderValue
+ // methods always return a rejected promise. And FetchEvent's
+ // preloadResponse attribute returns a promise which always resolve with
+ // undefined.
+ // - C: Navigation Preload related methods and attributes are not available
+ // in JS.
+ // This method returns true only for A case.
+ // blink::OriginTrials::serviceWorkerNavigationPreloadEnabled() returns true
+ // for both A and B case.
+ //
+ // * Origin Trial: Have an effective header.
+ // Command line
+ // Default Enable Disabled
+ // Default B A B
+ // Field trial Enabled A A B
+ // Disabled B A B
+ //
+ // * Origin Trial: No header.
+ // Command line
+ // Default Enable Disabled
+ // Default C A C
+ // Field trial Enabled C A C
+ // Disabled C A C
falken 2017/01/13 03:43:41 Great comment.
+ bool IsNavigationPreloadSupported() const;
+
private:
friend class base::RefCounted<ServiceWorkerVersion>;
friend class ServiceWorkerMetrics;

Powered by Google App Engine
This is Rietveld 408576698