| Index: content/common/service_worker/service_worker_client_info.h
|
| diff --git a/content/common/service_worker/service_worker_client_info.h b/content/common/service_worker/service_worker_client_info.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4c4a411d94d1a800824cc60c28841756b5d711dd
|
| --- /dev/null
|
| +++ b/content/common/service_worker/service_worker_client_info.h
|
| @@ -0,0 +1,61 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_INFO_CLIENT_H_
|
| +#define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_INFO_CLIENT_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "content/public/common/request_context_frame_type.h"
|
| +#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
|
| +#include "third_party/WebKit/public/platform/WebServiceWorkerClientsInfo.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace content {
|
| +
|
| +// This class holds the information related to a service worker window client.
|
| +// It is the content/ equivalent of WebServiceWorkerClientInfo.
|
| +// An instance can be created empty or can be filed with the expected
|
| +// properties. After its creation, it is not possible to change the properties
|
| +// of the object, except set the client id once.
|
| +class ServiceWorkerClientInfo {
|
| + public:
|
| + ServiceWorkerClientInfo();
|
| + ServiceWorkerClientInfo(blink::WebPageVisibilityState page_visibility_state,
|
| + bool is_focused,
|
| + const GURL& url,
|
| + RequestContextFrameType frame_type);
|
| +
|
| + int client_id() const;
|
| + blink::WebPageVisibilityState page_visibility_state() const;
|
| + bool is_focused() const;
|
| + const GURL& url() const;
|
| + RequestContextFrameType frame_type() const;
|
| +
|
| + // Set the client id and finishes the initialization of the object.
|
| + void SetClientID(int client_id);
|
| +
|
| + // Returns whether the instance was created empty. An empty instance can't
|
| + // have properties set to it later.
|
| + bool IsEmpty() const;
|
| +
|
| + // Returns whether the instance is valid. A valid instance is not empty and
|
| + // has a client id.
|
| + bool IsValid() const;
|
| +
|
| + operator blink::WebServiceWorkerClientInfo() const;
|
| +
|
| + private:
|
| + bool empty_;
|
| + bool has_client_id_;
|
| +
|
| + int client_id_;
|
| + blink::WebPageVisibilityState page_visibility_state_;
|
| + bool is_focused_;
|
| + GURL url_;
|
| + RequestContextFrameType frame_type_;
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_INFO_CLIENT_H_
|
|
|