OLD | NEW |
| (Empty) |
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 "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" | |
6 | |
7 #include "base/string_number_conversions.h" | |
8 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" | |
9 | |
10 namespace gdata { | |
11 | |
12 UploadFileInfo::UploadFileInfo() | |
13 : upload_id(-1), | |
14 file_size(0), | |
15 content_length(0), | |
16 upload_mode(UPLOAD_INVALID), | |
17 file_stream(NULL), | |
18 buf_len(0), | |
19 start_range(0), | |
20 end_range(-1), | |
21 all_bytes_present(false), | |
22 upload_paused(false), | |
23 should_retry_file_open(false), | |
24 num_file_open_tries(0) { | |
25 } | |
26 | |
27 UploadFileInfo::~UploadFileInfo() { | |
28 // The file stream is closed by the destructor asynchronously. | |
29 if (file_stream) { | |
30 delete file_stream; | |
31 file_stream = NULL; | |
32 } | |
33 } | |
34 | |
35 int64 UploadFileInfo::SizeRemaining() const { | |
36 DCHECK(file_size > end_range); | |
37 // Note that uploaded_bytes = end_range + 1; | |
38 return file_size - end_range - 1; | |
39 } | |
40 | |
41 std::string UploadFileInfo::DebugString() const { | |
42 return "title=[" + title + | |
43 "], file_path=[" + file_path.value() + | |
44 "], content_type=[" + content_type + | |
45 "], file_size=[" + base::UintToString(file_size) + | |
46 "], gdata_path=[" + gdata_path.value() + | |
47 "]"; | |
48 } | |
49 | |
50 } // namespace gdata | |
OLD | NEW |