| Index: content/common/service_worker/service_worker_types.h
|
| diff --git a/content/common/service_worker/service_worker_types.h b/content/common/service_worker/service_worker_types.h
|
| index 8ee5545d50c2c464b6d5891d2b9effaf2cbc4e4d..86324baf8d320fe65ee1b4c820942d1f1bcce1f5 100644
|
| --- a/content/common/service_worker/service_worker_types.h
|
| +++ b/content/common/service_worker/service_worker_types.h
|
| @@ -31,6 +31,15 @@ const static int64 kInvalidServiceWorkerVersionId = -1;
|
| const static int64 kInvalidServiceWorkerResourceId = -1;
|
| const static int64 kInvalidServiceWorkerResponseId = -1;
|
|
|
| +// Indicates how the service worker handled a fetch event.
|
| +enum ServiceWorkerFetchEventResult {
|
| + // Browser should fallback to native fetch.
|
| + SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK,
|
| + // Service worker provided a ServiceWorkerResponse.
|
| + SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE,
|
| + SERVICE_WORKER_FETCH_EVENT_LAST = SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE
|
| +};
|
| +
|
| // To dispatch fetch request from browser to child process.
|
| // TODO(kinuko): This struct will definitely need more fields and
|
| // we'll probably want to have response struct/class too.
|
| @@ -48,15 +57,6 @@ struct CONTENT_EXPORT ServiceWorkerFetchRequest {
|
| bool is_reload;
|
| };
|
|
|
| -// Indicates how the service worker handled a fetch event.
|
| -enum ServiceWorkerFetchEventResult {
|
| - // Browser should fallback to native fetch.
|
| - SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK,
|
| - // Service worker provided a ServiceWorkerResponse.
|
| - SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE,
|
| - SERVICE_WORKER_FETCH_EVENT_LAST = SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE
|
| -};
|
| -
|
| // Represents a response to a fetch.
|
| struct CONTENT_EXPORT ServiceWorkerResponse {
|
| ServiceWorkerResponse();
|
| @@ -81,6 +81,30 @@ struct CONTENT_EXPORT ServiceWorkerObjectInfo {
|
| blink::WebServiceWorkerState state;
|
| };
|
|
|
| +class ChangedVersionAttributesMask {
|
| + public:
|
| + enum {
|
| + INSTALLING_VERSION = 1 << 0,
|
| + WAITING_VERSION = 1 << 1,
|
| + ACTIVE_VERSION = 1 << 2,
|
| + CONTROLLING_VERSION = 1 << 3,
|
| + };
|
| +
|
| + ChangedVersionAttributesMask() : changed_(0) {}
|
| + explicit ChangedVersionAttributesMask(int changed) : changed_(changed) {}
|
| +
|
| + int changed() const { return changed_; }
|
| +
|
| + void add(int changed_versions) { changed_ |= changed_versions; }
|
| + bool installing_changed() const { return !!(changed_ & INSTALLING_VERSION); }
|
| + bool waiting_changed() const { return !!(changed_ & WAITING_VERSION); }
|
| + bool active_changed() const { return !!(changed_ & ACTIVE_VERSION); }
|
| + bool controller_changed() const { return !!(changed_ & CONTROLLING_VERSION); }
|
| +
|
| + private:
|
| + int changed_;
|
| +};
|
| +
|
| } // namespace content
|
|
|
| #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_
|
|
|