1 // Copyright (c) 2012 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.
5 #ifndef PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_
6 #define PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_
11 #include "base/memory/ref_counted.h"
12 #include "ppapi/c/pp_stdint.h"
13 #include "ppapi/c/pp_time.h"
14 #include "ppapi/shared_impl/host_resource.h"
15 #include "ppapi/shared_impl/ppapi_shared_export.h"
21 struct PPAPI_SHARED_EXPORT URLRequestInfoData
{
22 struct PPAPI_SHARED_EXPORT BodyItem
{
24 explicit BodyItem(const std::string
& data
);
25 BodyItem(Resource
* file_ref
,
27 int64_t number_of_bytes
,
28 PP_Time expected_last_modified_time
);
30 // Set if the input is a file, false means the |data| is valid.
35 // Is is_file is set, these variables are set. Note that the resource
36 // may still be NULL in some cases, such as deserialization errors.
38 // This is a bit tricky. In the plugin side of the proxy, both the file ref
39 // and the file_ref_host_resource will be set and valid. The scoped_refptr
40 // ensures that the resource is alive for as long as the BodyItem is.
42 // When we deserialize this in the renderer, only the
43 // file_ref_host_resource's are serialized over IPC. The file_refs won't be
44 // valid until the host resources are converted to Resource pointers in the
45 // PPB_URLRequestInfo_Impl.
46 scoped_refptr
<Resource
> file_ref
;
47 HostResource file_ref_host_resource
;
50 int64_t number_of_bytes
;
51 PP_Time expected_last_modified_time
;
53 // If you add more stuff here, be sure to modify the serialization rules in
58 ~URLRequestInfoData();
65 bool follow_redirects
;
66 bool record_download_progress
;
67 bool record_upload_progress
;
69 // |has_custom_referrer_url| is set to false if a custom referrer hasn't been
70 // set (or has been set to an Undefined Var) and the default referrer should
71 // be used. (Setting the custom referrer to an empty string indicates that no
72 // referrer header should be generated.)
73 bool has_custom_referrer_url
;
74 std::string custom_referrer_url
;
76 bool allow_cross_origin_requests
;
77 bool allow_credentials
;
79 // Similar to the custom referrer (above), but for custom content transfer
80 // encoding and custom user agent, respectively.
81 bool has_custom_content_transfer_encoding
;
82 std::string custom_content_transfer_encoding
;
83 bool has_custom_user_agent
;
84 std::string custom_user_agent
;
86 int32_t prefetch_buffer_upper_threshold
;
87 int32_t prefetch_buffer_lower_threshold
;
89 std::vector
<BodyItem
> body
;
91 // If you add more stuff here, be sure to modify the serialization rules in
97 #endif // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_