Chromium Code Reviews| 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 0e368ab3c619bd97a8834f44dbbe84ff16382f78..7c64af1e3111eeacc533086890c41ecd4563f256 100644 |
| --- a/content/browser/service_worker/service_worker_version.h |
| +++ b/content/browser/service_worker/service_worker_version.h |
| @@ -90,6 +90,13 @@ class CONTENT_EXPORT ServiceWorkerVersion |
| // timed out. |
| }; |
| + // Whether the version has fetch handlers or not. |
| + enum class FetchHandlerStatus { |
| + UNKNOWN, // This version is a new version and not installed yet. |
| + EXISTS, |
| + DOES_NOT_EXIST, |
| + }; |
| + |
| class Listener { |
| public: |
| virtual void OnRunningStateChanged(ServiceWorkerVersion* version) {} |
| @@ -134,9 +141,17 @@ class CONTENT_EXPORT ServiceWorkerVersion |
| } |
| ServiceWorkerVersionInfo GetInfo(); |
| Status status() const { return status_; } |
| - bool has_fetch_handler() const { return has_fetch_handler_; } |
| - void set_has_fetch_handler(bool has_fetch_handler) { |
| - has_fetch_handler_ = has_fetch_handler; |
| + |
| + // This status is set to EXISTS or DOES_NOT_EXIST when the install event has |
| + // been executed in a new version or when an installed version is loaded from |
| + // the storage. When a new version is not installed yet, it is UNKNOW. |
| + FetchHandlerStatus fetch_handler_status() const { |
|
shimazu
2016/08/19 02:14:36
I think Status is a bit ambiguous...
How about Exi
horo
2016/08/19 08:48:04
Done.
|
| + return fetch_handler_status_; |
| + } |
| + void set_fetch_handler_status(FetchHandlerStatus status) { |
| + DCHECK_EQ(fetch_handler_status_, FetchHandlerStatus::UNKNOWN); |
| + DCHECK_NE(status, FetchHandlerStatus::UNKNOWN); |
| + fetch_handler_status_ = status; |
| } |
| const std::vector<GURL>& foreign_fetch_scopes() const { |
| @@ -663,7 +678,7 @@ class CONTENT_EXPORT ServiceWorkerVersion |
| const GURL scope_; |
| std::vector<GURL> foreign_fetch_scopes_; |
| std::vector<url::Origin> foreign_fetch_origins_; |
| - bool has_fetch_handler_ = true; |
| + FetchHandlerStatus fetch_handler_status_; |
| Status status_ = NEW; |
| std::unique_ptr<EmbeddedWorkerInstance> embedded_worker_; |