| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 virtual ~DOMFileSystemBase(); | 75 virtual ~DOMFileSystemBase(); |
| 76 | 76 |
| 77 // These are called when a new callback is created and resolved in | 77 // These are called when a new callback is created and resolved in |
| 78 // FileSystem API, so that subclasses can track the number of pending | 78 // FileSystem API, so that subclasses can track the number of pending |
| 79 // callbacks if necessary. | 79 // callbacks if necessary. |
| 80 virtual void addPendingCallbacks() { } | 80 virtual void addPendingCallbacks() { } |
| 81 virtual void removePendingCallbacks() { } | 81 virtual void removePendingCallbacks() { } |
| 82 | 82 |
| 83 // Overridden by subclasses to handle sync vs async error-handling. | 83 // Overridden by subclasses to handle sync vs async error-handling. |
| 84 virtual void reportError(PassOwnPtrWillBeRawPtr<ErrorCallback>, PassRefPtrWi
llBeRawPtr<FileError>) = 0; | 84 virtual void reportError(ErrorCallback*, PassRefPtrWillBeRawPtr<FileError>)
= 0; |
| 85 | 85 |
| 86 const String& name() const { return m_name; } | 86 const String& name() const { return m_name; } |
| 87 FileSystemType type() const { return m_type; } | 87 FileSystemType type() const { return m_type; } |
| 88 KURL rootURL() const { return m_filesystemRootURL; } | 88 KURL rootURL() const { return m_filesystemRootURL; } |
| 89 blink::WebFileSystem* fileSystem() const; | 89 blink::WebFileSystem* fileSystem() const; |
| 90 SecurityOrigin* securityOrigin() const; | 90 SecurityOrigin* securityOrigin() const; |
| 91 | 91 |
| 92 // The clonable flag is used in the structured clone algorithm to test | 92 // The clonable flag is used in the structured clone algorithm to test |
| 93 // whether the FileSystem API object is permitted to be cloned. It defaults | 93 // whether the FileSystem API object is permitted to be cloned. It defaults |
| 94 // to false, and must be explicitly set by internal code permit cloning. | 94 // to false, and must be explicitly set by internal code permit cloning. |
| 95 void makeClonable() { m_clonable = true; } | 95 void makeClonable() { m_clonable = true; } |
| 96 bool clonable() const { return m_clonable; } | 96 bool clonable() const { return m_clonable; } |
| 97 | 97 |
| 98 static bool isValidType(FileSystemType); | 98 static bool isValidType(FileSystemType); |
| 99 static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePat
h); | 99 static bool crackFileSystemURL(const KURL&, FileSystemType&, String& filePat
h); |
| 100 static KURL createFileSystemRootURL(const String& origin, FileSystemType); | 100 static KURL createFileSystemRootURL(const String& origin, FileSystemType); |
| 101 bool supportsToURL() const; | 101 bool supportsToURL() const; |
| 102 KURL createFileSystemURL(const EntryBase*) const; | 102 KURL createFileSystemURL(const EntryBase*) const; |
| 103 KURL createFileSystemURL(const String& fullPath) const; | 103 KURL createFileSystemURL(const String& fullPath) const; |
| 104 static bool pathToAbsolutePath(FileSystemType, const EntryBase*, String path
, String& absolutePath); | 104 static bool pathToAbsolutePath(FileSystemType, const EntryBase*, String path
, String& absolutePath); |
| 105 static bool pathPrefixToFileSystemType(const String& pathPrefix, FileSystemT
ype&); | 105 static bool pathPrefixToFileSystemType(const String& pathPrefix, FileSystemT
ype&); |
| 106 static PassRefPtrWillBeRawPtr<File> createFile(const FileMetadata&, const KU
RL& fileSystemURL, FileSystemType, const String name); | 106 static PassRefPtrWillBeRawPtr<File> createFile(const FileMetadata&, const KU
RL& fileSystemURL, FileSystemType, const String name); |
| 107 | 107 |
| 108 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. | 108 // Actual FileSystem API implementations. All the validity checks on virtual
paths are done at this level. |
| 109 void getMetadata(const EntryBase*, PassOwnPtrWillBeRawPtr<MetadataCallback>,
PassOwnPtrWillBeRawPtr<ErrorCallback>, SynchronousType = Asynchronous); | 109 void getMetadata(const EntryBase*, MetadataCallback*, ErrorCallback*, Synchr
onousType = Asynchronous); |
| 110 void move(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssOwnPtrWillBeRawPtr<EntryCallback>, PassOwnPtrWillBeRawPtr<ErrorCallback>, Sync
hronousType = Asynchronous); | 110 void move(const EntryBase* source, EntryBase* parent, const String& name, En
tryCallback*, ErrorCallback*, SynchronousType = Asynchronous); |
| 111 void copy(const EntryBase* source, EntryBase* parent, const String& name, Pa
ssOwnPtrWillBeRawPtr<EntryCallback>, PassOwnPtrWillBeRawPtr<ErrorCallback>, Sync
hronousType = Asynchronous); | 111 void copy(const EntryBase* source, EntryBase* parent, const String& name, En
tryCallback*, ErrorCallback*, SynchronousType = Asynchronous); |
| 112 void remove(const EntryBase*, PassOwnPtrWillBeRawPtr<VoidCallback>, PassOwnP
trWillBeRawPtr<ErrorCallback>, SynchronousType = Asynchronous); | 112 void remove(const EntryBase*, VoidCallback*, ErrorCallback*, SynchronousType
= Asynchronous); |
| 113 void removeRecursively(const EntryBase*, PassOwnPtrWillBeRawPtr<VoidCallback
>, PassOwnPtrWillBeRawPtr<ErrorCallback>, SynchronousType = Asynchronous); | 113 void removeRecursively(const EntryBase*, VoidCallback*, ErrorCallback*, Sync
hronousType = Asynchronous); |
| 114 void getParent(const EntryBase*, PassOwnPtrWillBeRawPtr<EntryCallback>, Pass
OwnPtrWillBeRawPtr<ErrorCallback>); | 114 void getParent(const EntryBase*, EntryCallback*, ErrorCallback*); |
| 115 void getFile(const EntryBase*, const String& path, const FileSystemFlags&, P
assOwnPtrWillBeRawPtr<EntryCallback>, PassOwnPtrWillBeRawPtr<ErrorCallback>, Syn
chronousType = Asynchronous); | 115 void getFile(const EntryBase*, const String& path, const FileSystemFlags&, E
ntryCallback*, ErrorCallback*, SynchronousType = Asynchronous); |
| 116 void getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, PassOwnPtrWillBeRawPtr<EntryCallback>, PassOwnPtrWillBeRawPtr<ErrorCallback>
, SynchronousType = Asynchronous); | 116 void getDirectory(const EntryBase*, const String& path, const FileSystemFlag
s&, EntryCallback*, ErrorCallback*, SynchronousType = Asynchronous); |
| 117 int readDirectory(DirectoryReaderBase*, const String& path, PassOwnPtrWillBe
RawPtr<EntriesCallback>, PassOwnPtrWillBeRawPtr<ErrorCallback>, SynchronousType
= Asynchronous); | 117 int readDirectory(DirectoryReaderBase*, const String& path, EntriesCallback*
, ErrorCallback*, SynchronousType = Asynchronous); |
| 118 bool waitForAdditionalResult(int callbacksId); | 118 bool waitForAdditionalResult(int callbacksId); |
| 119 | 119 |
| 120 virtual void trace(Visitor*) { } | 120 virtual void trace(Visitor*) { } |
| 121 | 121 |
| 122 protected: | 122 protected: |
| 123 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con
st KURL& rootURL); | 123 DOMFileSystemBase(ExecutionContext*, const String& name, FileSystemType, con
st KURL& rootURL); |
| 124 friend class DOMFileSystemSync; | 124 friend class DOMFileSystemSync; |
| 125 | 125 |
| 126 ExecutionContext* m_context; | 126 ExecutionContext* m_context; |
| 127 String m_name; | 127 String m_name; |
| 128 FileSystemType m_type; | 128 FileSystemType m_type; |
| 129 KURL m_filesystemRootURL; | 129 KURL m_filesystemRootURL; |
| 130 bool m_clonable; | 130 bool m_clonable; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } | 133 inline bool operator==(const DOMFileSystemBase& a, const DOMFileSystemBase& b) {
return a.name() == b.name() && a.type() == b.type() && a.rootURL() == b.rootURL
(); } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| 136 | 136 |
| 137 #endif // DOMFileSystemBase_h | 137 #endif // DOMFileSystemBase_h |
| OLD | NEW |