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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class CORE_EXPORT FetchRequest { | 42 class CORE_EXPORT FetchRequest { |
43 STACK_ALLOCATED(); | 43 STACK_ALLOCATED(); |
44 | 44 |
45 public: | 45 public: |
46 enum DeferOption { NoDefer, LazyLoad, IdleLoad }; | 46 enum DeferOption { NoDefer, LazyLoad, IdleLoad }; |
47 enum OriginRestriction { | 47 enum OriginRestriction { |
48 UseDefaultOriginRestrictionForType, | 48 UseDefaultOriginRestrictionForType, |
49 RestrictToSameOrigin, | 49 RestrictToSameOrigin, |
50 NoOriginRestriction | 50 NoOriginRestriction |
51 }; | 51 }; |
| 52 enum PlaceholderImageRequestType { |
| 53 DisallowPlaceholder = 0, // The requested image must not be a placeholder. |
| 54 AllowPlaceholder, // The image is allowed to be a placeholder. |
| 55 }; |
52 | 56 |
53 struct ResourceWidth { | 57 struct ResourceWidth { |
54 DISALLOW_NEW(); | 58 DISALLOW_NEW(); |
55 float width; | 59 float width; |
56 bool isSet; | 60 bool isSet; |
57 | 61 |
58 ResourceWidth() : width(0), isSet(false) {} | 62 ResourceWidth() : width(0), isSet(false) {} |
59 }; | 63 }; |
60 | 64 |
61 FetchRequest(const ResourceRequest&, | 65 FetchRequest(const ResourceRequest&, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void setContentSecurityPolicyNonce(const String& nonce) { | 120 void setContentSecurityPolicyNonce(const String& nonce) { |
117 m_options.contentSecurityPolicyNonce = nonce; | 121 m_options.contentSecurityPolicyNonce = nonce; |
118 } | 122 } |
119 | 123 |
120 void setParserDisposition(ParserDisposition parserDisposition) { | 124 void setParserDisposition(ParserDisposition parserDisposition) { |
121 m_options.parserDisposition = parserDisposition; | 125 m_options.parserDisposition = parserDisposition; |
122 } | 126 } |
123 | 127 |
124 void makeSynchronous(); | 128 void makeSynchronous(); |
125 | 129 |
| 130 PlaceholderImageRequestType placeholderImageRequestType() const { |
| 131 return m_placeholderImageRequestType; |
| 132 } |
| 133 |
| 134 // Configures the request to load an image placeholder if the request is |
| 135 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is |
| 136 // non-eligible, this method doesn't modify the ResourceRequest. Calling this |
| 137 // method sets m_placeholderImageRequestType to the appropriate value. |
| 138 void setAllowImagePlaceholder(); |
| 139 |
126 private: | 140 private: |
127 ResourceRequest m_resourceRequest; | 141 ResourceRequest m_resourceRequest; |
128 String m_charset; | 142 String m_charset; |
129 ResourceLoaderOptions m_options; | 143 ResourceLoaderOptions m_options; |
130 bool m_forPreload; | 144 bool m_forPreload; |
131 bool m_linkPreload; | 145 bool m_linkPreload; |
132 double m_preloadDiscoveryTime; | 146 double m_preloadDiscoveryTime; |
133 DeferOption m_defer; | 147 DeferOption m_defer; |
134 OriginRestriction m_originRestriction; | 148 OriginRestriction m_originRestriction; |
135 ResourceWidth m_resourceWidth; | 149 ResourceWidth m_resourceWidth; |
136 ClientHintsPreferences m_clientHintPreferences; | 150 ClientHintsPreferences m_clientHintPreferences; |
| 151 PlaceholderImageRequestType m_placeholderImageRequestType; |
137 }; | 152 }; |
138 | 153 |
139 } // namespace blink | 154 } // namespace blink |
140 | 155 |
141 #endif | 156 #endif |
OLD | NEW |