Changeset 116280 in webkit
- Timestamp:
- May 7, 2012 12:39:20 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 23 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116277 r116280 1 2012-05-06 Kinuko Yasuda <kinuko@chromium.org> 2 3 Cleanup: Move FileSystem API type definitions into a separate header file 4 https://bugs.webkit.org/show_bug.cgi?id=85738 5 6 Reviewed by David Levin. 7 8 Move FileSystem API type definitions from AsyncFileSystem.h and 9 AsyncFileSystemChromium.cpp for chromium port into a single separate 10 header file: FileSystemType.h 11 12 By doing this we make it clearer that every filesystem type can be 13 found in the header file and also can save including entire 14 AsyncFileSystem definition just for referring type enum value. 15 16 No new tests as this change has no visible or functional changes. 17 18 * Modules/filesystem/DOMFileSystemBase.cpp: 19 (WebCore::pathToAbsolutePath): 20 * Modules/filesystem/DOMWindowFileSystem.cpp: 21 (WebCore::DOMWindowFileSystem::webkitRequestFileSystem): 22 (WebCore::DOMWindowFileSystem::webkitResolveLocalFileSystemURL): 23 (WebCore): 24 * Modules/filesystem/DOMWindowFileSystem.h: 25 * Modules/filesystem/LocalFileSystem.h: 26 (LocalFileSystem): 27 * Modules/filesystem/WorkerContextFileSystem.cpp: 28 (WebCore::WorkerContextFileSystem::webkitRequestFileSystem): 29 (WebCore::WorkerContextFileSystem::webkitRequestFileSystemSync): 30 (WebCore::WorkerContextFileSystem::webkitResolveLocalFileSystemURL): 31 (WebCore::WorkerContextFileSystem::webkitResolveLocalFileSystemSyncURL): 32 (WebCore): 33 * Modules/filesystem/WorkerContextFileSystem.h: 34 * platform/AsyncFileSystem.cpp: 35 (WebCore::AsyncFileSystem::isValidType): 36 (WebCore::AsyncFileSystem::create): 37 (WebCore::AsyncFileSystem::openFileSystem): 38 * platform/AsyncFileSystem.h: 39 (AsyncFileSystem): 40 (WebCore::AsyncFileSystem::type): 41 (WebCore::AsyncFileSystem::AsyncFileSystem): 42 * platform/FileSystemType.h: Added. 43 (WebCore): 44 * platform/blackberry/AsyncFileSystemBlackBerry.cpp: 45 (WebCore::AsyncFileSystem::isValidType): 46 (WebCore::AsyncFileSystem::create): 47 (WebCore::AsyncFileSystem::openFileSystem): 48 (WebCore::AsyncFileSystem::crackFileSystemURL): 49 (WebCore::AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry): 50 * platform/blackberry/AsyncFileSystemBlackBerry.h: 51 (AsyncFileSystemBlackBerry): 52 * platform/gtk/AsyncFileSystemGtk.cpp: 53 (WebCore::AsyncFileSystem::isValidType): 54 (WebCore::AsyncFileSystem::create): 55 (WebCore::AsyncFileSystem::openFileSystem): 56 (WebCore::AsyncFileSystem::crackFileSystemURL): 57 (WebCore::AsyncFileSystemGtk::AsyncFileSystemGtk): 58 * platform/gtk/AsyncFileSystemGtk.h: 59 (AsyncFileSystemGtk): 60 1 61 2012-05-06 MORITA Hajime <morrita@google.com> 2 62 -
trunk/Source/WebCore/Modules/filesystem/DOMFileSystemBase.cpp
r111075 r116280 100 100 } 101 101 102 static bool pathToAbsolutePath( AsyncFileSystem::Type type, const EntryBase* base, String path, String& absolutePath)102 static bool pathToAbsolutePath(FileSystemType type, const EntryBase* base, String path, String& absolutePath) 103 103 { 104 104 ASSERT(base); … … 108 108 absolutePath = DOMFilePath::removeExtraParentReferences(path); 109 109 110 if ((type == AsyncFileSystem::Temporary || type == AsyncFileSystem::Persistent) && !DOMFilePath::isValidPath(absolutePath))110 if ((type == FileSystemTypeTemporary || type == FileSystemTypePersistent) && !DOMFilePath::isValidPath(absolutePath)) 111 111 return false; 112 112 return true; -
trunk/Source/WebCore/Modules/filesystem/DOMWindowFileSystem.cpp
r110957 r116280 65 65 } 66 66 67 AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);67 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 68 68 if (!AsyncFileSystem::isValidType(fileSystemType)) { 69 69 DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); … … 90 90 } 91 91 92 AsyncFileSystem::Type type;92 FileSystemType type; 93 93 String filePath; 94 94 if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) { … … 100 100 } 101 101 102 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<int>( AsyncFileSystem::Temporary), enum_mismatch);103 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<int>( AsyncFileSystem::Persistent), enum_mismatch);102 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::TEMPORARY) == static_cast<int>(FileSystemTypeTemporary), enum_mismatch); 103 COMPILE_ASSERT(static_cast<int>(DOMWindowFileSystem::PERSISTENT) == static_cast<int>(FileSystemTypePersistent), enum_mismatch); 104 104 105 105 } // namespace WebCore -
trunk/Source/WebCore/Modules/filesystem/DOMWindowFileSystem.h
r110957 r116280 47 47 // They are placed here and in all capital letters so they can be checked against the constants in the 48 48 // IDL at compile time. 49 enum FileSystemType{49 enum { 50 50 TEMPORARY, 51 51 PERSISTENT, -
trunk/Source/WebCore/Modules/filesystem/LocalFileSystem.h
r113537 r116280 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "AsyncFileSystem.h" 36 #include "AsyncFileSystemCallbacks.h" 37 #include "FileSystemType.h" 37 38 #include "PlatformString.h" 38 39 #include <wtf/PassRefPtr.h> … … 55 56 56 57 // Does not create the root path for file system, just reads it if available. 57 void readFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);58 void readFileSystem(ScriptExecutionContext*, FileSystemType, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false); 58 59 59 void requestFileSystem(ScriptExecutionContext*, AsyncFileSystem::Type, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false);60 void requestFileSystem(ScriptExecutionContext*, FileSystemType, long long size, PassOwnPtr<AsyncFileSystemCallbacks>, bool synchronous = false); 60 61 61 62 #if !PLATFORM(CHROMIUM) -
trunk/Source/WebCore/Modules/filesystem/WorkerContextFileSystem.cpp
r111075 r116280 57 57 } 58 58 59 AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);59 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 60 60 if (!AsyncFileSystem::isValidType(fileSystemType)) { 61 61 DOMFileSystem::scheduleCallback(worker, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); … … 75 75 } 76 76 77 AsyncFileSystem::Type fileSystemType = static_cast<AsyncFileSystem::Type>(type);77 FileSystemType fileSystemType = static_cast<FileSystemType>(type); 78 78 if (!AsyncFileSystem::isValidType(fileSystemType)) { 79 79 ec = FileException::INVALID_MODIFICATION_ERR; … … 95 95 } 96 96 97 AsyncFileSystem::Type type;97 FileSystemType type; 98 98 String filePath; 99 99 if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) { … … 115 115 } 116 116 117 AsyncFileSystem::Type type;117 FileSystemType type; 118 118 String filePath; 119 119 if (!completedURL.isValid() || !AsyncFileSystem::crackFileSystemURL(completedURL, type, filePath)) { … … 135 135 } 136 136 137 COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::TEMPORARY) == static_cast<int>( AsyncFileSystem::Temporary), enum_mismatch);138 COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::PERSISTENT) == static_cast<int>( AsyncFileSystem::Persistent), enum_mismatch);137 COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::TEMPORARY) == static_cast<int>(FileSystemTypeTemporary), enum_mismatch); 138 COMPILE_ASSERT(static_cast<int>(WorkerContextFileSystem::PERSISTENT) == static_cast<int>(FileSystemTypePersistent), enum_mismatch); 139 139 140 140 } // namespace WebCore -
trunk/Source/WebCore/Modules/filesystem/WorkerContextFileSystem.h
r111075 r116280 43 43 class WorkerContextFileSystem { 44 44 public: 45 enum FileSystemType{45 enum { 46 46 TEMPORARY, 47 47 PERSISTENT, -
trunk/Source/WebCore/platform/AsyncFileSystem.cpp
r112106 r116280 53 53 } 54 54 55 bool AsyncFileSystem::isValidType( Type type)55 bool AsyncFileSystem::isValidType(FileSystemType type) 56 56 { 57 return type == Temporary || type ==Persistent;57 return type == FileSystemTypeTemporary || type == FileSystemTypePersistent; 58 58 } 59 59 60 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create( Type)60 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(FileSystemType) 61 61 { 62 62 notImplemented(); … … 64 64 } 65 65 66 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)66 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 67 67 { 68 68 notImplemented(); -
trunk/Source/WebCore/platform/AsyncFileSystem.h
r116273 r116280 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "FileSystemType.h" 36 37 #include "KURL.h" 37 38 #include "PlatformString.h" … … 51 52 virtual ~AsyncFileSystem() { } 52 53 53 // FileSystem type54 enum Type {55 Temporary,56 Persistent,57 };58 59 54 // Path prefixes that are used in the filesystem URLs (that can be obtained by toURL()). 60 55 // http://www.w3.org/TR/file-system-api/#widl-Entry-toURL … … 69 64 static bool isAvailable(); 70 65 71 static bool isValidType( Type);66 static bool isValidType(FileSystemType); 72 67 73 static bool crackFileSystemURL(const KURL&, Type&, String& filePath);68 static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePath); 74 69 75 70 virtual KURL toURL(const String& originString, const String& fullPath) const = 0; … … 80 75 81 76 // Creates and returns a new platform-specific AsyncFileSystem instance if the platform has its own implementation. 82 static PassOwnPtr<AsyncFileSystem> create( Type);77 static PassOwnPtr<AsyncFileSystem> create(FileSystemType); 83 78 84 79 // Opens a new file system. The create parameter specifies whether or not to create the path if it does not already exists. 85 static void openFileSystem(const String& basePath, const String& storageIdentifier, Type, bool create, PassOwnPtr<AsyncFileSystemCallbacks>);80 static void openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType, bool create, PassOwnPtr<AsyncFileSystemCallbacks>); 86 81 87 82 // Moves a file or directory from srcPath to destPath. … … 148 143 virtual void createSnapshotFileAndReadMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks>) = 0; 149 144 150 Type type() const { return m_type; }145 FileSystemType type() const { return m_type; } 151 146 152 147 protected: 153 AsyncFileSystem( Type type)148 AsyncFileSystem(FileSystemType type) 154 149 : m_type(type) 155 150 { 156 151 } 157 152 158 Type m_type;153 FileSystemType m_type; 159 154 }; 160 155 -
trunk/Source/WebCore/platform/FileSystemType.h
r116279 r116280 1 1 /* 2 * Copyright (C) 201 0Google Inc. All rights reserved.2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #i nclude "config.h"32 # include "AsyncFileSystem.h"31 #ifndef FileSystemType_h 32 #define FileSystemType_h 33 33 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "AsyncFileSystemCallbacks.h"37 #include "ExceptionCode.h"38 #include "FileSystem.h"39 #include "NotImplemented.h"40 41 36 namespace WebCore { 42 37 43 const char AsyncFileSystem::persistentPathPrefix[] = "persistent"; 44 const size_t AsyncFileSystem::persistentPathPrefixLength = sizeof(AsyncFileSystem::persistentPathPrefix) - 1; 45 const char AsyncFileSystem::temporaryPathPrefix[] = "temporary"; 46 const size_t AsyncFileSystem::temporaryPathPrefixLength = sizeof(AsyncFileSystem::temporaryPathPrefix) - 1; 38 // For file system types used in FileSystem API. 39 enum FileSystemType { 40 FileSystemTypeTemporary, 41 FileSystemTypePersistent, 47 42 48 #if !PLATFORM(CHROMIUM) && !PLATFORM(GTK) && !PLATFORM(BLACKBERRY) 49 bool AsyncFileSystem::isAvailable() 50 { 51 notImplemented(); 52 return false; 53 } 43 #if PLATFORM(CHROMIUM) 44 // Temporary isolated non-sandbox filesystem. 45 FileSystemTypeIsolated, 54 46 55 bool AsyncFileSystem::isValidType(Type type) 56 { 57 return type == Temporary || type == Persistent; 58 } 47 // Non-sandbox filesystem. 48 FileSystemTypeExternal, 49 #endif 50 }; 59 51 60 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(Type) 61 { 62 notImplemented(); 63 return nullptr; 64 } 65 66 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 67 { 68 notImplemented(); 69 callbacks->didFail(NOT_SUPPORTED_ERR); 70 } 71 #endif 72 73 } // namespace 52 } // namespace WebCore 74 53 75 54 #endif // ENABLE(FILE_SYSTEM) 55 56 #endif // FileSystemType_h -
trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.cpp
r116273 r116280 36 36 } 37 37 38 bool AsyncFileSystem::isValidType( Type type)38 bool AsyncFileSystem::isValidType(FileSystemType type) 39 39 { 40 40 UNUSED_PARAM(type); … … 44 44 } 45 45 46 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create( Type type)46 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(FileSystemType type) 47 47 { 48 48 return adoptPtr(new AsyncFileSystemBlackBerry(type)); 49 49 } 50 50 51 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)51 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 52 52 { 53 53 UNUSED_PARAM(basePath); … … 60 60 } 61 61 62 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)62 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath) 63 63 { 64 64 UNUSED_PARAM(url); … … 70 70 } 71 71 72 AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry( AsyncFileSystem::Type type)72 AsyncFileSystemBlackBerry::AsyncFileSystemBlackBerry(FileSystemType type) 73 73 : AsyncFileSystem(type) 74 74 { -
trunk/Source/WebCore/platform/blackberry/AsyncFileSystemBlackBerry.h
r116273 r116280 28 28 class AsyncFileSystemBlackBerry : public AsyncFileSystem { 29 29 public: 30 AsyncFileSystemBlackBerry( AsyncFileSystem::Type);30 AsyncFileSystemBlackBerry(FileSystemType); 31 31 virtual ~AsyncFileSystemBlackBerry(); 32 32 virtual KURL toURL(const String& originString, const String& fullPath) const; -
trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.cpp
r116273 r116280 36 36 } 37 37 38 bool AsyncFileSystem::isValidType( Type type)38 bool AsyncFileSystem::isValidType(FileSystemType type) 39 39 { 40 40 notImplemented(); … … 42 42 } 43 43 44 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create( Type type)44 PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create(FileSystemType type) 45 45 { 46 46 return adoptPtr(new AsyncFileSystemGtk(type)); 47 47 } 48 48 49 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, Type type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)49 void AsyncFileSystem::openFileSystem(const String& basePath, const String& storageIdentifier, FileSystemType type, bool, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) 50 50 { 51 51 notImplemented(); … … 53 53 } 54 54 55 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)55 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath) 56 56 { 57 57 notImplemented(); … … 59 59 } 60 60 61 AsyncFileSystemGtk::AsyncFileSystemGtk( AsyncFileSystem::Type type)61 AsyncFileSystemGtk::AsyncFileSystemGtk(FileSystemType type) 62 62 : AsyncFileSystem(type) 63 63 { -
trunk/Source/WebCore/platform/gtk/AsyncFileSystemGtk.h
r116273 r116280 32 32 class AsyncFileSystemGtk : public AsyncFileSystem { 33 33 public: 34 AsyncFileSystemGtk( AsyncFileSystem::Type);34 AsyncFileSystemGtk(FileSystemType); 35 35 virtual ~AsyncFileSystemGtk(); 36 36 -
trunk/Source/WebKit/chromium/ChangeLog
r116273 r116280 1 2012-05-06 Kinuko Yasuda <kinuko@chromium.org> 2 3 Cleanup: Move FileSystem API type definitions into a separate header file 4 https://bugs.webkit.org/show_bug.cgi?id=85738 5 6 Reviewed by David Levin. 7 8 Move FileSystem API type definitions from AsyncFileSystem.h and 9 AsyncFileSystemChromium.cpp for chromium port into a single separate 10 header file: FileSystemType.h 11 12 By doing this we make it clearer that every filesystem type can be 13 found in the header file and also can save including entire 14 AsyncFileSystem definition just for referring type enum value. 15 16 * src/AssertMatchingEnums.cpp: 17 * src/AsyncFileSystemChromium.cpp: 18 (WebCore::AsyncFileSystem::crackFileSystemURL): 19 (WebCore::AsyncFileSystem::isValidType): 20 (WebCore::AsyncFileSystemChromium::AsyncFileSystemChromium): 21 (WebCore::AsyncFileSystemChromium::createIsolatedFileSystem): 22 (WebCore::AsyncFileSystemChromium::toURL): 23 * src/AsyncFileSystemChromium.h: 24 (WebCore::AsyncFileSystemChromium::create): 25 (AsyncFileSystemChromium): 26 * src/LocalFileSystemChromium.cpp: 27 (WebCore::openFileSystemHelper): 28 (WebCore::LocalFileSystem::readFileSystem): 29 (WebCore::LocalFileSystem::requestFileSystem): 30 * src/WebFileSystemCallbacksImpl.cpp: 31 (WebKit::WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl): 32 * src/WebFileSystemCallbacksImpl.h: 33 (WebFileSystemCallbacksImpl): 34 * src/WebFrameImpl.cpp: 35 (WebKit::WebFrameImpl::createFileSystem): 36 (WebKit::WebFrameImpl::createFileEntry): 37 * src/WorkerAsyncFileSystemChromium.cpp: 38 (WebCore::WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium): 39 * src/WorkerAsyncFileSystemChromium.h: 40 (WebCore::WorkerAsyncFileSystemChromium::create): 41 (WorkerAsyncFileSystemChromium): 42 1 43 2012-05-06 Kinuko Yasuda <kinuko@chromium.org> 2 44 -
trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp
r116127 r116280 37 37 #include "AccessibilityObject.h" 38 38 #include "ApplicationCacheHost.h" 39 #include "AsyncFileSystem.h"40 39 #include "ContentSecurityPolicy.h" 41 40 #include "DocumentMarker.h" … … 44 43 #include "FileError.h" 45 44 #include "FileMetadata.h" 45 #include "FileSystemType.h" 46 46 #include "FilterOperation.h" 47 47 #include "FontDescription.h" … … 471 471 472 472 #if ENABLE(FILE_SYSTEM) 473 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, AsyncFileSystem::Temporary); 474 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, AsyncFileSystem::Persistent); 473 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeTemporary, FileSystemTypeTemporary); 474 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypePersistent, FileSystemTypePersistent); 475 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeExternal, FileSystemTypeExternal); 476 COMPILE_ASSERT_MATCHING_ENUM(WebFileSystem::TypeIsolated, FileSystemTypeIsolated); 475 477 COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeUnknown, FileMetadata::TypeUnknown); 476 478 COMPILE_ASSERT_MATCHING_ENUM(WebFileInfo::TypeFile, FileMetadata::TypeFile); -
trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp
r116273 r116280 53 53 54 54 // For isolated filesystem. 55 const AsyncFileSystem::Type isolatedType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeIsolated);56 55 const char isolatedPathPrefix[] = "isolated"; 57 56 58 57 // For external filesystem. 59 const AsyncFileSystem::Type externalType = static_cast<AsyncFileSystem::Type>(WebKit::WebFileSystem::TypeExternal);60 58 const char externalPathPrefix[] = "external"; 61 59 const size_t externalPathPrefixLength = sizeof(externalPathPrefix) - 1; … … 106 104 107 105 // static 108 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& type, String& filePath)106 bool AsyncFileSystem::crackFileSystemURL(const KURL& url, FileSystemType& type, String& filePath) 109 107 { 110 108 if (!url.protocolIs("filesystem")) … … 114 112 String typeString = url.innerURL()->path().substring(1); 115 113 if (typeString == temporaryPathPrefix) 116 type = Temporary;114 type = FileSystemTypeTemporary; 117 115 else if (typeString == persistentPathPrefix) 118 type = Persistent;116 type = FileSystemTypePersistent; 119 117 else if (typeString == externalPathPrefix) 120 type = externalType;118 type = FileSystemTypeExternal; 121 119 else 122 120 return false; 123 121 124 122 filePath = decodeURLEscapeSequences(url.path()); 125 } else {126 // FIXME: Remove this clause once http://codereview.chromium.org/7811006127 // lands, which makes this dead code.128 KURL originURL(ParsedURLString, url.path());129 String path = decodeURLEscapeSequences(originURL.path());130 if (path.isEmpty() || path[0] != '/')131 return false;132 path = path.substring(1);133 134 if (path.startsWith(temporaryPathPrefix)) {135 type = Temporary;136 path = path.substring(temporaryPathPrefixLength);137 } else if (path.startsWith(persistentPathPrefix)) {138 type = Persistent;139 path = path.substring(persistentPathPrefixLength);140 } else if (path.startsWith(externalPathPrefix)) {141 type = externalType;142 path = path.substring(externalPathPrefixLength);143 } else144 return false;145 146 if (path.isEmpty() || path[0] != '/')147 return false;148 149 filePath.swap(path);150 123 } 151 124 return true; … … 153 126 154 127 // static 155 bool AsyncFileSystem::isValidType( Type type)156 { 157 return type == Temporary || type == Persistent || type == static_cast<Type>(WebKit::WebFileSystem::TypeExternal);158 } 159 160 AsyncFileSystemChromium::AsyncFileSystemChromium( AsyncFileSystem::Type type, const KURL& rootURL)128 bool AsyncFileSystem::isValidType(FileSystemType type) 129 { 130 return type == FileSystemTypeTemporary || type == FileSystemTypePersistent || type == FileSystemTypeExternal; 131 } 132 133 AsyncFileSystemChromium::AsyncFileSystemChromium(FileSystemType type, const KURL& rootURL) 161 134 : AsyncFileSystem(type) 162 135 , m_webFileSystem(WebKit::webKitPlatformSupport()->fileSystem()) … … 192 165 rootURL.append("/"); 193 166 194 return AsyncFileSystemChromium::create( isolatedType, KURL(ParsedURLString, rootURL.toString()));167 return AsyncFileSystemChromium::create(FileSystemTypeIsolated, KURL(ParsedURLString, rootURL.toString())); 195 168 } 196 169 … … 206 179 207 180 // For now we don't support toURL for isolated filesystem (until we resolve the isolated filesystem lifetime issue). 208 if (type() == isolatedType)181 if (type() == FileSystemTypeIsolated) 209 182 return KURL(); 210 183 211 if (type() == externalType) {184 if (type() == FileSystemTypeExternal) { 212 185 // For external filesystem originString could be different from what we have in m_filesystemRootURL. 213 186 StringBuilder result; -
trunk/Source/WebKit/chromium/src/AsyncFileSystemChromium.h
r116273 r116280 48 48 class AsyncFileSystemChromium : public AsyncFileSystem { 49 49 public: 50 static PassOwnPtr<AsyncFileSystem> create( AsyncFileSystem::Type type, const KURL& rootURL)50 static PassOwnPtr<AsyncFileSystem> create(FileSystemType type, const KURL& rootURL) 51 51 { 52 52 return adoptPtr(new AsyncFileSystemChromium(type, rootURL)); … … 73 73 74 74 protected: 75 AsyncFileSystemChromium( AsyncFileSystem::Type, const KURL& rootURL);75 AsyncFileSystemChromium(FileSystemType, const KURL& rootURL); 76 76 77 77 PassOwnPtr<AsyncFileSystemCallbacks> createSnapshotFileCallback(const KURL& internalBlobURL, PassOwnPtr<AsyncFileSystemCallbacks>) const; -
trunk/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp
r113204 r116280 34 34 #if ENABLE(FILE_SYSTEM) 35 35 36 #include "AsyncFileSystem.h"37 36 #include "CrossThreadTask.h" 38 37 #include "Document.h" … … 40 39 #include "FileSystemCallback.h" 41 40 #include "FileSystemCallbacks.h" 41 #include "FileSystemType.h" 42 42 #include "PlatformString.h" 43 43 #include "WebFileError.h" … … 184 184 } 185 185 186 static void openFileSystemHelper(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create)186 static void openFileSystemHelper(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous, long long size, CreationFlag create) 187 187 { 188 188 bool allowed = true; … … 217 217 } 218 218 219 void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)219 void LocalFileSystem::readFileSystem(ScriptExecutionContext* context, FileSystemType type, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous) 220 220 { 221 221 openFileSystemHelper(context, type, callbacks, synchronous, 0, OpenExisting); 222 222 } 223 223 224 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous)224 void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, FileSystemType type, long long size, PassOwnPtr<AsyncFileSystemCallbacks> callbacks, bool synchronous) 225 225 { 226 226 openFileSystemHelper(context, type, callbacks, synchronous, size, CreateIfNotPresent); -
trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp
r102044 r116280 48 48 namespace WebKit { 49 49 50 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, AsyncFileSystem::Type type, WebCore::ScriptExecutionContext* context, bool synchronous)50 WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, FileSystemType type, WebCore::ScriptExecutionContext* context, bool synchronous) 51 51 : m_callbacks(callbacks) 52 52 , m_type(type) -
trunk/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h
r102044 r116280 32 32 #define WebFileSystemCallbacksImpl_h 33 33 34 #include "AsyncFileSystem.h" 34 #include "FileSystemType.h" 35 #include "WebFileSystemCallbacks.h" 35 36 #include "platform/WebFileSystem.h" 36 #include "WebFileSystemCallbacks.h"37 37 #include "platform/WebVector.h" 38 38 #include <wtf/OwnPtr.h> … … 53 53 class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { 54 54 public: 55 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore:: AsyncFileSystem::Type = WebCore::AsyncFileSystem::Temporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false);55 WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::FileSystemType = WebCore::FileSystemTypeTemporary, WebCore::ScriptExecutionContext* = 0, bool synchronous = false); 56 56 virtual ~WebFileSystemCallbacksImpl(); 57 57 … … 66 66 67 67 // Used for openFileSystem callbacks. 68 WebCore:: AsyncFileSystem::Type m_type;68 WebCore::FileSystemType m_type; 69 69 70 70 // Used for worker's openFileSystem callbacks. -
trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp
r115760 r116280 86 86 #include "EventHandler.h" 87 87 #include "EventListenerWrapper.h" 88 #include "FileSystemType.h" 88 89 #include "FocusController.h" 89 90 #include "FontCache.h" … … 939 940 const WebString& path) 940 941 { 941 return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast< AsyncFileSystem::Type>(type), KURL(ParsedURLString, path.utf8().data()))));942 return toV8(DOMFileSystem::create(frame()->document(), name, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, path.utf8().data())))); 942 943 } 943 944 … … 948 949 bool isDirectory) 949 950 { 950 RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast< AsyncFileSystem::Type>(type), KURL(ParsedURLString, fileSystemPath.utf8().data())));951 RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, AsyncFileSystemChromium::create(static_cast<FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data()))); 951 952 if (isDirectory) 952 953 return toV8(DirectoryEntry::create(fileSystem, filePath)); -
trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.cpp
r109324 r116280 58 58 static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; 59 59 60 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)60 WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, bool synchronous) 61 61 : AsyncFileSystemChromium(type, rootURL) 62 62 , m_scriptExecutionContext(context) -
trunk/Source/WebKit/chromium/src/WorkerAsyncFileSystemChromium.h
r109324 r116280 35 35 36 36 #include "AsyncFileSystemChromium.h" 37 #include "PlatformString.h"38 37 #include <wtf/PassOwnPtr.h> 39 38 #include <wtf/RefPtr.h> … … 54 53 class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium { 55 54 public: 56 static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, AsyncFileSystem::Type type, const WebKit::WebURL& rootURL, bool synchronous)55 static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemType type, const WebKit::WebURL& rootURL, bool synchronous) 57 56 { 58 57 return adoptPtr(new WorkerAsyncFileSystemChromium(context, type, rootURL, synchronous)); … … 78 77 79 78 private: 80 WorkerAsyncFileSystemChromium(ScriptExecutionContext*, AsyncFileSystem::Type, const WebKit::WebURL& rootURL, bool synchronous);79 WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemType, const WebKit::WebURL& rootURL, bool synchronous); 81 80 82 81 PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>);
Note: See TracChangeset
for help on using the changeset viewer.