| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 eventInit.setRequest(request); | 140 eventInit.setRequest(request); |
| 141 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 141 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
| 142 eventInit.setIsReload(webRequest.isReload()); | 142 eventInit.setIsReload(webRequest.isReload()); |
| 143 FetchEvent* fetchEvent = FetchEvent::create(EventTypeNames::fetch, eventInit
, observer); | 143 FetchEvent* fetchEvent = FetchEvent::create(EventTypeNames::fetch, eventInit
, observer); |
| 144 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 144 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
| 145 observer->didDispatchEvent(dispatchResult); | 145 observer->didDispatchEvent(dispatchResult); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) | 148 void ServiceWorkerGlobalScopeProxy::dispatchForeignFetchEvent(int eventID, const
WebServiceWorkerRequest& webRequest) |
| 149 { | 149 { |
| 150 ForeignFetchRespondWithObserver* observer = ForeignFetchRespondWithObserver:
:create(workerGlobalScope(), eventID, webRequest.url(), webRequest.mode(), webRe
quest.frameType(), webRequest.requestContext()); | 150 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(webRequest.referrerUr
l()); |
| 151 ForeignFetchRespondWithObserver* observer = ForeignFetchRespondWithObserver:
:create(workerGlobalScope(), eventID, webRequest.url(), webRequest.mode(), webRe
quest.frameType(), webRequest.requestContext(), origin); |
| 151 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); | 152 Request* request = Request::create(workerGlobalScope()->scriptController()->
getScriptState(), webRequest); |
| 152 request->getHeaders()->setGuard(Headers::ImmutableGuard); | 153 request->getHeaders()->setGuard(Headers::ImmutableGuard); |
| 153 ForeignFetchEventInit eventInit; | 154 ForeignFetchEventInit eventInit; |
| 154 eventInit.setCancelable(true); | 155 eventInit.setCancelable(true); |
| 155 eventInit.setRequest(request); | 156 eventInit.setRequest(request); |
| 157 eventInit.setOrigin(origin->toString()); |
| 156 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); | 158 ForeignFetchEvent* fetchEvent = ForeignFetchEvent::create(EventTypeNames::fo
reignfetch, eventInit, observer); |
| 157 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); | 159 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent); |
| 158 observer->didDispatchEvent(dispatchResult); | 160 observer->didDispatchEvent(dispatchResult); |
| 159 } | 161 } |
| 160 | 162 |
| 161 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 163 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
| 162 { | 164 { |
| 163 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); | 165 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
| 164 Event* event; | 166 Event* event; |
| 165 if (RuntimeEnabledFeatures::foreignFetchEnabled()) | 167 if (RuntimeEnabledFeatures::foreignFetchEnabled()) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return *m_document; | 290 return *m_document; |
| 289 } | 291 } |
| 290 | 292 |
| 291 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 293 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
| 292 { | 294 { |
| 293 DCHECK(m_workerGlobalScope); | 295 DCHECK(m_workerGlobalScope); |
| 294 return m_workerGlobalScope; | 296 return m_workerGlobalScope; |
| 295 } | 297 } |
| 296 | 298 |
| 297 } // namespace blink | 299 } // namespace blink |
| OLD | NEW |