Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / modules / serviceworkers / ServiceWorkerGlobalScope.cpp
index b676da2..c6ccfff 100644 (file)
 #include "bindings/v8/ScriptObject.h"
 #include "core/workers/WorkerClients.h"
 #include "core/workers/WorkerThreadStartupData.h"
+#include "modules/serviceworkers/ServiceWorkerClients.h"
+#include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
 #include "modules/serviceworkers/ServiceWorkerThread.h"
 #include "platform/weborigin/KURL.h"
+#include "public/platform/WebURL.h"
 #include "wtf/CurrentTime.h"
 
 namespace WebCore {
@@ -47,8 +50,8 @@ PassRefPtrWillBeRawPtr<ServiceWorkerGlobalScope> ServiceWorkerGlobalScope::creat
     return context.release();
 }
 
-ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String& userAgent, ServiceWorkerThread* thread, double timeOrigin, PassOwnPtr<WorkerClients> workerClients) :
-    WorkerGlobalScope(url, userAgent, thread, timeOrigin, workerClients)
+ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(const KURL& url, const String& userAgent, ServiceWorkerThread* thread, double timeOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients)
+    WorkerGlobalScope(url, userAgent, thread, timeOrigin, workerClients)
 {
     ScriptWrappable::init(this);
 }
@@ -57,6 +60,18 @@ ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope()
 {
 }
 
+String ServiceWorkerGlobalScope::scope(ExecutionContext* context)
+{
+    return ServiceWorkerGlobalScopeClient::from(context)->scope().string();
+}
+
+PassRefPtr<ServiceWorkerClients> ServiceWorkerGlobalScope::clients()
+{
+    if (!m_clients)
+        m_clients = ServiceWorkerClients::create();
+    return m_clients;
+}
+
 const AtomicString& ServiceWorkerGlobalScope::interfaceName() const
 {
     return EventTargetNames::ServiceWorkerGlobalScope;