commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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 |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
mjs@apple.com | 9204733 | 2014-03-15 04:08:27 +0000 | [diff] [blame] | 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef CachedResourceRequest_h |
| 27 | #define CachedResourceRequest_h |
| 28 | |
commit-queue@webkit.org | 858242f | 2016-10-13 10:34:15 +0000 | [diff] [blame^] | 29 | #include "CachedResource.h" |
beidson@apple.com | b98919a | 2015-03-23 22:34:53 +0000 | [diff] [blame] | 30 | #include "DocumentLoader.h" |
eric@webkit.org | f3f6e04 | 2013-02-11 05:14:03 +0000 | [diff] [blame] | 31 | #include "Element.h" |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 32 | #include "ResourceLoadPriority.h" |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 33 | #include "ResourceLoaderOptions.h" |
| 34 | #include "ResourceRequest.h" |
commit-queue@webkit.org | 7049f92 | 2016-09-22 08:57:12 +0000 | [diff] [blame] | 35 | #include "SecurityOrigin.h" |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 36 | #include <wtf/RefPtr.h> |
| 37 | #include <wtf/text/AtomicString.h> |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 38 | |
| 39 | namespace WebCore { |
commit-queue@webkit.org | 858242f | 2016-10-13 10:34:15 +0000 | [diff] [blame^] | 40 | |
| 41 | namespace ContentExtensions { |
| 42 | struct BlockedStatus; |
| 43 | } |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 44 | class Document; |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 45 | |
| 46 | class CachedResourceRequest { |
| 47 | public: |
commit-queue@webkit.org | 7795132 | 2016-10-11 06:42:53 +0000 | [diff] [blame] | 48 | CachedResourceRequest(ResourceRequest&&, const ResourceLoaderOptions&, Optional<ResourceLoadPriority> = Nullopt, String&& charset = String()); |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 49 | |
commit-queue@webkit.org | 858242f | 2016-10-13 10:34:15 +0000 | [diff] [blame^] | 50 | ResourceRequest&& releaseResourceRequest() { return WTFMove(m_resourceRequest); } |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 51 | const ResourceRequest& resourceRequest() const { return m_resourceRequest; } |
| 52 | const String& charset() const { return m_charset; } |
| 53 | void setCharset(const String& charset) { m_charset = charset; } |
| 54 | const ResourceLoaderOptions& options() const { return m_options; } |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 55 | void setOptions(const ResourceLoaderOptions& options) { m_options = options; } |
cdumez@apple.com | 8da16fb | 2015-02-04 01:23:58 +0000 | [diff] [blame] | 56 | const Optional<ResourceLoadPriority>& priority() const { return m_priority; } |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 57 | void setInitiator(PassRefPtr<Element>); |
simonjam@chromium.org | 5928faa | 2012-11-22 00:18:35 +0000 | [diff] [blame] | 58 | void setInitiator(const AtomicString& name); |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 59 | const AtomicString& initiatorName() const; |
commit-queue@webkit.org | 877e149 | 2016-08-02 06:46:57 +0000 | [diff] [blame] | 60 | bool allowsCaching() const { return m_options.cachingPolicy == CachingPolicy::AllowCaching; } |
commit-queue@webkit.org | 858242f | 2016-10-13 10:34:15 +0000 | [diff] [blame^] | 61 | void setCachingPolicy(CachingPolicy policy) { m_options.cachingPolicy = policy; } |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 62 | |
youenn.fablet@crf.canon.fr | 70851bfd | 2016-06-10 18:17:11 +0000 | [diff] [blame] | 63 | void setAsPotentiallyCrossOrigin(const String&, Document&); |
commit-queue@webkit.org | 858242f | 2016-10-13 10:34:15 +0000 | [diff] [blame^] | 64 | void updateForAccessControl(Document&); |
| 65 | |
| 66 | void upgradeInsecureRequestIfNeeded(Document&); |
| 67 | void setAcceptHeaderIfNone(CachedResource::Type); |
| 68 | void updateAccordingCacheMode(); |
| 69 | void removeFragmentIdentifierIfNeeded(); |
| 70 | #if ENABLE(CONTENT_EXTENSIONS) |
| 71 | void applyBlockedStatus(const ContentExtensions::BlockedStatus&); |
| 72 | #endif |
| 73 | #if ENABLE(CACHE_PARTITIONING) |
| 74 | void setDomainForCachePartition(Document&); |
| 75 | #endif |
| 76 | |
commit-queue@webkit.org | 7049f92 | 2016-09-22 08:57:12 +0000 | [diff] [blame] | 77 | void setOrigin(RefPtr<SecurityOrigin>&& origin) { ASSERT(!m_origin); m_origin = WTFMove(origin); } |
| 78 | RefPtr<SecurityOrigin> releaseOrigin() { return WTFMove(m_origin); } |
| 79 | SecurityOrigin* origin() const { return m_origin.get(); } |
youenn.fablet@crf.canon.fr | 70851bfd | 2016-06-10 18:17:11 +0000 | [diff] [blame] | 80 | |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 81 | private: |
| 82 | ResourceRequest m_resourceRequest; |
| 83 | String m_charset; |
| 84 | ResourceLoaderOptions m_options; |
cdumez@apple.com | 8da16fb | 2015-02-04 01:23:58 +0000 | [diff] [blame] | 85 | Optional<ResourceLoadPriority> m_priority; |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 86 | RefPtr<Element> m_initiatorElement; |
commit-queue@webkit.org | 864dbda | 2012-11-16 12:21:57 +0000 | [diff] [blame] | 87 | AtomicString m_initiatorName; |
commit-queue@webkit.org | 7049f92 | 2016-09-22 08:57:12 +0000 | [diff] [blame] | 88 | RefPtr<SecurityOrigin> m_origin; |
commit-queue@webkit.org | 5e7ea1b | 2012-10-22 23:35:28 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | } // namespace WebCore |
| 92 | |
| 93 | #endif |