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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.h

Issue 1439333002: Service Worker: Add Clients.get(id) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add layout test Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ServiceWorkerClient_h 5 #ifndef ServiceWorkerClient_h
6 #define ServiceWorkerClient_h 6 #define ServiceWorkerClient_h
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/core/v8/SerializedScriptValue.h" 10 #include "bindings/core/v8/SerializedScriptValue.h"
11 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" 13 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h"
14 #include "wtf/Forward.h" 14 #include "wtf/Forward.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class ExecutionContext; 18 class ExecutionContext;
19 class ScriptPromiseResolver;
19 class ScriptState; 20 class ScriptState;
20 21
21 class MODULES_EXPORT ServiceWorkerClient : public GarbageCollectedFinalized<Serv iceWorkerClient>, public ScriptWrappable { 22 class MODULES_EXPORT ServiceWorkerClient : public GarbageCollectedFinalized<Serv iceWorkerClient>, public ScriptWrappable {
22 DEFINE_WRAPPERTYPEINFO(); 23 DEFINE_WRAPPERTYPEINFO();
23 public: 24 public:
25 // To be used by CallbackPromiseAdapter.
26 using WebType = OwnPtr<WebServiceWorkerClientInfo>;
27
28 static ServiceWorkerClient* take(ScriptPromiseResolver*, PassOwnPtr<WebServi ceWorkerClientInfo>);
29
24 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&); 30 static ServiceWorkerClient* create(const WebServiceWorkerClientInfo&);
25 31
26 virtual ~ServiceWorkerClient(); 32 virtual ~ServiceWorkerClient();
27 33
28 // Client.idl 34 // Client.idl
29 String url() const { return m_url; } 35 String url() const { return m_url; }
30 String frameType() const; 36 String frameType() const;
31 String id() const { return m_uuid; } 37 String id() const { return m_uuid; }
32 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&); 38 void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> messag e, const MessagePortArray*, ExceptionState&);
33 39
34 DEFINE_INLINE_VIRTUAL_TRACE() { } 40 DEFINE_INLINE_VIRTUAL_TRACE() { }
35 41
36 protected: 42 protected:
37 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&); 43 explicit ServiceWorkerClient(const WebServiceWorkerClientInfo&);
38 44
39 String uuid() const { return m_uuid; } 45 String uuid() const { return m_uuid; }
40 46
41 private: 47 private:
42 String m_uuid; 48 String m_uuid;
43 String m_url; 49 String m_url;
44 WebURLRequest::FrameType m_frameType; 50 WebURLRequest::FrameType m_frameType;
45 }; 51 };
46 52
47 } // namespace blink 53 } // namespace blink
48 54
49 #endif // ServiceWorkerClient_h 55 #endif // ServiceWorkerClient_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698