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 #include "config.h" | 5 #include "config.h" |
6 #include "FetchEvent.h" | 6 #include "FetchEvent.h" |
7 | 7 |
8 #include "modules/fetch/Request.h" | 8 #include "modules/fetch/Request.h" |
9 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 9 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 Request* FetchEvent::request() const | 31 Request* FetchEvent::request() const |
32 { | 32 { |
33 return m_request; | 33 return m_request; |
34 } | 34 } |
35 | 35 |
36 bool FetchEvent::isReload() const | 36 bool FetchEvent::isReload() const |
37 { | 37 { |
38 return m_isReload; | 38 return m_isReload; |
39 } | 39 } |
40 | 40 |
| 41 ServiceWorkerClient* FetchEvent::client() const |
| 42 { |
| 43 return m_client; |
| 44 } |
| 45 |
41 void FetchEvent::respondWith(ScriptState* scriptState, const ScriptValue& value,
ExceptionState& exceptionState) | 46 void FetchEvent::respondWith(ScriptState* scriptState, const ScriptValue& value,
ExceptionState& exceptionState) |
42 { | 47 { |
43 stopImmediatePropagation(); | 48 stopImmediatePropagation(); |
44 m_observer->respondWith(scriptState, value, exceptionState); | 49 m_observer->respondWith(scriptState, value, exceptionState); |
45 } | 50 } |
46 | 51 |
47 const AtomicString& FetchEvent::interfaceName() const | 52 const AtomicString& FetchEvent::interfaceName() const |
48 { | 53 { |
49 return EventNames::FetchEvent; | 54 return EventNames::FetchEvent; |
50 } | 55 } |
51 | 56 |
52 FetchEvent::FetchEvent() | 57 FetchEvent::FetchEvent() |
53 : m_isReload(false) | 58 : m_isReload(false) |
54 { | 59 { |
55 } | 60 } |
56 | 61 |
57 FetchEvent::FetchEvent(const AtomicString& type, const FetchEventInit& initializ
er, RespondWithObserver* observer) | 62 FetchEvent::FetchEvent(const AtomicString& type, const FetchEventInit& initializ
er, RespondWithObserver* observer) |
58 : ExtendableEvent(type, initializer) | 63 : ExtendableEvent(type, initializer) |
59 , m_observer(observer) | 64 , m_observer(observer) |
60 { | 65 { |
61 if (initializer.hasRequest()) | 66 if (initializer.hasRequest()) |
62 m_request = initializer.request(); | 67 m_request = initializer.request(); |
| 68 if (initializer.hasClient()) |
| 69 m_client = initializer.client(); |
63 m_isReload = initializer.isReload(); | 70 m_isReload = initializer.isReload(); |
64 } | 71 } |
65 | 72 |
66 DEFINE_TRACE(FetchEvent) | 73 DEFINE_TRACE(FetchEvent) |
67 { | 74 { |
68 visitor->trace(m_request); | 75 visitor->trace(m_request); |
69 visitor->trace(m_observer); | 76 visitor->trace(m_observer); |
70 ExtendableEvent::trace(visitor); | 77 ExtendableEvent::trace(visitor); |
71 } | 78 } |
72 | 79 |
73 } // namespace blink | 80 } // namespace blink |
OLD | NEW |