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

Unified Diff: content/common/service_worker/service_worker_client_info.h

Issue 871013003: Gather the ServiceWorker client information in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_getvisibilitystate
Patch Set: review comments Created 5 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/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..ab97dbd14729ea7946c3088393593f68e77d4f53
--- /dev/null
+++ b/content/common/service_worker/service_worker_client_info.h
@@ -0,0 +1,45 @@
+// 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 "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. Except for the client_id, it is preferred to use the constructor
+// to fill the properties.
+struct ServiceWorkerClientInfo {
+ ServiceWorkerClientInfo();
+ ServiceWorkerClientInfo(blink::WebPageVisibilityState page_visibility_state,
+ bool is_focused,
+ const GURL& url,
+ RequestContextFrameType frame_type);
+
+ // Returns whether the instance is empty.
+ bool IsEmpty() const;
+
+ // Returns whether the instance is valid. A valid instance is not empty and
+ // has a valid client_id.
+ bool IsValid() const;
+
+ operator blink::WebServiceWorkerClientInfo() const;
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698