summaryrefslogtreecommitdiffstats
path: root/ppapi/shared_impl/url_request_info_data.cc
blob: bb77a43e2423291981f2215186d85f160edf1254 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ppapi/shared_impl/url_request_info_data.h"

#include "ppapi/shared_impl/resource.h"

namespace ppapi {

namespace {

const int32_t kDefaultPrefetchBufferUpperThreshold = 100 * 1000 * 1000;
const int32_t kDefaultPrefetchBufferLowerThreshold = 50 * 1000 * 1000;

}  // namespace

URLRequestInfoData::BodyItem::BodyItem()
    : is_file(false),
      file_ref_pp_resource(0),
      start_offset(0),
      number_of_bytes(-1),
      expected_last_modified_time(0.0) {}

URLRequestInfoData::BodyItem::BodyItem(const std::string& data)
    : is_file(false),
      data(data),
      file_ref_pp_resource(0),
      start_offset(0),
      number_of_bytes(-1),
      expected_last_modified_time(0.0) {}

URLRequestInfoData::BodyItem::BodyItem(Resource* file_ref,
                                       int64_t start_offset,
                                       int64_t number_of_bytes,
                                       PP_Time expected_last_modified_time)
    : is_file(true),
      file_ref_resource(file_ref),
      file_ref_pp_resource(file_ref->pp_resource()),
      start_offset(start_offset),
      number_of_bytes(number_of_bytes),
      expected_last_modified_time(expected_last_modified_time) {}

URLRequestInfoData::URLRequestInfoData()
    : url(),
      method(),
      headers(),
      stream_to_file(false),
      follow_redirects(true),
      record_download_progress(false),
      record_upload_progress(false),
      has_custom_referrer_url(false),
      custom_referrer_url(),
      allow_cross_origin_requests(false),
      allow_credentials(false),
      has_custom_content_transfer_encoding(false),
      custom_content_transfer_encoding(),
      has_custom_user_agent(false),
      custom_user_agent(),
      prefetch_buffer_upper_threshold(kDefaultPrefetchBufferUpperThreshold),
      prefetch_buffer_lower_threshold(kDefaultPrefetchBufferLowerThreshold),
      body() {}

URLRequestInfoData::~URLRequestInfoData() {}

}  // namespace ppapi