OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "bindings/v8/V8Binding.h" | 34 #include "bindings/v8/V8Binding.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class BlobBuilder; | 38 class BlobBuilder; |
39 | 39 |
40 // Shared code between the custom constructor bindings for Blob and File. | 40 // Shared code between the custom constructor bindings for Blob and File. |
41 namespace V8BlobCustomHelpers { | 41 namespace V8BlobCustomHelpers { |
42 | 42 |
| 43 // Parsed properties from a BlobPropertyBag or a FilePropertyBag. |
| 44 struct ParsedProperties { |
| 45 String contentType; |
| 46 String endings; |
| 47 |
| 48 // False if this contains the properties of a BlobPropertyBag. |
| 49 bool hasFileProperties; |
| 50 |
| 51 private: |
| 52 double m_lastModifiedDate; |
| 53 bool m_hasLastModifiedDate; |
| 54 |
| 55 |
| 56 public: |
| 57 void setLastModifiedDate(double); |
| 58 double lastModifiedDate(); |
| 59 |
| 60 ParsedProperties(bool hasFileProperties); |
| 61 }; |
| 62 |
43 // Extracts the "type" and "endings" properties out of the BlobPropertyBag passe
d to a Blob constructor. | 63 // Extracts the "type" and "endings" properties out of the BlobPropertyBag passe
d to a Blob constructor. |
44 // http://www.w3.org/TR/FileAPI/#constructorParams | 64 // http://www.w3.org/TR/FileAPI/#constructorParams |
45 // Returns true if everything went well, false if a JS exception was thrown. | 65 // Returns true if everything went well, false if a JS exception was thrown. |
46 bool processBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blobCl
assName, String& contentType, String& endings, v8::Isolate*); | 66 bool processBlobPropertyBag(v8::Local<v8::Value> propertyBag, const char* blobCl
assName, ParsedProperties&, v8::Isolate*); |
47 | 67 |
48 // Appends the blobParts passed to a Blob constructor into a BlobBuilder. | 68 // Appends the blobParts passed to a Blob or File constructor into a BlobBuilder
. |
49 // http://www.w3.org/TR/FileAPI/#constructorParams | 69 // http://www.w3.org/TR/FileAPI/#constructorParams |
50 // Returns true if everything went well, false if a JS exception was thrown. | 70 // Returns true if everything went well, false if a JS exception was thrown. |
51 bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength,
const String& endings, BlobBuilder&, v8::Isolate*); | 71 bool processBlobParts(v8::Local<v8::Object> blobParts, uint32_t blobPartsLength,
const String& endings, BlobBuilder&, v8::Isolate*); |
52 | 72 |
53 } // namespace V8BlobCustomHelpers | 73 } // namespace V8BlobCustomHelpers |
54 | 74 |
55 } // namespace WebCore | 75 } // namespace WebCore |
56 | 76 |
57 #endif // V8BlobCustomHelpers_h | 77 #endif // V8BlobCustomHelpers_h |
OLD | NEW |