| 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 29 matching lines...) Expand all Loading... |
| 40 class SecurityOrigin; | 40 class SecurityOrigin; |
| 41 | 41 |
| 42 // A FetchParameters is a "parameter object" for | 42 // A FetchParameters is a "parameter object" for |
| 43 // ResourceFetcher::requestResource to avoid the method having too many | 43 // ResourceFetcher::requestResource to avoid the method having too many |
| 44 // arguments. | 44 // arguments. |
| 45 class PLATFORM_EXPORT FetchParameters { | 45 class PLATFORM_EXPORT FetchParameters { |
| 46 STACK_ALLOCATED(); | 46 STACK_ALLOCATED(); |
| 47 | 47 |
| 48 public: | 48 public: |
| 49 enum DeferOption { kNoDefer, kLazyLoad, kIdleLoad }; | 49 enum DeferOption { kNoDefer, kLazyLoad, kIdleLoad }; |
| 50 enum class SpeculativePreloadType { | |
| 51 kNotSpeculative, | |
| 52 kInDocument, // The request was discovered in the main document | |
| 53 kInserted // The request was discovered in a document.write() | |
| 54 }; | |
| 55 enum OriginRestriction { | 50 enum OriginRestriction { |
| 56 kUseDefaultOriginRestrictionForType, | 51 kUseDefaultOriginRestrictionForType, |
| 57 kRestrictToSameOrigin, | 52 kRestrictToSameOrigin, |
| 58 kNoOriginRestriction | 53 kNoOriginRestriction |
| 59 }; | 54 }; |
| 60 enum PlaceholderImageRequestType { | 55 enum PlaceholderImageRequestType { |
| 61 kDisallowPlaceholder = 0, // The requested image must not be a placeholder. | 56 kDisallowPlaceholder = 0, // The requested image must not be a placeholder. |
| 62 kAllowPlaceholder, // The image is allowed to be a placeholder. | 57 kAllowPlaceholder, // The image is allowed to be a placeholder. |
| 63 }; | 58 }; |
| 64 // TODO(toyoshim): Consider to define an enum for preload options, and use it | 59 // TODO(toyoshim): Consider to define an enum for preload options, and use it |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 DeferOption Defer() const { return defer_; } | 96 DeferOption Defer() const { return defer_; } |
| 102 void SetDefer(DeferOption defer) { defer_ = defer; } | 97 void SetDefer(DeferOption defer) { defer_ = defer; } |
| 103 | 98 |
| 104 ResourceWidth GetResourceWidth() const { return resource_width_; } | 99 ResourceWidth GetResourceWidth() const { return resource_width_; } |
| 105 void SetResourceWidth(ResourceWidth); | 100 void SetResourceWidth(ResourceWidth); |
| 106 | 101 |
| 107 ClientHintsPreferences& GetClientHintsPreferences() { | 102 ClientHintsPreferences& GetClientHintsPreferences() { |
| 108 return client_hint_preferences_; | 103 return client_hint_preferences_; |
| 109 } | 104 } |
| 110 | 105 |
| 111 bool IsSpeculativePreload() const { | 106 bool IsSpeculativePreload() const { return speculative_preload_; } |
| 112 return speculative_preload_type_ != SpeculativePreloadType::kNotSpeculative; | 107 void SetSpeculativePreload(bool speculative_preload, |
| 113 } | 108 double discovery_time = 0); |
| 114 SpeculativePreloadType GetSpeculativePreloadType() const { | |
| 115 return speculative_preload_type_; | |
| 116 } | |
| 117 void SetSpeculativePreloadType(SpeculativePreloadType, | |
| 118 double discovery_time = 0); | |
| 119 | 109 |
| 120 double PreloadDiscoveryTime() { return preload_discovery_time_; } | 110 double PreloadDiscoveryTime() { return preload_discovery_time_; } |
| 121 | 111 |
| 122 bool IsLinkPreload() const { return options_.initiator_info.is_link_preload; } | 112 bool IsLinkPreload() const { return options_.initiator_info.is_link_preload; } |
| 123 void SetLinkPreload(bool is_link_preload) { | 113 void SetLinkPreload(bool is_link_preload) { |
| 124 options_.initiator_info.is_link_preload = is_link_preload; | 114 options_.initiator_info.is_link_preload = is_link_preload; |
| 125 } | 115 } |
| 126 | 116 |
| 127 void SetContentSecurityCheck( | 117 void SetContentSecurityCheck( |
| 128 ContentSecurityPolicyDisposition content_security_policy_option) { | 118 ContentSecurityPolicyDisposition content_security_policy_option) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // Configures the request to load an image placeholder if the request is | 155 // Configures the request to load an image placeholder if the request is |
| 166 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is | 156 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is |
| 167 // non-eligible, this method doesn't modify the ResourceRequest. Calling this | 157 // non-eligible, this method doesn't modify the ResourceRequest. Calling this |
| 168 // method sets m_placeholderImageRequestType to the appropriate value. | 158 // method sets m_placeholderImageRequestType to the appropriate value. |
| 169 void SetAllowImagePlaceholder(); | 159 void SetAllowImagePlaceholder(); |
| 170 | 160 |
| 171 private: | 161 private: |
| 172 ResourceRequest resource_request_; | 162 ResourceRequest resource_request_; |
| 173 String charset_; | 163 String charset_; |
| 174 ResourceLoaderOptions options_; | 164 ResourceLoaderOptions options_; |
| 175 SpeculativePreloadType speculative_preload_type_; | 165 bool speculative_preload_; |
| 176 double preload_discovery_time_; | 166 double preload_discovery_time_; |
| 177 DeferOption defer_; | 167 DeferOption defer_; |
| 178 OriginRestriction origin_restriction_; | 168 OriginRestriction origin_restriction_; |
| 179 ResourceWidth resource_width_; | 169 ResourceWidth resource_width_; |
| 180 ClientHintsPreferences client_hint_preferences_; | 170 ClientHintsPreferences client_hint_preferences_; |
| 181 PlaceholderImageRequestType placeholder_image_request_type_; | 171 PlaceholderImageRequestType placeholder_image_request_type_; |
| 182 }; | 172 }; |
| 183 | 173 |
| 184 } // namespace blink | 174 } // namespace blink |
| 185 | 175 |
| 186 #endif | 176 #endif |
| OLD | NEW |