OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef FetchRespondWithObserver_h |
| 6 #define FetchRespondWithObserver_h |
| 7 |
| 8 #include "modules/ModulesExport.h" |
| 9 #include "modules/serviceworkers/RespondWithObserver.h" |
| 10 #include "platform/weborigin/KURL.h" |
| 11 #include "public/platform/WebURLRequest.h" |
| 12 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class ExecutionContext; |
| 17 class ScriptValue; |
| 18 class WaitUntilObserver; |
| 19 |
| 20 // This class observes the service worker's handling of a FetchEvent and |
| 21 // notifies the client. |
| 22 class MODULES_EXPORT FetchRespondWithObserver : public RespondWithObserver { |
| 23 public: |
| 24 ~FetchRespondWithObserver() override = default; |
| 25 |
| 26 static FetchRespondWithObserver* create(ExecutionContext*, |
| 27 int fetchEventID, |
| 28 const KURL& requestURL, |
| 29 WebURLRequest::FetchRequestMode, |
| 30 WebURLRequest::FetchRedirectMode, |
| 31 WebURLRequest::FrameType, |
| 32 WebURLRequest::RequestContext, |
| 33 WaitUntilObserver*); |
| 34 |
| 35 void onResponseRejected(WebServiceWorkerResponseError) override; |
| 36 void onResponseFulfilled(const ScriptValue&) override; |
| 37 void onNoResponse() override; |
| 38 |
| 39 DECLARE_VIRTUAL_TRACE(); |
| 40 |
| 41 protected: |
| 42 FetchRespondWithObserver(ExecutionContext*, |
| 43 int fetchEventID, |
| 44 const KURL& requestURL, |
| 45 WebURLRequest::FetchRequestMode, |
| 46 WebURLRequest::FetchRedirectMode, |
| 47 WebURLRequest::FrameType, |
| 48 WebURLRequest::RequestContext, |
| 49 WaitUntilObserver*); |
| 50 |
| 51 private: |
| 52 const KURL m_requestURL; |
| 53 const WebURLRequest::FetchRequestMode m_requestMode; |
| 54 const WebURLRequest::FetchRedirectMode m_redirectMode; |
| 55 const WebURLRequest::FrameType m_frameType; |
| 56 const WebURLRequest::RequestContext m_requestContext; |
| 57 }; |
| 58 |
| 59 } // namespace blink |
| 60 |
| 61 #endif // FetchRespondWithObserver_h |
OLD | NEW |