| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // WebFileSystemCallbacks::didSucceed() must be called when the operation | 75 // WebFileSystemCallbacks::didSucceed() must be called when the operation |
| 76 // is completed successfully. WebFileSystemCallbacks::didFail() must be | 76 // is completed successfully. WebFileSystemCallbacks::didFail() must be |
| 77 // called otherwise. | 77 // called otherwise. |
| 78 // All in-flight operations and following operations may fail after the | 78 // All in-flight operations and following operations may fail after the |
| 79 // FileSystem is deleted. | 79 // FileSystem is deleted. |
| 80 virtual void deleteFileSystem(const WebURL& storagePartition, | 80 virtual void deleteFileSystem(const WebURL& storagePartition, |
| 81 const WebFileSystemType, | 81 const WebFileSystemType, |
| 82 WebFileSystemCallbacks) {} | 82 WebFileSystemCallbacks) {} |
| 83 | 83 |
| 84 // Moves a file or directory at |srcPath| to |destPath|. | 84 // Moves a file or directory at |srcPath| to |destPath|. |
| 85 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 85 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 86 // completed successfully. |
| 86 // WebFileSystemCallbacks::didFail() must be called otherwise. | 87 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 87 virtual void move(const WebURL& srcPath, | 88 virtual void move(const WebURL& srcPath, |
| 88 const WebURL& destPath, | 89 const WebURL& destPath, |
| 89 WebFileSystemCallbacks) = 0; | 90 WebFileSystemCallbacks) = 0; |
| 90 | 91 |
| 91 // Copies a file or directory at |srcPath| to |destPath|. | 92 // Copies a file or directory at |srcPath| to |destPath|. |
| 92 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 93 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 94 // completed successfully. |
| 93 // WebFileSystemCallbacks::didFail() must be called otherwise. | 95 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 94 virtual void copy(const WebURL& srcPath, | 96 virtual void copy(const WebURL& srcPath, |
| 95 const WebURL& destPath, | 97 const WebURL& destPath, |
| 96 WebFileSystemCallbacks) = 0; | 98 WebFileSystemCallbacks) = 0; |
| 97 | 99 |
| 98 // Deletes a file or directory at a given |path|. | 100 // Deletes a file or directory at a given |path|. |
| 99 // It is an error to try to remove a directory that is not empty. | 101 // It is an error to try to remove a directory that is not empty. |
| 100 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 102 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 103 // completed successfully. |
| 101 // WebFileSystemCallbacks::didFail() must be called otherwise. | 104 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 102 virtual void remove(const WebURL& path, WebFileSystemCallbacks) = 0; | 105 virtual void remove(const WebURL& path, WebFileSystemCallbacks) = 0; |
| 103 | 106 |
| 104 // Deletes a file or directory recursively at a given |path|. | 107 // Deletes a file or directory recursively at a given |path|. |
| 105 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 108 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 109 // completed successfully. |
| 106 // WebFileSystemCallbacks::didFail() must be called otherwise. | 110 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 107 virtual void removeRecursively(const WebURL& path, | 111 virtual void removeRecursively(const WebURL& path, |
| 108 WebFileSystemCallbacks) = 0; | 112 WebFileSystemCallbacks) = 0; |
| 109 | 113 |
| 110 // Retrieves the metadata information of the file or directory at the given |p
ath|. | 114 // Retrieves the metadata information of the file or directory at the given |
| 111 // This may not always return the local platform path in remote filesystem cas
es. | 115 // |path|. This may not always return the local platform path in remote |
| 112 // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metad
ata when the retrieval is completed successfully. | 116 // filesystem cases. WebFileSystemCallbacks::didReadMetadata() must be called |
| 117 // with a valid metadata when the retrieval is completed successfully. |
| 113 // WebFileSystemCallbacks::didFail() must be called otherwise. | 118 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 114 virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks) = 0; | 119 virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks) = 0; |
| 115 | 120 |
| 116 // Creates a file at given |path|. | 121 // Creates a file at given |path|. |
| 117 // If the |path| doesn't exist, it creates a new file at |path|. | 122 // If the |path| doesn't exist, it creates a new file at |path|. |
| 118 // If |exclusive| is true, it fails if the |path| already exists. | 123 // If |exclusive| is true, it fails if the |path| already exists. |
| 119 // If |exclusive| is false, it succeeds if the |path| already exists or | 124 // If |exclusive| is false, it succeeds if the |path| already exists or |
| 120 // it has successfully created a new file at |path|. | 125 // it has successfully created a new file at |path|. |
| 121 // | 126 // |
| 122 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 127 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 128 // completed successfully. |
| 123 // WebFileSystemCallbacks::didFail() must be called otherwise. | 129 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 124 virtual void createFile(const WebURL& path, | 130 virtual void createFile(const WebURL& path, |
| 125 bool exclusive, | 131 bool exclusive, |
| 126 WebFileSystemCallbacks) = 0; | 132 WebFileSystemCallbacks) = 0; |
| 127 | 133 |
| 128 // Creates a directory at a given |path|. | 134 // Creates a directory at a given |path|. |
| 129 // If the |path| doesn't exist, it creates a new directory at |path|. | 135 // If the |path| doesn't exist, it creates a new directory at |path|. |
| 130 // If |exclusive| is true, it fails if the |path| already exists. | 136 // If |exclusive| is true, it fails if the |path| already exists. |
| 131 // If |exclusive| is false, it succeeds if the |path| already exists or it has
successfully created a new directory at |path|. | 137 // If |exclusive| is false, it succeeds if the |path| already exists or it has |
| 138 // successfully created a new directory at |path|. |
| 132 // | 139 // |
| 133 // WebFileSystemCallbacks::didSucceed() must be called when | 140 // WebFileSystemCallbacks::didSucceed() must be called when |
| 134 // the operation is completed successfully. | 141 // the operation is completed successfully. |
| 135 // WebFileSystemCallbacks::didFail() must be called otherwise. | 142 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 136 virtual void createDirectory(const WebURL& path, | 143 virtual void createDirectory(const WebURL& path, |
| 137 bool exclusive, | 144 bool exclusive, |
| 138 WebFileSystemCallbacks) = 0; | 145 WebFileSystemCallbacks) = 0; |
| 139 | 146 |
| 140 // Checks if a file exists at a given |path|. | 147 // Checks if a file exists at a given |path|. |
| 141 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 148 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 149 // completed successfully. |
| 142 // WebFileSystemCallbacks::didFail() must be called otherwise. | 150 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 143 virtual void fileExists(const WebURL& path, WebFileSystemCallbacks) = 0; | 151 virtual void fileExists(const WebURL& path, WebFileSystemCallbacks) = 0; |
| 144 | 152 |
| 145 // Checks if a directory exists at a given |path|. | 153 // Checks if a directory exists at a given |path|. |
| 146 // WebFileSystemCallbacks::didSucceed() must be called when the operation is c
ompleted successfully. | 154 // WebFileSystemCallbacks::didSucceed() must be called when the operation is |
| 155 // completed successfully. |
| 147 // WebFileSystemCallbacks::didFail() must be called otherwise. | 156 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 148 virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks) = 0; | 157 virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks) = 0; |
| 149 | 158 |
| 150 // Reads directory entries of a given directory at |path| and returns a callba
cks ID which can be used to wait for additional results. | 159 // Reads directory entries of a given directory at |path| and returns a |
| 151 // WebFileSystemCallbacks::didReadDirectory() must be called when the operatio
n is completed successfully. | 160 // callbacks ID which can be used to wait for additional results. |
| 161 // WebFileSystemCallbacks::didReadDirectory() must be called when the |
| 162 // operation is completed successfully. |
| 152 // WebFileSystemCallbacks::didFail() must be called otherwise. | 163 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 153 virtual int readDirectory(const WebURL& path, WebFileSystemCallbacks) = 0; | 164 virtual int readDirectory(const WebURL& path, WebFileSystemCallbacks) = 0; |
| 154 | 165 |
| 155 // Creates a WebFileWriter that can be used to write to the given file. | 166 // Creates a WebFileWriter that can be used to write to the given file. |
| 156 // WebFileSystemCallbacks::didCreateFileWriter() must be called with the creat
ed WebFileWriter when the operation is completed successfully. | 167 // WebFileSystemCallbacks::didCreateFileWriter() must be called with the |
| 168 // created WebFileWriter when the operation is completed successfully. |
| 157 // WebFileSystemCallbacks::didFail() must be called otherwise. | 169 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 158 virtual void createFileWriter(const WebURL& path, | 170 virtual void createFileWriter(const WebURL& path, |
| 159 WebFileWriterClient*, | 171 WebFileWriterClient*, |
| 160 WebFileSystemCallbacks) = 0; | 172 WebFileSystemCallbacks) = 0; |
| 161 | 173 |
| 162 // Creates a snapshot file for a given file specified by |path|. It returns th
e metadata of the created snapshot file. | 174 // Creates a snapshot file for a given file specified by |path|. It returns |
| 163 // The returned metadata should include a local platform path to the snapshot
image. | 175 // the metadata of the created snapshot file. The returned metadata should |
| 164 // In local filesystem cases the backend may simply return the metadata of the
file itself (as well as readMetadata does), while in | 176 // include a local platform path to the snapshot image. In local filesystem |
| 165 // remote filesystem case the backend may download the file into a temporary s
napshot file and return the metadata of the temporary file. | 177 // cases the backend may simply return the metadata of the file itself (as |
| 178 // well as readMetadata does), while in remote filesystem case the backend may |
| 179 // download the file into a temporary snapshot file and return the metadata of |
| 180 // the temporary file. |
| 166 // The returned metadata is used to create a File object for the |path|. | 181 // The returned metadata is used to create a File object for the |path|. |
| 167 // The snapshot file is supposed to be deleted when the last reference to a bl
ink::File referring to it's path is dropped. | 182 // The snapshot file is supposed to be deleted when the last reference to a |
| 168 // WebFileSystemCallbacks::didCreateSnapshotFile() with the metadata of the sn
apshot file must be called when the operation is completed successfully. | 183 // blink::File referring to it's path is dropped. |
| 184 // WebFileSystemCallbacks::didCreateSnapshotFile() with the metadata of the |
| 185 // snapshot file must be called when the operation is completed successfully. |
| 169 // WebFileSystemCallbacks::didFail() must be called otherwise. | 186 // WebFileSystemCallbacks::didFail() must be called otherwise. |
| 170 virtual void createSnapshotFileAndReadMetadata(const WebURL& path, | 187 virtual void createSnapshotFileAndReadMetadata(const WebURL& path, |
| 171 WebFileSystemCallbacks) = 0; | 188 WebFileSystemCallbacks) = 0; |
| 172 | 189 |
| 173 // Waits for additional results returned for the method call and returns true
if possible. | 190 // Waits for additional results returned for the method call and returns true |
| 174 // Returns false if there is no running method call corresponding for the give
n ID. | 191 // if possible. |
| 192 // Returns false if there is no running method call corresponding for the |
| 193 // given ID. |
| 175 // |callbacksId| must be the value returned by the original method call. | 194 // |callbacksId| must be the value returned by the original method call. |
| 176 virtual bool waitForAdditionalResult(int callbacksId) = 0; | 195 virtual bool waitForAdditionalResult(int callbacksId) = 0; |
| 177 | 196 |
| 178 protected: | 197 protected: |
| 179 virtual ~WebFileSystem() {} | 198 virtual ~WebFileSystem() {} |
| 180 }; | 199 }; |
| 181 | 200 |
| 182 } // namespace blink | 201 } // namespace blink |
| 183 | 202 |
| 184 #endif | 203 #endif |
| OLD | NEW |