193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)/* 293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Copyright (C) 2010 Google Inc. All rights reserved. 393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * modification, are permitted provided that the following conditions are 693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * met: 793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * * Redistributions of source code must retain the above copyright 993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 1093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * * Redistributions in binary form must reproduce the above 1193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 1293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * in the documentation and/or other materials provided with the 1393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * distribution. 1493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 1593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * contributors may be used to endorse or promote products derived from 1693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * this software without specific prior written permission. 1793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * 1893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) */ 3093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 3193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#ifndef WebBlobData_h 3293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#define WebBlobData_h 3393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 34bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "WebNonCopyable.h" 35bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "WebPrivateOwnPtr.h" 3693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebString.h" 3793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebThreadSafeData.h" 3893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#include "WebURL.h" 3993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 40bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#if INSIDE_BLINK 4193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)namespace WTF { template <typename T> class PassOwnPtr; } 4293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif 4393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 4451b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink { 4593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 46e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class BlobData; 47e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) 48bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)class WebBlobData : public WebNonCopyable { 4993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)public: 5093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) struct Item { 511e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) enum { TypeData, TypeFile, TypeBlob, TypeFileSystemURL } type; 5293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) WebThreadSafeData data; 531e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) WebString blobUUID; 5493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) WebString filePath; 558abfc5808a4e34d6e03867af8bc440dee641886fTorne (Richard Coles) WebURL fileSystemURL; 5693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) long long offset; 5793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) long long length; // -1 means go to the end of the file/blob. 5893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) double expectedModificationTime; // 0.0 means that the time is not set. 5993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) }; 6093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 61bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) BLINK_PLATFORM_EXPORT WebBlobData(); 62bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) BLINK_PLATFORM_EXPORT ~WebBlobData(); 6393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 64bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) bool isNull() const { return !m_private.get(); } 6593ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 6693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) // Returns the number of items. 67bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) BLINK_PLATFORM_EXPORT size_t itemCount() const; 6893ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 6993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) // Retrieves the values of the item at the given index. Returns false if 7093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) // index is out of bounds. 71bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) BLINK_PLATFORM_EXPORT bool itemAt(size_t index, Item& result) const; 7293ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 73bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) BLINK_PLATFORM_EXPORT WebString contentType() const; 7493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 75bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#if INSIDE_BLINK 76e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) BLINK_PLATFORM_EXPORT WebBlobData(const WTF::PassOwnPtr<BlobData>&); 77e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) BLINK_PLATFORM_EXPORT WebBlobData& operator=(const WTF::PassOwnPtr<BlobData>&); 78e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) BLINK_PLATFORM_EXPORT operator WTF::PassOwnPtr<BlobData>(); 7993ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif 8093ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8193ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)private: 82e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) WebPrivateOwnPtr<BlobData> m_private; 8393ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)}; 8493ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8551b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink 8693ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles) 8793ac45cfc74041c8ae536ce58a9534d46db2024eTorne (Richard Coles)#endif // WebBlobData_h 88