OLD | NEW |
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 FetchEvent_h | 5 #ifndef FetchEvent_h |
6 #define FetchEvent_h | 6 #define FetchEvent_h |
7 | 7 |
8 #include "modules/EventModules.h" | 8 #include "modules/EventModules.h" |
| 9 #include "modules/serviceworkers/Request.h" |
9 #include "modules/serviceworkers/RespondWithObserver.h" | 10 #include "modules/serviceworkers/RespondWithObserver.h" |
10 | 11 |
11 namespace WebCore { | 12 namespace WebCore { |
12 | 13 |
13 class ExecutionContext; | 14 class ExecutionContext; |
| 15 class Request; |
14 class RespondWithObserver; | 16 class RespondWithObserver; |
15 | 17 |
16 // A fetch event is dispatched by the client to a service worker's script | 18 // A fetch event is dispatched by the client to a service worker's script |
17 // context. RespondWithObserver can be used to notify the client about the | 19 // context. RespondWithObserver can be used to notify the client about the |
18 // service worker's response. | 20 // service worker's response. |
19 class FetchEvent FINAL : public Event { | 21 class FetchEvent FINAL : public Event { |
20 public: | 22 public: |
21 static PassRefPtrWillBeRawPtr<FetchEvent> create(); | 23 static PassRefPtrWillBeRawPtr<FetchEvent> create(); |
| 24 // TODO(horo): Remove this. |
22 static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObser
ver>); | 25 static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObser
ver>); |
| 26 static PassRefPtrWillBeRawPtr<FetchEvent> create(PassRefPtr<RespondWithObser
ver>, PassRefPtr<Request>); |
23 virtual ~FetchEvent() { } | 27 virtual ~FetchEvent() { } |
24 | 28 |
| 29 Request* request() const; |
| 30 |
25 void respondWith(const ScriptValue&); | 31 void respondWith(const ScriptValue&); |
26 | 32 |
27 virtual const AtomicString& interfaceName() const OVERRIDE; | 33 virtual const AtomicString& interfaceName() const OVERRIDE; |
28 | 34 |
29 virtual void trace(Visitor*) OVERRIDE; | 35 virtual void trace(Visitor*) OVERRIDE; |
30 | 36 |
31 protected: | 37 protected: |
32 FetchEvent(); | 38 FetchEvent(); |
| 39 // TODO(horo): Remove this. |
33 explicit FetchEvent(PassRefPtr<RespondWithObserver>); | 40 explicit FetchEvent(PassRefPtr<RespondWithObserver>); |
| 41 FetchEvent(PassRefPtr<RespondWithObserver>, PassRefPtr<Request>); |
34 | 42 |
35 private: | 43 private: |
36 RefPtr<RespondWithObserver> m_observer; | 44 RefPtr<RespondWithObserver> m_observer; |
| 45 RefPtr<Request> m_request; |
37 }; | 46 }; |
38 | 47 |
39 } // namespace WebCore | 48 } // namespace WebCore |
40 | 49 |
41 #endif // FetchEvent_h | 50 #endif // FetchEvent_h |
OLD | NEW |