| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_RESOURCE_REQUEST_H_ |
| 6 #define CONTENT_COMMON_RESOURCE_REQUEST_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/common/content_export.h" |
| 13 #include "content/common/navigation_params.h" |
| 14 #include "content/common/resource_request_body.h" |
| 15 #include "content/common/service_worker/service_worker_types.h" |
| 16 #include "content/public/common/appcache_info.h" |
| 17 #include "content/public/common/request_context_frame_type.h" |
| 18 #include "content/public/common/request_context_type.h" |
| 19 #include "content/public/common/resource_type.h" |
| 20 #include "net/base/request_priority.h" |
| 21 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
| 22 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 23 #include "ui/base/page_transition_types.h" |
| 24 #include "url/gurl.h" |
| 25 #include "url/origin.h" |
| 26 |
| 27 namespace content { |
| 28 |
| 29 struct CONTENT_EXPORT ResourceRequest { |
| 30 ResourceRequest(); |
| 31 ResourceRequest(const ResourceRequest& request); |
| 32 ~ResourceRequest(); |
| 33 |
| 34 // The request method: GET, POST, etc. |
| 35 std::string method; |
| 36 |
| 37 // The requested URL. |
| 38 GURL url; |
| 39 |
| 40 // Usually the URL of the document in the top-level window, which may be |
| 41 // checked by the third-party cookie blocking policy. Leaving it empty may |
| 42 // lead to undesired cookie blocking. Third-party cookie blocking can be |
| 43 // bypassed by setting first_party_for_cookies = url, but this should ideally |
| 44 // only be done if there really is no way to determine the correct value. |
| 45 GURL first_party_for_cookies; |
| 46 |
| 47 // The origin of the context which initiated the request, which will be used |
| 48 // for cookie checks like 'First-Party-Only'. |
| 49 url::Origin request_initiator; |
| 50 |
| 51 // The referrer to use (may be empty). |
| 52 GURL referrer; |
| 53 |
| 54 // The referrer policy to use. |
| 55 blink::WebReferrerPolicy referrer_policy = blink::WebReferrerPolicyAlways; |
| 56 |
| 57 // The frame's visiblity state. |
| 58 blink::WebPageVisibilityState visiblity_state = |
| 59 blink::WebPageVisibilityStateVisible; |
| 60 |
| 61 // Additional HTTP request headers. |
| 62 std::string headers; |
| 63 |
| 64 // net::URLRequest load flags (0 by default). |
| 65 int load_flags = 0; |
| 66 |
| 67 // Process ID from which this request originated, or zero if it originated |
| 68 // in the renderer itself. |
| 69 int origin_pid = 0; |
| 70 |
| 71 // What this resource load is for (main frame, sub-frame, sub-resource, |
| 72 // object). |
| 73 ResourceType resource_type = RESOURCE_TYPE_MAIN_FRAME; |
| 74 |
| 75 // The priority of this request. |
| 76 net::RequestPriority priority = net::IDLE; |
| 77 |
| 78 // Used by plugin->browser requests to get the correct net::URLRequestContext. |
| 79 uint32_t request_context = 0; |
| 80 |
| 81 // Indicates which frame (or worker context) the request is being loaded into, |
| 82 // or kAppCacheNoHostId. |
| 83 int appcache_host_id = kAppCacheNoHostId; |
| 84 |
| 85 // True if corresponding AppCache group should be resetted. |
| 86 bool should_reset_appcache = false; |
| 87 |
| 88 // Indicates which frame (or worker context) the request is being loaded into, |
| 89 // or kInvalidServiceWorkerProviderId. |
| 90 int service_worker_provider_id = kInvalidServiceWorkerProviderId; |
| 91 |
| 92 // True if the request originated from a Service Worker, e.g. due to a |
| 93 // fetch() in the Service Worker script. |
| 94 bool originated_from_service_worker = false; |
| 95 |
| 96 // True if the request should not be handled by the ServiceWorker. |
| 97 bool skip_service_worker = false; |
| 98 |
| 99 // The request mode passed to the ServiceWorker. |
| 100 FetchRequestMode fetch_request_mode = FETCH_REQUEST_MODE_SAME_ORIGIN; |
| 101 |
| 102 // The credentials mode passed to the ServiceWorker. |
| 103 FetchCredentialsMode fetch_credentials_mode = FETCH_CREDENTIALS_MODE_OMIT; |
| 104 |
| 105 // The redirect mode used in Fetch API. |
| 106 FetchRedirectMode fetch_redirect_mode = FetchRedirectMode::FOLLOW_MODE; |
| 107 |
| 108 // The request context passed to the ServiceWorker. |
| 109 RequestContextType fetch_request_context_type = |
| 110 REQUEST_CONTEXT_TYPE_UNSPECIFIED; |
| 111 |
| 112 // The frame type passed to the ServiceWorker. |
| 113 RequestContextFrameType fetch_frame_type = |
| 114 REQUEST_CONTEXT_FRAME_TYPE_AUXILIARY; |
| 115 |
| 116 // Optional resource request body (may be null). |
| 117 scoped_refptr<ResourceRequestBody> request_body; |
| 118 |
| 119 bool download_to_file = false; |
| 120 |
| 121 // True if the request was user initiated. |
| 122 bool has_user_gesture = false; |
| 123 |
| 124 // True if load timing data should be collected for request. |
| 125 bool enable_load_timing = false; |
| 126 |
| 127 // True if upload progress should be available for request. |
| 128 bool enable_upload_progress = false; |
| 129 |
| 130 // True if login prompts for this request should be supressed. |
| 131 bool do_not_prompt_for_login = false; |
| 132 |
| 133 // The routing id of the RenderFrame. |
| 134 int render_frame_id = 0; |
| 135 |
| 136 // True if |frame_id| is the main frame of a RenderView. |
| 137 bool is_main_frame = false; |
| 138 |
| 139 // True if |parent_render_frame_id| is the main frame of a RenderView. |
| 140 bool parent_is_main_frame = false; |
| 141 |
| 142 // Identifies the parent frame of the frame that sent the request. |
| 143 // -1 if unknown / invalid. |
| 144 int parent_render_frame_id = -1; |
| 145 |
| 146 ui::PageTransition transition_type = ui::PAGE_TRANSITION_LINK; |
| 147 |
| 148 // For navigations, whether this navigation should replace the current session |
| 149 // history entry on commit. |
| 150 bool should_replace_current_entry = false; |
| 151 |
| 152 // The following two members identify a previous request that has been |
| 153 // created before this navigation has been transferred to a new render view. |
| 154 // This serves the purpose of recycling the old request. |
| 155 // Unless this refers to a transferred navigation, these values are -1 and -1. |
| 156 int transferred_request_child_id = -1; |
| 157 int transferred_request_request_id = -1; |
| 158 |
| 159 // Whether or not we should allow the URL to download. |
| 160 bool allow_download = false; |
| 161 |
| 162 // Whether to intercept headers to pass back to the renderer. |
| 163 bool report_raw_headers = false; |
| 164 |
| 165 // Whether or not to request a LoFi version of the resource or let the browser |
| 166 // decide. |
| 167 LoFiState lofi_state = LOFI_UNSPECIFIED; |
| 168 |
| 169 // PlzNavigate: the stream url associated with a navigation. Used to get |
| 170 // access to the body of the response that has already been fetched by the |
| 171 // browser. |
| 172 GURL resource_body_stream_url; |
| 173 }; |
| 174 |
| 175 } // namespace content |
| 176 |
| 177 #endif // CONTENT_COMMON_RESOURCE_REQUEST_H_ |
| OLD | NEW |