15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* 2926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * Copyright (C) 2013 Google Inc. All rights reserved. 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions are 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * met: 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * * Redistributions of source code must retain the above copyright 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * * Redistributions in binary form must reproduce the above 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * in the documentation and/or other materials provided with the 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * distribution. 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * contributors may be used to endorse or promote products derived from 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * this software without specific prior written permission. 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 301e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#ifndef WebDOMFileSystem_h 311e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#define WebDOMFileSystem_h 325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 331e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "../platform/WebCommon.h" 341e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "../platform/WebFileSystem.h" 351e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "../platform/WebPrivatePtr.h" 361e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "../platform/WebString.h" 371e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "../platform/WebURL.h" 3807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch#include "WebFrame.h" 3906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 40d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)#if BLINK_IMPLEMENTATION 41f91f5fa1608c2cdd9af1842fb5dadbe78275be2aBo Liu#include "platform/heap/Handle.h" 42d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)#endif 43d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 441e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)namespace v8 { 45d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)class Isolate; 46d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)class Object; 471e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)class Value; 481e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)template <class T> class Handle; 491e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)} 50926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 5151b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)namespace blink { 529bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 53e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles)class DOMFileSystem; 54e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) 551e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)class WebDOMFileSystem { 569bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)public: 57d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) enum SerializableType { 58d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SerializableTypeSerializable, 59d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SerializableTypeNotSerializable, 60d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) }; 61d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) enum EntryType { 62d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) EntryTypeFile, 63d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) EntryTypeDirectory, 64d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) }; 65d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 661e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) ~WebDOMFileSystem() { reset(); } 671e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 681e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) WebDOMFileSystem() { } 691e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) WebDOMFileSystem(const WebDOMFileSystem& d) { assign(d); } 701e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) WebDOMFileSystem& operator=(const WebDOMFileSystem& d) 711e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) { 721e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) assign(d); 731e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) return *this; 741e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) } 751e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 761e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) BLINK_EXPORT static WebDOMFileSystem fromV8Value(v8::Handle<v8::Value>); 77d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) // Create file system URL from the given entry. 78d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) BLINK_EXPORT static WebURL createFileSystemURL(v8::Handle<v8::Value> entry); 791e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 80d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) // FIXME: Deprecate the last argument when all filesystems become 81d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) // serializable. 82d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) BLINK_EXPORT static WebDOMFileSystem create( 8307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch WebLocalFrame*, 84d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) WebFileSystemType, 85d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) const WebString& name, 86d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) const WebURL& rootURL, 87d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SerializableType = SerializableTypeNotSerializable); 88d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 891e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) BLINK_EXPORT void reset(); 901e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) BLINK_EXPORT void assign(const WebDOMFileSystem&); 919bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 921e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) BLINK_EXPORT WebString name() const; 931e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) BLINK_EXPORT WebFileSystem::Type type() const; 941e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) BLINK_EXPORT WebURL rootURL() const; 951e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 96d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) BLINK_EXPORT v8::Handle<v8::Value> toV8Value(v8::Handle<v8::Object> creationContext, v8::Isolate*); 97d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) BLINK_EXPORT v8::Handle<v8::Value> createV8Entry( 98d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) const WebString& path, 99d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) EntryType, 100d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) v8::Handle<v8::Object> creationContext, v8::Isolate*); 101d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 1021e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) bool isNull() const { return m_private.isNull(); } 1031e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 1041e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#if BLINK_IMPLEMENTATION 105e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) WebDOMFileSystem(DOMFileSystem*); 106e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) WebDOMFileSystem& operator=(DOMFileSystem*); 1071e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#endif 1081e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 1091e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)private: 110e38fbeeb576b5094e34e038ab88d9d6a5c5c2214Torne (Richard Coles) WebPrivatePtr<DOMFileSystem> m_private; 1115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}; 1129bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 11351b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)} // namespace blink 1149bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 1151e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#endif // WebDOMFileSystem_h 116