| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef STORAGE_COMMON_DATA_ELEMENT_H_ | 5 #ifndef STORAGE_COMMON_DATA_ELEMENT_H_ |
| 6 #define STORAGE_COMMON_DATA_ELEMENT_H_ | 6 #define STORAGE_COMMON_DATA_ELEMENT_H_ |
| 7 | 7 |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "storage/common/storage_common_export.h" | 17 #include "storage/common/storage_common_export.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 namespace storage { | 20 namespace storage { |
| 20 | 21 |
| 21 // Represents a base Web data element. This could be either one of | 22 // Represents a base Web data element. This could be either one of |
| 22 // bytes, file or blob data. | 23 // bytes, file or blob data. |
| 23 class STORAGE_COMMON_EXPORT DataElement { | 24 class STORAGE_COMMON_EXPORT DataElement { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 125 |
| 125 // Sets TYPE_FILE_FILESYSTEM with range. | 126 // Sets TYPE_FILE_FILESYSTEM with range. |
| 126 void SetToFileSystemUrlRange(const GURL& filesystem_url, | 127 void SetToFileSystemUrlRange(const GURL& filesystem_url, |
| 127 uint64 offset, uint64 length, | 128 uint64 offset, uint64 length, |
| 128 const base::Time& expected_modification_time); | 129 const base::Time& expected_modification_time); |
| 129 | 130 |
| 130 // Sets to TYPE_DISK_CACHE_ENTRY with range. | 131 // Sets to TYPE_DISK_CACHE_ENTRY with range. |
| 131 void SetToDiskCacheEntryRange(uint64 offset, uint64 length); | 132 void SetToDiskCacheEntryRange(uint64 offset, uint64 length); |
| 132 | 133 |
| 133 private: | 134 private: |
| 135 FRIEND_TEST_ALL_PREFIXES(BlobAsyncTransportStrategyTest, TestInvalidParams); |
| 134 friend STORAGE_COMMON_EXPORT void PrintTo(const DataElement& x, | 136 friend STORAGE_COMMON_EXPORT void PrintTo(const DataElement& x, |
| 135 ::std::ostream* os); | 137 ::std::ostream* os); |
| 136 Type type_; | 138 Type type_; |
| 137 std::vector<char> buf_; // For TYPE_BYTES. | 139 std::vector<char> buf_; // For TYPE_BYTES. |
| 138 const char* bytes_; // For TYPE_BYTES. | 140 const char* bytes_; // For TYPE_BYTES. |
| 139 base::FilePath path_; // For TYPE_FILE. | 141 base::FilePath path_; // For TYPE_FILE. |
| 140 GURL filesystem_url_; // For TYPE_FILE_FILESYSTEM. | 142 GURL filesystem_url_; // For TYPE_FILE_FILESYSTEM. |
| 141 std::string blob_uuid_; | 143 std::string blob_uuid_; |
| 142 uint64 offset_; | 144 uint64 offset_; |
| 143 uint64 length_; | 145 uint64 length_; |
| 144 base::Time expected_modification_time_; | 146 base::Time expected_modification_time_; |
| 145 }; | 147 }; |
| 146 | 148 |
| 147 STORAGE_COMMON_EXPORT bool operator==(const DataElement& a, | 149 STORAGE_COMMON_EXPORT bool operator==(const DataElement& a, |
| 148 const DataElement& b); | 150 const DataElement& b); |
| 149 STORAGE_COMMON_EXPORT bool operator!=(const DataElement& a, | 151 STORAGE_COMMON_EXPORT bool operator!=(const DataElement& a, |
| 150 const DataElement& b); | 152 const DataElement& b); |
| 151 | 153 |
| 152 } // namespace storage | 154 } // namespace storage |
| 153 | 155 |
| 154 #endif // STORAGE_COMMON_DATA_ELEMENT_H_ | 156 #endif // STORAGE_COMMON_DATA_ELEMENT_H_ |
| OLD | NEW |