OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 // mojom::ServiceWorkerEventDispatcher, once all simple events got dispatched | 420 // mojom::ServiceWorkerEventDispatcher, once all simple events got dispatched |
421 // through mojo, OnSimpleEventResponse function could be removed. | 421 // through mojo, OnSimpleEventResponse function could be removed. |
422 void OnSimpleEventFinished(int request_id, | 422 void OnSimpleEventFinished(int request_id, |
423 ServiceWorkerStatusCode status, | 423 ServiceWorkerStatusCode status, |
424 base::Time dispatch_event_time); | 424 base::Time dispatch_event_time); |
425 | 425 |
426 void NotifyMainScriptRequestHandlerCreated(); | 426 void NotifyMainScriptRequestHandlerCreated(); |
427 void NotifyMainScriptJobCreated( | 427 void NotifyMainScriptJobCreated( |
428 ServiceWorkerContextRequestHandler::CreateJobStatus status); | 428 ServiceWorkerContextRequestHandler::CreateJobStatus status); |
429 | 429 |
430 // Returns true if the service worker should support Navigation Preload. | |
431 // There are three possible states: | |
432 // - A: Navigation Preload related methods and attributes are available in JS | |
433 // and work correctly. | |
434 // - B: Navigation Preload related methods and attributes are available in | |
435 // JS. But NavigationPreloadManager's enable, disable and setHeaderValue | |
436 // methods always return a rejected promise. And FetchEvent's | |
437 // preloadResponse attribute returns a promise which always resolve with | |
438 // undefined. | |
439 // - C: Navigation Preload related methods and attributes are not available | |
440 // in JS. | |
441 // This method returns true only for A case. | |
442 // blink::OriginTrials::serviceWorkerNavigationPreloadEnabled() returns true | |
443 // for both A and B case. | |
444 // | |
445 // * Origin Trial: Have an effective header. | |
446 // Command line | |
447 // Default Enable Disabled | |
448 // Default B A B | |
449 // Field trial Enabled A A B | |
450 // Disabled B A B | |
451 // | |
452 // * Origin Trial: No header. | |
453 // Command line | |
454 // Default Enable Disabled | |
455 // Default C A C | |
456 // Field trial Enabled C A C | |
457 // Disabled C A C | |
falken
2017/01/13 03:43:41
Great comment.
| |
458 bool IsNavigationPreloadSupported() const; | |
459 | |
430 private: | 460 private: |
431 friend class base::RefCounted<ServiceWorkerVersion>; | 461 friend class base::RefCounted<ServiceWorkerVersion>; |
432 friend class ServiceWorkerMetrics; | 462 friend class ServiceWorkerMetrics; |
433 friend class ServiceWorkerReadFromCacheJobTest; | 463 friend class ServiceWorkerReadFromCacheJobTest; |
434 friend class ServiceWorkerStallInStoppingTest; | 464 friend class ServiceWorkerStallInStoppingTest; |
435 friend class ServiceWorkerURLRequestJobTest; | 465 friend class ServiceWorkerURLRequestJobTest; |
436 friend class ServiceWorkerVersionBrowserTest; | 466 friend class ServiceWorkerVersionBrowserTest; |
437 friend class ServiceWorkerVersionTest; | 467 friend class ServiceWorkerVersionTest; |
438 | 468 |
439 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, | 469 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerControlleeRequestHandlerTest, |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
857 | 887 |
858 // At this point |this| can have been deleted, so don't do anything other | 888 // At this point |this| can have been deleted, so don't do anything other |
859 // than returning. | 889 // than returning. |
860 | 890 |
861 return true; | 891 return true; |
862 } | 892 } |
863 | 893 |
864 } // namespace content | 894 } // namespace content |
865 | 895 |
866 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 896 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |