OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google, Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 enum OriginRestriction { | 49 enum OriginRestriction { |
50 UseDefaultOriginRestrictionForType, | 50 UseDefaultOriginRestrictionForType, |
51 RestrictToSameOrigin, | 51 RestrictToSameOrigin, |
52 NoOriginRestriction | 52 NoOriginRestriction |
53 }; | 53 }; |
54 enum PlaceholderImageRequestType { | 54 enum PlaceholderImageRequestType { |
55 DisallowPlaceholder = 0, // The requested image must not be a placeholder. | 55 DisallowPlaceholder = 0, // The requested image must not be a placeholder. |
56 AllowPlaceholder, // The image is allowed to be a placeholder. | 56 AllowPlaceholder, // The image is allowed to be a placeholder. |
57 }; | 57 }; |
58 // TODO(toyoshim): Consider to define an enum for preload options, and use it | 58 // TODO(toyoshim): Consider to define an enum for preload options, and use it |
59 // instead of bool in this class, FrameFetchContext, and so on. If it is | 59 // instead of bool in this class, FrameFetchContext, and so on. |
60 // reasonable, we try merging m_speculativePreload and m_linkPreload into one | |
61 // enum type. See https://crbug.com/675883. | |
62 | |
63 struct ResourceWidth { | 60 struct ResourceWidth { |
64 DISALLOW_NEW(); | 61 DISALLOW_NEW(); |
65 float width; | 62 float width; |
66 bool isSet; | 63 bool isSet; |
67 | 64 |
68 ResourceWidth() : width(0), isSet(false) {} | 65 ResourceWidth() : width(0), isSet(false) {} |
69 }; | 66 }; |
70 | 67 |
71 FetchRequest(const ResourceRequest&, | 68 FetchRequest(const ResourceRequest&, |
72 const AtomicString& initiator, | 69 const AtomicString& initiator, |
(...skipping 20 matching lines...) Expand all Loading... | |
93 DeferOption defer() const { return m_defer; } | 90 DeferOption defer() const { return m_defer; } |
94 void setDefer(DeferOption defer) { m_defer = defer; } | 91 void setDefer(DeferOption defer) { m_defer = defer; } |
95 | 92 |
96 ResourceWidth getResourceWidth() const { return m_resourceWidth; } | 93 ResourceWidth getResourceWidth() const { return m_resourceWidth; } |
97 void setResourceWidth(ResourceWidth); | 94 void setResourceWidth(ResourceWidth); |
98 | 95 |
99 ClientHintsPreferences& clientHintsPreferences() { | 96 ClientHintsPreferences& clientHintsPreferences() { |
100 return m_clientHintPreferences; | 97 return m_clientHintPreferences; |
101 } | 98 } |
102 | 99 |
103 bool isSpeculativePreload() const { return m_speculativePreload; } | 100 bool isSpeculativePreload() const { |
104 void setSpeculativePreload(bool speculativePreload, double discoveryTime = 0); | 101 return m_resourceRequest.isSpeculativePreload(); |
102 } | |
105 | 103 |
106 double preloadDiscoveryTime() { return m_preloadDiscoveryTime; } | 104 bool isLinkPreload() const { return m_resourceRequest.isLinkPreload(); } |
107 | 105 |
108 bool isLinkPreload() const { return m_linkPreload; } | 106 // TODO(toyoshim): do not use this method, to be removed. |
tyoshino (SeeGerritForStatus)
2017/03/27 05:41:08
let's put the warning outside of the TODO as it's
| |
109 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } | 107 void setLinkPreload(bool isLinkPreload) { |
108 m_resourceRequest.setLinkPreload(isLinkPreload); | |
109 } | |
110 | 110 |
111 void setContentSecurityCheck( | 111 void setContentSecurityCheck( |
112 ContentSecurityPolicyDisposition contentSecurityPolicyOption) { | 112 ContentSecurityPolicyDisposition contentSecurityPolicyOption) { |
113 m_options.contentSecurityPolicyOption = contentSecurityPolicyOption; | 113 m_options.contentSecurityPolicyOption = contentSecurityPolicyOption; |
114 } | 114 } |
115 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue); | 115 void setCrossOriginAccessControl(SecurityOrigin*, CrossOriginAttributeValue); |
116 OriginRestriction getOriginRestriction() const { return m_originRestriction; } | 116 OriginRestriction getOriginRestriction() const { return m_originRestriction; } |
117 void setOriginRestriction(OriginRestriction restriction) { | 117 void setOriginRestriction(OriginRestriction restriction) { |
118 m_originRestriction = restriction; | 118 m_originRestriction = restriction; |
119 } | 119 } |
(...skipping 29 matching lines...) Expand all Loading... | |
149 // Configures the request to load an image placeholder if the request is | 149 // Configures the request to load an image placeholder if the request is |
150 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is | 150 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is |
151 // non-eligible, this method doesn't modify the ResourceRequest. Calling this | 151 // non-eligible, this method doesn't modify the ResourceRequest. Calling this |
152 // method sets m_placeholderImageRequestType to the appropriate value. | 152 // method sets m_placeholderImageRequestType to the appropriate value. |
153 void setAllowImagePlaceholder(); | 153 void setAllowImagePlaceholder(); |
154 | 154 |
155 private: | 155 private: |
156 ResourceRequest m_resourceRequest; | 156 ResourceRequest m_resourceRequest; |
157 String m_charset; | 157 String m_charset; |
158 ResourceLoaderOptions m_options; | 158 ResourceLoaderOptions m_options; |
159 bool m_speculativePreload; | |
160 bool m_linkPreload; | |
161 double m_preloadDiscoveryTime; | |
162 DeferOption m_defer; | 159 DeferOption m_defer; |
163 OriginRestriction m_originRestriction; | 160 OriginRestriction m_originRestriction; |
164 ResourceWidth m_resourceWidth; | 161 ResourceWidth m_resourceWidth; |
165 ClientHintsPreferences m_clientHintPreferences; | 162 ClientHintsPreferences m_clientHintPreferences; |
166 PlaceholderImageRequestType m_placeholderImageRequestType; | 163 PlaceholderImageRequestType m_placeholderImageRequestType; |
167 }; | 164 }; |
168 | 165 |
169 } // namespace blink | 166 } // namespace blink |
170 | 167 |
171 #endif | 168 #endif |
OLD | NEW |