| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebDataSourceImpl_h | |
| 32 #define WebDataSourceImpl_h | |
| 33 | |
| 34 #include <memory> | |
| 35 #include "core/frame/FrameTypes.h" | |
| 36 #include "core/loader/DocumentLoader.h" | |
| 37 #include "platform/exported/WrappedResourceRequest.h" | |
| 38 #include "platform/exported/WrappedResourceResponse.h" | |
| 39 #include "platform/heap/Handle.h" | |
| 40 #include "platform/weborigin/KURL.h" | |
| 41 #include "platform/wtf/Vector.h" | |
| 42 #include "public/web/WebDataSource.h" | |
| 43 | |
| 44 namespace blink { | |
| 45 | |
| 46 class WebDataSourceImpl final : public DocumentLoader, public WebDataSource { | |
| 47 public: | |
| 48 static WebDataSourceImpl* Create(LocalFrame*, | |
| 49 const ResourceRequest&, | |
| 50 const SubstituteData&, | |
| 51 ClientRedirectPolicy); | |
| 52 | |
| 53 static WebDataSourceImpl* FromDocumentLoader(DocumentLoader* loader) { | |
| 54 return static_cast<WebDataSourceImpl*>(loader); | |
| 55 } | |
| 56 | |
| 57 // WebDataSource methods: | |
| 58 const WebURLRequest& OriginalRequest() const override; | |
| 59 const WebURLRequest& GetRequest() const override; | |
| 60 const WebURLResponse& GetResponse() const override; | |
| 61 bool HasUnreachableURL() const override; | |
| 62 WebURL UnreachableURL() const override; | |
| 63 void AppendRedirect(const WebURL&) override; | |
| 64 void RedirectChain(WebVector<WebURL>&) const override; | |
| 65 bool IsClientRedirect() const override; | |
| 66 bool ReplacesCurrentHistoryItem() const override; | |
| 67 WebNavigationType GetNavigationType() const override; | |
| 68 ExtraData* GetExtraData() const override; | |
| 69 void SetExtraData(ExtraData*) override; | |
| 70 void SetNavigationStartTime(double) override; | |
| 71 void UpdateNavigation(double redirect_start_time, | |
| 72 double redirect_end_time, | |
| 73 double fetch_start_time, | |
| 74 bool has_redirect) override; | |
| 75 void SetSubresourceFilter(WebDocumentSubresourceFilter*) override; | |
| 76 void SetServiceWorkerNetworkProvider( | |
| 77 std::unique_ptr<WebServiceWorkerNetworkProvider>) override; | |
| 78 WebServiceWorkerNetworkProvider* GetServiceWorkerNetworkProvider() override; | |
| 79 void SetSourceLocation(const WebSourceLocation&) override; | |
| 80 void ResetSourceLocation() override; | |
| 81 | |
| 82 static WebNavigationType ToWebNavigationType(NavigationType); | |
| 83 | |
| 84 DECLARE_VIRTUAL_TRACE(); | |
| 85 | |
| 86 private: | |
| 87 WebDataSourceImpl(LocalFrame*, | |
| 88 const ResourceRequest&, | |
| 89 const SubstituteData&, | |
| 90 ClientRedirectPolicy); | |
| 91 ~WebDataSourceImpl() override; | |
| 92 void DetachFromFrame() override; | |
| 93 String DebugName() const override { return "WebDataSourceImpl"; } | |
| 94 | |
| 95 // Mutable because the const getters will magically sync these to the | |
| 96 // latest version from WebKit. | |
| 97 mutable WrappedResourceRequest original_request_wrapper_; | |
| 98 mutable WrappedResourceRequest request_wrapper_; | |
| 99 mutable WrappedResourceResponse response_wrapper_; | |
| 100 | |
| 101 std::unique_ptr<ExtraData> extra_data_; | |
| 102 }; | |
| 103 | |
| 104 } // namespace blink | |
| 105 | |
| 106 #endif // WebDataSourceImpl_h | |
| OLD | NEW |