Chromium Code Reviews| 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 // If kDirectNPAPIRequests isn't specified, then plugin requests get routed | |
|
dcheng
2016/05/17 02:26:01
Nit: remove this part of the comment, we don't hav
yhirano
2016/05/17 12:44:22
Done.
| |
| 70 // through the renderer and and this holds the pid of the plugin process. | |
| 71 // Otherwise this holds the render_process_id of the view that has the plugin. | |
| 72 int origin_pid = 0; | |
| 73 | |
| 74 // What this resource load is for (main frame, sub-frame, sub-resource, | |
| 75 // object). | |
| 76 ResourceType resource_type = RESOURCE_TYPE_MAIN_FRAME; | |
| 77 | |
| 78 // The priority of this request. | |
| 79 net::RequestPriority priority = net::IDLE; | |
| 80 | |
| 81 // Used by plugin->browser requests to get the correct net::URLRequestContext. | |
| 82 uint32_t request_context = 0; | |
| 83 | |
| 84 // Indicates which frame (or worker context) the request is being loaded into, | |
| 85 // or kAppCacheNoHostId. | |
| 86 int appcache_host_id = kAppCacheNoHostId; | |
| 87 | |
| 88 // True if corresponding AppCache group should be resetted. | |
| 89 bool should_reset_appcache = false; | |
| 90 | |
| 91 // Indicates which frame (or worker context) the request is being loaded into, | |
| 92 // or kInvalidServiceWorkerProviderId. | |
| 93 int service_worker_provider_id = kInvalidServiceWorkerProviderId; | |
| 94 | |
| 95 // True if the request originated from a Service Worker, e.g. due to a | |
| 96 // fetch() in the Service Worker script. | |
| 97 bool originated_from_service_worker = false; | |
| 98 | |
| 99 // True if the request should not be handled by the ServiceWorker. | |
| 100 bool skip_service_worker = false; | |
| 101 | |
| 102 // The request mode passed to the ServiceWorker. | |
| 103 FetchRequestMode fetch_request_mode = FETCH_REQUEST_MODE_SAME_ORIGIN; | |
| 104 | |
| 105 // The credentials mode passed to the ServiceWorker. | |
| 106 FetchCredentialsMode fetch_credentials_mode = FETCH_CREDENTIALS_MODE_OMIT; | |
| 107 | |
| 108 // The redirect mode used in Fetch API. | |
| 109 FetchRedirectMode fetch_redirect_mode = FetchRedirectMode::FOLLOW_MODE; | |
| 110 | |
| 111 // The request context passed to the ServiceWorker. | |
| 112 RequestContextType fetch_request_context_type = | |
| 113 REQUEST_CONTEXT_TYPE_UNSPECIFIED; | |
| 114 | |
| 115 // The frame type passed to the ServiceWorker. | |
| 116 RequestContextFrameType fetch_frame_type = | |
| 117 REQUEST_CONTEXT_FRAME_TYPE_AUXILIARY; | |
| 118 | |
| 119 // Optional resource request body (may be null). | |
| 120 scoped_refptr<ResourceRequestBody> request_body; | |
| 121 | |
| 122 bool download_to_file = false; | |
| 123 | |
| 124 // True if the request was user initiated. | |
| 125 bool has_user_gesture = false; | |
| 126 | |
| 127 // True if load timing data should be collected for request. | |
| 128 bool enable_load_timing = false; | |
| 129 | |
| 130 // True if upload progress should be available for request. | |
| 131 bool enable_upload_progress = false; | |
| 132 | |
| 133 // True if login prompts for this request should be supressed. | |
| 134 bool do_not_prompt_for_login = false; | |
| 135 | |
| 136 // The routing id of the RenderFrame. | |
| 137 int render_frame_id = 0; | |
| 138 | |
| 139 // True if |frame_id| is the main frame of a RenderView. | |
| 140 bool is_main_frame = false; | |
| 141 | |
| 142 // True if |parent_render_frame_id| is the main frame of a RenderView. | |
| 143 bool parent_is_main_frame = false; | |
| 144 | |
| 145 // Identifies the parent frame of the frame that sent the request. | |
| 146 // -1 if unknown / invalid. | |
| 147 int parent_render_frame_id = -1; | |
| 148 | |
| 149 ui::PageTransition transition_type = ui::PAGE_TRANSITION_LINK; | |
| 150 | |
| 151 // For navigations, whether this navigation should replace the current session | |
| 152 // history entry on commit. | |
| 153 bool should_replace_current_entry = false; | |
| 154 | |
| 155 // The following two members identify a previous request that has been | |
| 156 // created before this navigation has been transferred to a new render view. | |
| 157 // This serves the purpose of recycling the old request. | |
| 158 // Unless this refers to a transferred navigation, these values are -1 and -1. | |
| 159 int transferred_request_child_id = -1; | |
| 160 int transferred_request_request_id = -1; | |
| 161 | |
| 162 // Whether or not we should allow the URL to download. | |
| 163 bool allow_download = false; | |
| 164 | |
| 165 // Whether to intercept headers to pass back to the renderer. | |
| 166 bool report_raw_headers = false; | |
| 167 | |
| 168 // Whether or not to request a LoFi version of the resource or let the browser | |
| 169 // decide. | |
| 170 LoFiState lofi_state = LOFI_UNSPECIFIED; | |
| 171 | |
| 172 // PlzNavigate: the stream url associated with a navigation. Used to get | |
| 173 // access to the body of the response that has already been fetched by the | |
| 174 // browser. | |
| 175 GURL resource_body_stream_url; | |
| 176 }; | |
| 177 | |
| 178 } // namespace content | |
| 179 | |
| 180 #endif // CONTENT_COMMON_RESOURCE_REQUEST_H_ | |
| OLD | NEW |