| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" | 5 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const base::Time& last_access_time, | 144 const base::Time& last_access_time, |
| 145 const base::Time& last_modified_time, | 145 const base::Time& last_modified_time, |
| 146 const StatusCallback& callback) { | 146 const StatusCallback& callback) { |
| 147 NOTIMPLEMENTED(); | 147 NOTIMPLEMENTED(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void RemoteFileSystemOperation::OpenFile(const GURL& path, | 150 void RemoteFileSystemOperation::OpenFile(const GURL& path, |
| 151 int file_flags, | 151 int file_flags, |
| 152 base::ProcessHandle peer_handle, | 152 base::ProcessHandle peer_handle, |
| 153 const OpenFileCallback& callback) { | 153 const OpenFileCallback& callback) { |
| 154 // TODO(zelidrag): Implement file write operations. | |
| 155 if ((file_flags & base::PLATFORM_FILE_CREATE) || | |
| 156 (file_flags & base::PLATFORM_FILE_WRITE) || | |
| 157 (file_flags & base::PLATFORM_FILE_EXCLUSIVE_WRITE) || | |
| 158 (file_flags & base::PLATFORM_FILE_CREATE_ALWAYS) || | |
| 159 (file_flags & base::PLATFORM_FILE_OPEN_TRUNCATED) || | |
| 160 (file_flags & base::PLATFORM_FILE_DELETE_ON_CLOSE)) { | |
| 161 NOTIMPLEMENTED() << "File write operations not supported " << path.spec(); | |
| 162 return; | |
| 163 } | |
| 164 DCHECK(SetPendingOperationType(kOperationOpenFile)); | 154 DCHECK(SetPendingOperationType(kOperationOpenFile)); |
| 165 remote_proxy_->OpenFile( | 155 remote_proxy_->OpenFile( |
| 166 path, | 156 path, |
| 167 file_flags, | 157 file_flags, |
| 168 peer_handle, | 158 peer_handle, |
| 169 base::Bind(&RemoteFileSystemOperation::DidOpenFile, | 159 base::Bind(&RemoteFileSystemOperation::DidOpenFile, |
| 170 base::Owned(this), callback)); | 160 base::Owned(this), callback)); |
| 171 } | 161 } |
| 172 | 162 |
| 163 void RemoteFileSystemOperation::NotifyFileClosed( |
| 164 const GURL& path, const StatusCallback& callback) { |
| 165 DCHECK(SetPendingOperationType(kOperationFileClosed)); |
| 166 remote_proxy_->NotifyFileClosed(path, callback); |
| 167 } |
| 168 |
| 173 fileapi::FileSystemOperation* | 169 fileapi::FileSystemOperation* |
| 174 RemoteFileSystemOperation::AsFileSystemOperation() { | 170 RemoteFileSystemOperation::AsFileSystemOperation() { |
| 175 NOTIMPLEMENTED(); | 171 NOTIMPLEMENTED(); |
| 176 return NULL; | 172 return NULL; |
| 177 } | 173 } |
| 178 | 174 |
| 179 void RemoteFileSystemOperation::CreateSnapshotFile( | 175 void RemoteFileSystemOperation::CreateSnapshotFile( |
| 180 const GURL& path, | 176 const GURL& path, |
| 181 const SnapshotFileCallback& callback) { | 177 const SnapshotFileCallback& callback) { |
| 182 DCHECK(SetPendingOperationType(kOperationCreateSnapshotFile)); | 178 DCHECK(SetPendingOperationType(kOperationCreateSnapshotFile)); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 259 |
| 264 void RemoteFileSystemOperation::DidOpenFile( | 260 void RemoteFileSystemOperation::DidOpenFile( |
| 265 const OpenFileCallback& callback, | 261 const OpenFileCallback& callback, |
| 266 base::PlatformFileError result, | 262 base::PlatformFileError result, |
| 267 base::PlatformFile file, | 263 base::PlatformFile file, |
| 268 base::ProcessHandle peer_handle) { | 264 base::ProcessHandle peer_handle) { |
| 269 callback.Run(result, file, peer_handle); | 265 callback.Run(result, file, peer_handle); |
| 270 } | 266 } |
| 271 | 267 |
| 272 } // namespace chromeos | 268 } // namespace chromeos |
| OLD | NEW |