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 #include "ppapi/shared_impl/url_request_info_data.h"
6
7 #include "ppapi/shared_impl/resource.h"
8
9 namespace ppapi {
10
11 namespace {
12
13 const int32_t kDefaultPrefetchBufferUpperThreshold = 100 * 1000 * 1000;
14 const int32_t kDefaultPrefetchBufferLowerThreshold = 50 * 1000 * 1000;
15
16 } // namespace
17
BodyItem()18 URLRequestInfoData::BodyItem::BodyItem()
19 : is_file(false),
20 file_ref_pp_resource(0),
21 start_offset(0),
22 number_of_bytes(-1),
23 expected_last_modified_time(0.0) {}
24
BodyItem(const std::string & data)25 URLRequestInfoData::BodyItem::BodyItem(const std::string& data)
26 : is_file(false),
27 data(data),
28 file_ref_pp_resource(0),
29 start_offset(0),
30 number_of_bytes(-1),
31 expected_last_modified_time(0.0) {}
32
BodyItem(Resource * file_ref,int64_t start_offset,int64_t number_of_bytes,PP_Time expected_last_modified_time)33 URLRequestInfoData::BodyItem::BodyItem(Resource* file_ref,
34 int64_t start_offset,
35 int64_t number_of_bytes,
36 PP_Time expected_last_modified_time)
37 : is_file(true),
38 file_ref_resource(file_ref),
39 file_ref_pp_resource(file_ref->pp_resource()),
40 start_offset(start_offset),
41 number_of_bytes(number_of_bytes),
42 expected_last_modified_time(expected_last_modified_time) {}
43
URLRequestInfoData()44 URLRequestInfoData::URLRequestInfoData()
45 : url(),
46 method(),
47 headers(),
48 stream_to_file(false),
49 follow_redirects(true),
50 record_download_progress(false),
51 record_upload_progress(false),
52 has_custom_referrer_url(false),
53 custom_referrer_url(),
54 allow_cross_origin_requests(false),
55 allow_credentials(false),
56 has_custom_content_transfer_encoding(false),
57 custom_content_transfer_encoding(),
58 has_custom_user_agent(false),
59 custom_user_agent(),
60 prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold),
61 prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold),
62 body() {}
63
~URLRequestInfoData()64 URLRequestInfoData::~URLRequestInfoData() {}
65
66 } // namespace ppapi
67