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
|
// 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 "chrome/browser/chromeos/gdata/gdata_upload_file_info.h"
#include "base/string_number_conversions.h"
#include "chrome/browser/chromeos/gdata/gdata_parser.h"
namespace gdata {
UploadFileInfo::UploadFileInfo()
: upload_id(-1),
file_size(0),
content_length(0),
upload_mode(UPLOAD_INVALID),
file_stream(NULL),
buf_len(0),
start_range(0),
end_range(-1),
all_bytes_present(false),
upload_paused(false),
should_retry_file_open(false),
num_file_open_tries(0) {
}
UploadFileInfo::~UploadFileInfo() {
// The file stream is closed by the destructor asynchronously.
if (file_stream) {
delete file_stream;
file_stream = NULL;
}
}
int64 UploadFileInfo::SizeRemaining() const {
DCHECK(file_size > end_range);
// Note that uploaded_bytes = end_range + 1;
return file_size - end_range - 1;
}
std::string UploadFileInfo::DebugString() const {
return "title=[" + title +
"], file_path=[" + file_path.value() +
"], content_type=[" + content_type +
"], file_size=[" + base::UintToString(file_size) +
"], gdata_path=[" + gdata_path.value() +
"]";
}
} // namespace gdata
|