- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / shared_impl / url_request_info_data.h
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.
4
5 #ifndef PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_
6 #define PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/ref_counted.h"
12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_stdint.h"
14 #include "ppapi/c/pp_time.h"
15 #include "ppapi/shared_impl/ppapi_globals.h"
16 #include "ppapi/shared_impl/ppapi_shared_export.h"
17 #include "ppapi/shared_impl/resource_tracker.h"
18
19 namespace ppapi {
20
21 class Resource;
22
23 struct PPAPI_SHARED_EXPORT URLRequestInfoData {
24   struct PPAPI_SHARED_EXPORT BodyItem {
25     BodyItem();
26     explicit BodyItem(const std::string& data);
27     BodyItem(Resource* file_ref,
28              int64_t start_offset,
29              int64_t number_of_bytes,
30              PP_Time expected_last_modified_time);
31
32     // Set if the input is a file, false means the |data| is valid.
33     bool is_file;
34
35     std::string data;
36
37     // Only set on the plugin-side, for refcounting purposes. Only valid when
38     // |is_file| is set.
39     scoped_refptr<Resource> file_ref_resource;
40     // This struct holds no ref to this resource. Only valid when |is_file| is
41     // set.
42     PP_Resource file_ref_pp_resource;
43
44     int64_t start_offset;
45     int64_t number_of_bytes;
46     PP_Time expected_last_modified_time;
47
48     // If you add more stuff here, be sure to modify the serialization rules in
49     // ppapi_messages.h
50   };
51
52   URLRequestInfoData();
53   ~URLRequestInfoData();
54
55   std::string url;
56   std::string method;
57   std::string headers;
58
59   bool stream_to_file;
60   bool follow_redirects;
61   bool record_download_progress;
62   bool record_upload_progress;
63
64   // |has_custom_referrer_url| is set to false if a custom referrer hasn't been
65   // set (or has been set to an Undefined Var) and the default referrer should
66   // be used. (Setting the custom referrer to an empty string indicates that no
67   // referrer header should be generated.)
68   bool has_custom_referrer_url;
69   std::string custom_referrer_url;
70
71   bool allow_cross_origin_requests;
72   bool allow_credentials;
73
74   // Similar to the custom referrer (above), but for custom content transfer
75   // encoding and custom user agent, respectively.
76   bool has_custom_content_transfer_encoding;
77   std::string custom_content_transfer_encoding;
78   bool has_custom_user_agent;
79   std::string custom_user_agent;
80
81   int32_t prefetch_buffer_upper_threshold;
82   int32_t prefetch_buffer_lower_threshold;
83
84   std::vector<BodyItem> body;
85
86   // If you add more stuff here, be sure to modify the serialization rules in
87   // ppapi_messages.h
88 };
89
90 }  // namespace ppapi
91
92 #endif  // PPAPI_SHARED_IMPL_URL_REQUEST_INFO_DATA_H_