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 "net/base/upload_data.h"
6
7#include "base/logging.h"
8
9namespace net {
10
11UploadData::UploadData()
12    : identifier_(0),
13      is_chunked_(false),
14      last_chunk_appended_(false) {
15}
16
17void UploadData::AppendBytes(const char* bytes, int bytes_len) {
18  DCHECK(!is_chunked_);
19  if (bytes_len > 0) {
20    elements_.push_back(new UploadElement());
21    elements_.back()->SetToBytes(bytes, bytes_len);
22  }
23}
24
25void UploadData::AppendFileRange(const base::FilePath& file_path,
26                                 uint64 offset, uint64 length,
27                                 const base::Time& expected_modification_time) {
28  DCHECK(!is_chunked_);
29  elements_.push_back(new UploadElement());
30  elements_.back()->SetToFilePathRange(file_path, offset, length,
31                                       expected_modification_time);
32}
33
34UploadData::~UploadData() {
35}
36
37}  // namespace net
38