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