Index: net/base/upload_data.h |
=================================================================== |
--- net/base/upload_data.h (revision 42417) |
+++ net/base/upload_data.h (working copy) |
@@ -10,6 +10,7 @@ |
#include "base/basictypes.h" |
#include "base/file_path.h" |
#include "base/ref_counted.h" |
+#include "base/time.h" |
#include "testing/gtest/include/gtest/gtest_prod.h" |
namespace net { |
@@ -35,6 +36,10 @@ |
const FilePath& file_path() const { return file_path_; } |
uint64 file_range_offset() const { return file_range_offset_; } |
uint64 file_range_length() const { return file_range_length_; } |
+ // If NULL time is returned, we do not do the check. |
+ const base::Time& expected_file_modification_time() const { |
+ return expected_file_modification_time_; |
+ } |
void SetToBytes(const char* bytes, int bytes_len) { |
type_ = TYPE_BYTES; |
@@ -42,15 +47,20 @@ |
} |
void SetToFilePath(const FilePath& path) { |
- SetToFilePathRange(path, 0, kuint64max); |
+ SetToFilePathRange(path, 0, kuint64max, base::Time()); |
} |
+ // If expected_modification_time is NULL, we do not check for the file |
+ // change. Also note that the granularity for comparison is time_t, not |
+ // the full precision. |
void SetToFilePathRange(const FilePath& path, |
- uint64 offset, uint64 length) { |
+ uint64 offset, uint64 length, |
+ const base::Time& expected_modification_time) { |
type_ = TYPE_FILE; |
file_path_ = path; |
file_range_offset_ = offset; |
file_range_length_ = length; |
+ expected_file_modification_time_ = expected_modification_time; |
} |
// Returns the byte-length of the element. For files that do not exist, 0 |
@@ -69,6 +79,7 @@ |
FilePath file_path_; |
uint64 file_range_offset_; |
uint64 file_range_length_; |
+ base::Time expected_file_modification_time_; |
bool override_content_length_; |
uint64 content_length_; |
@@ -89,9 +100,11 @@ |
} |
void AppendFileRange(const FilePath& file_path, |
- uint64 offset, uint64 length) { |
+ uint64 offset, uint64 length, |
+ const base::Time& expected_modification_time) { |
elements_.push_back(Element()); |
- elements_.back().SetToFilePathRange(file_path, offset, length); |
+ elements_.back().SetToFilePathRange(file_path, offset, length, |
+ expected_modification_time); |
} |
// Returns the total size in bytes of the data to upload. |