| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_BLOB_BLOB_DATA_H_ | 5 #ifndef WEBKIT_BLOB_BLOB_DATA_H_ |
| 6 #define WEBKIT_BLOB_BLOB_DATA_H_ | 6 #define WEBKIT_BLOB_BLOB_DATA_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "webkit/blob/blob_export.h" |
| 15 #include "webkit/blob/deletable_file_reference.h" | 16 #include "webkit/blob/deletable_file_reference.h" |
| 16 | 17 |
| 17 namespace WebKit { | 18 namespace WebKit { |
| 18 class WebBlobData; | 19 class WebBlobData; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace webkit_blob { | 22 namespace webkit_blob { |
| 22 | 23 |
| 23 class BlobData : public base::RefCounted<BlobData> { | 24 class BLOB_EXPORT BlobData : public base::RefCounted<BlobData> { |
| 24 public: | 25 public: |
| 25 enum Type { | 26 enum Type { |
| 26 TYPE_DATA, | 27 TYPE_DATA, |
| 27 TYPE_DATA_EXTERNAL, | 28 TYPE_DATA_EXTERNAL, |
| 28 TYPE_FILE, | 29 TYPE_FILE, |
| 29 TYPE_BLOB | 30 TYPE_BLOB |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 struct Item { | 33 struct BLOB_EXPORT Item { |
| 33 Item(); | 34 Item(); |
| 34 ~Item(); | 35 ~Item(); |
| 35 | 36 |
| 36 void SetToData(const std::string& data) { | 37 void SetToData(const std::string& data) { |
| 37 SetToData(data.c_str(), data.size()); | 38 SetToData(data.c_str(), data.size()); |
| 38 } | 39 } |
| 39 | 40 |
| 40 void SetToData(const char* data, size_t length) { | 41 void SetToData(const char* data, size_t length) { |
| 41 type = TYPE_DATA; | 42 type = TYPE_DATA; |
| 42 this->data.assign(data, length); | 43 this->data.assign(data, length); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 187 } |
| 187 | 188 |
| 188 inline bool operator!=(const BlobData& a, const BlobData& b) { | 189 inline bool operator!=(const BlobData& a, const BlobData& b) { |
| 189 return !(a == b); | 190 return !(a == b); |
| 190 } | 191 } |
| 191 #endif // defined(UNIT_TEST) | 192 #endif // defined(UNIT_TEST) |
| 192 | 193 |
| 193 } // namespace webkit_blob | 194 } // namespace webkit_blob |
| 194 | 195 |
| 195 #endif // WEBKIT_BLOB_BLOB_DATA_H_ | 196 #endif // WEBKIT_BLOB_BLOB_DATA_H_ |
| OLD | NEW |