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