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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerClient.cpp

Issue 778703004: Implement ServiceWorkerClient attributes [3/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@properties-step1
Patch Set: Created 6 years 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: Source/modules/serviceworkers/ServiceWorkerClient.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerClient.cpp b/Source/modules/serviceworkers/ServiceWorkerClient.cpp
index 57ab08a2eb23c4b3c75a200154c59bd2d1d900d0..3af8989b02bb9f7fd4b3bbcc4a3b52260886aae7 100644
--- a/Source/modules/serviceworkers/ServiceWorkerClient.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerClient.cpp
@@ -16,16 +16,46 @@
namespace blink {
-ServiceWorkerClient* ServiceWorkerClient::create(unsigned id)
+ServiceWorkerClient* ServiceWorkerClient::create(const WebServiceWorkerClientInfo& info)
{
- return new ServiceWorkerClient(id);
+ return new ServiceWorkerClient(info);
}
-ServiceWorkerClient::ServiceWorkerClient(unsigned id)
- : m_id(id)
+ServiceWorkerClient::ServiceWorkerClient(const WebServiceWorkerClientInfo& info)
+ : m_id(info.clientID)
+ , m_visibilityState(info.visibilityState)
+ , m_focused(info.focused)
+ , m_url(info.url.string())
+ , m_frameType(info.frameType)
{
}
+ServiceWorkerClient::~ServiceWorkerClient()
+{
+}
+
+String ServiceWorkerClient::frameType() const
+{
+ DEFINE_STATIC_LOCAL(const String, auxiliary, ("auxiliary"));
+ DEFINE_STATIC_LOCAL(const String, nested, ("nested"));
+ DEFINE_STATIC_LOCAL(const String, none, ("none"));
+ DEFINE_STATIC_LOCAL(const String, topLevel, ("top-level"));
+
+ switch (m_frameType) {
+ case WebURLRequest::FrameTypeAuxiliary:
+ return auxiliary;
+ case WebURLRequest::FrameTypeNested:
+ return nested;
+ case WebURLRequest::FrameTypeNone:
+ return none;
+ case WebURLRequest::FrameTypeTopLevel:
+ return topLevel;
+ }
+
+ ASSERT_NOT_REACHED();
+ return String();
+}
+
void ServiceWorkerClient::postMessage(ExecutionContext* context, PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionState& exceptionState)
{
// Disentangle the port in preparation for sending it to the remote context.

Powered by Google App Engine
This is Rietveld 408576698