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