1// Copyright 2014 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_CHILD_REQUEST_INFO_H_
6#define CONTENT_CHILD_REQUEST_INFO_H_
7
8#include <stdint.h>
9
10#include <string>
11
12#include "content/common/content_export.h"
13#include "content/public/common/resource_type.h"
14#include "net/base/request_priority.h"
15#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
16#include "third_party/WebKit/public/platform/WebURLRequest.h"
17#include "url/gurl.h"
18
19namespace content {
20
21// Structure used when calling BlinkPlatformImpl::CreateResourceLoader().
22struct CONTENT_EXPORT RequestInfo {
23  RequestInfo();
24  ~RequestInfo();
25
26  // HTTP-style method name (e.g., "GET" or "POST").
27  std::string method;
28
29  // Absolute URL encoded in ASCII per the rules of RFC-2396.
30  GURL url;
31
32  // URL of the document in the top-level window, which may be checked by the
33  // third-party cookie blocking policy.
34  GURL first_party_for_cookies;
35
36  // Optional parameter, a URL with similar constraints in how it must be
37  // encoded as the url member.
38  GURL referrer;
39
40  // The referrer policy that applies to the referrer.
41  blink::WebReferrerPolicy referrer_policy;
42
43  // For HTTP(S) requests, the headers parameter can be a \r\n-delimited and
44  // \r\n-terminated list of MIME headers.  They should be ASCII-encoded using
45  // the standard MIME header encoding rules.  The headers parameter can also
46  // be null if no extra request headers need to be set.
47  std::string headers;
48
49  // Composed of the values defined in url_request_load_flags.h.
50  int load_flags;
51
52  // Process id of the process making the request.
53  int requestor_pid;
54
55  // Indicates if the current request is the main frame load, a sub-frame
56  // load, or a sub objects load.
57  ResourceType request_type;
58
59  // Indicates the priority of this request, as determined by WebKit.
60  net::RequestPriority priority;
61
62  // Used for plugin to browser requests.
63  uint32_t request_context;
64
65  // Identifies what appcache host this request is associated with.
66  int appcache_host_id;
67
68  // Used to associated the bridge with a frame's network context.
69  int routing_id;
70
71  // If true, then the response body will be downloaded to a file and the
72  // path to that file will be provided in ResponseInfo::download_file_path.
73  bool download_to_file;
74
75  // True if the request was user initiated.
76  bool has_user_gesture;
77
78  // True if the request should not be handled by the ServiceWorker.
79  bool skip_service_worker;
80
81  // TODO(mmenke): Investigate if enable_load_timing is safe to remove.
82  // True if load timing data should be collected for the request.
83  bool enable_load_timing;
84
85  // Extra data associated with this request.  We do not own this pointer.
86  blink::WebURLRequest::ExtraData* extra_data;
87
88 private:
89  DISALLOW_COPY_AND_ASSIGN(RequestInfo);
90};
91
92}  // namespace content
93
94#endif  // CONTENT_CHILD_REQUEST_INFO_H_
95