Chromium Code Reviews| 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 SpeculativePreload { | |
|
kinuko
2017/04/21 06:22:25
SpeculativePreloadType ?
Pat Meenan
2017/04/21 16:11:02
Done.
| |
| 51 kNotSpeculative = 0, | |
| 52 kSpeculativeInDocument, // The request was discovered in the main document | |
| 53 kSpeculativeInserted // The request was discovered in a document.write() | |
| 54 }; | |
|
kinuko
2017/04/21 06:22:25
ditto for new enums (though it makes things less c
Pat Meenan
2017/04/21 16:11:02
Changed it to a class with shorter enums (is that
| |
| 50 enum OriginRestriction { | 55 enum OriginRestriction { |
| 51 kUseDefaultOriginRestrictionForType, | 56 kUseDefaultOriginRestrictionForType, |
| 52 kRestrictToSameOrigin, | 57 kRestrictToSameOrigin, |
| 53 kNoOriginRestriction | 58 kNoOriginRestriction |
| 54 }; | 59 }; |
| 55 enum PlaceholderImageRequestType { | 60 enum PlaceholderImageRequestType { |
| 56 kDisallowPlaceholder = 0, // The requested image must not be a placeholder. | 61 kDisallowPlaceholder = 0, // The requested image must not be a placeholder. |
| 57 kAllowPlaceholder, // The image is allowed to be a placeholder. | 62 kAllowPlaceholder, // The image is allowed to be a placeholder. |
| 58 }; | 63 }; |
| 59 // TODO(toyoshim): Consider to define an enum for preload options, and use it | 64 // 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... | |
| 96 DeferOption Defer() const { return defer_; } | 101 DeferOption Defer() const { return defer_; } |
| 97 void SetDefer(DeferOption defer) { defer_ = defer; } | 102 void SetDefer(DeferOption defer) { defer_ = defer; } |
| 98 | 103 |
| 99 ResourceWidth GetResourceWidth() const { return resource_width_; } | 104 ResourceWidth GetResourceWidth() const { return resource_width_; } |
| 100 void SetResourceWidth(ResourceWidth); | 105 void SetResourceWidth(ResourceWidth); |
| 101 | 106 |
| 102 ClientHintsPreferences& GetClientHintsPreferences() { | 107 ClientHintsPreferences& GetClientHintsPreferences() { |
| 103 return client_hint_preferences_; | 108 return client_hint_preferences_; |
| 104 } | 109 } |
| 105 | 110 |
| 106 bool IsSpeculativePreload() const { return speculative_preload_; } | 111 bool IsSpeculativePreload() const { |
| 107 void SetSpeculativePreload(bool speculative_preload, | 112 return speculative_preload_ != kNotSpeculative; |
| 108 double discovery_time = 0); | 113 } |
| 114 bool IsSpeculativeDocumentPreload() const { | |
| 115 return speculative_preload_ == kSpeculativeInDocument; | |
| 116 } | |
| 117 void SetSpeculativePreload(SpeculativePreload, double discovery_time = 0); | |
| 109 | 118 |
| 110 double PreloadDiscoveryTime() { return preload_discovery_time_; } | 119 double PreloadDiscoveryTime() { return preload_discovery_time_; } |
| 111 | 120 |
| 112 bool IsLinkPreload() const { return options_.initiator_info.is_link_preload; } | 121 bool IsLinkPreload() const { return options_.initiator_info.is_link_preload; } |
| 113 void SetLinkPreload(bool is_link_preload) { | 122 void SetLinkPreload(bool is_link_preload) { |
| 114 options_.initiator_info.is_link_preload = is_link_preload; | 123 options_.initiator_info.is_link_preload = is_link_preload; |
| 115 } | 124 } |
| 116 | 125 |
| 117 void SetContentSecurityCheck( | 126 void SetContentSecurityCheck( |
| 118 ContentSecurityPolicyDisposition content_security_policy_option) { | 127 ContentSecurityPolicyDisposition content_security_policy_option) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 // Configures the request to load an image placeholder if the request is | 164 // Configures the request to load an image placeholder if the request is |
| 156 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is | 165 // eligible (e.g. the url's protocol is HTTP, etc.). If this request is |
| 157 // non-eligible, this method doesn't modify the ResourceRequest. Calling this | 166 // non-eligible, this method doesn't modify the ResourceRequest. Calling this |
| 158 // method sets m_placeholderImageRequestType to the appropriate value. | 167 // method sets m_placeholderImageRequestType to the appropriate value. |
| 159 void SetAllowImagePlaceholder(); | 168 void SetAllowImagePlaceholder(); |
| 160 | 169 |
| 161 private: | 170 private: |
| 162 ResourceRequest resource_request_; | 171 ResourceRequest resource_request_; |
| 163 String charset_; | 172 String charset_; |
| 164 ResourceLoaderOptions options_; | 173 ResourceLoaderOptions options_; |
| 165 bool speculative_preload_; | 174 SpeculativePreload speculative_preload_; |
| 166 double preload_discovery_time_; | 175 double preload_discovery_time_; |
| 167 DeferOption defer_; | 176 DeferOption defer_; |
| 168 OriginRestriction origin_restriction_; | 177 OriginRestriction origin_restriction_; |
| 169 ResourceWidth resource_width_; | 178 ResourceWidth resource_width_; |
| 170 ClientHintsPreferences client_hint_preferences_; | 179 ClientHintsPreferences client_hint_preferences_; |
| 171 PlaceholderImageRequestType placeholder_image_request_type_; | 180 PlaceholderImageRequestType placeholder_image_request_type_; |
| 172 }; | 181 }; |
| 173 | 182 |
| 174 } // namespace blink | 183 } // namespace blink |
| 175 | 184 |
| 176 #endif | 185 #endif |
| OLD | NEW |