OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/fileapi/file_system_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 quota_util_->proxy()->EndUpdateOrigin(origin_url_, type_); | 56 quota_util_->proxy()->EndUpdateOrigin(origin_url_, type_); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 FileSystemOperation::FileSystemOperation( | 60 FileSystemOperation::FileSystemOperation( |
61 FileSystemCallbackDispatcher* dispatcher, | 61 FileSystemCallbackDispatcher* dispatcher, |
62 scoped_refptr<base::MessageLoopProxy> proxy, | 62 scoped_refptr<base::MessageLoopProxy> proxy, |
63 FileSystemContext* file_system_context) | 63 FileSystemContext* file_system_context) |
64 : proxy_(proxy), | 64 : proxy_(proxy), |
65 dispatcher_(dispatcher), | 65 dispatcher_(dispatcher), |
66 operation_context_(file_system_context, NULL), | 66 operation_context_(file_system_context, NULL) { |
67 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | |
68 #ifndef NDEBUG | 67 #ifndef NDEBUG |
69 pending_operation_ = kOperationNone; | 68 pending_operation_ = kOperationNone; |
70 #endif | 69 #endif |
71 } | 70 } |
72 | 71 |
73 FileSystemOperation::~FileSystemOperation() { | 72 FileSystemOperation::~FileSystemOperation() { |
74 if (file_writer_delegate_.get()) { | 73 if (file_writer_delegate_.get()) { |
75 FileSystemOperationContext* c = | 74 FileSystemOperationContext* c = |
76 new FileSystemOperationContext(operation_context_); | 75 new FileSystemOperationContext(operation_context_); |
77 base::FileUtilProxy::RelayClose( | 76 base::FileUtilProxy::RelayClose( |
78 proxy_, | 77 proxy_, |
79 base::Bind(&FileSystemFileUtil::Close, | 78 base::Bind(&FileSystemFileUtil::Close, |
80 base::Unretained(c->src_file_util()), | 79 base::Unretained(c->src_file_util()), |
81 base::Owned(c)), | 80 base::Owned(c)), |
82 file_writer_delegate_->file(), | 81 file_writer_delegate_->file(), |
83 FileSystemFileUtilProxy::StatusCallback()); | 82 base::FileUtilProxy::StatusCallback()); |
84 } | 83 } |
85 } | 84 } |
86 | 85 |
87 void FileSystemOperation::OpenFileSystem( | 86 void FileSystemOperation::OpenFileSystem( |
88 const GURL& origin_url, fileapi::FileSystemType type, bool create) { | 87 const GURL& origin_url, fileapi::FileSystemType type, bool create) { |
89 #ifndef NDEBUG | 88 #ifndef NDEBUG |
90 DCHECK(kOperationNone == pending_operation_); | 89 DCHECK(kOperationNone == pending_operation_); |
91 pending_operation_ = static_cast<FileSystemOperation::OperationType>( | 90 pending_operation_ = static_cast<FileSystemOperation::OperationType>( |
92 kOperationOpenFileSystem); | 91 kOperationOpenFileSystem); |
93 #endif | 92 #endif |
94 | 93 |
95 DCHECK(file_system_context()); | 94 DCHECK(file_system_context()); |
96 operation_context_.set_src_origin_url(origin_url); | 95 operation_context_.set_src_origin_url(origin_url); |
97 operation_context_.set_src_type(type); | 96 operation_context_.set_src_type(type); |
98 // TODO(ericu): We don't really need to make this call if !create. | 97 // TODO(ericu): We don't really need to make this call if !create. |
99 // Also, in the future we won't need it either way, as long as we do all | 98 // Also, in the future we won't need it either way, as long as we do all |
100 // permission+quota checks beforehand. We only need it now because we have to | 99 // permission+quota checks beforehand. We only need it now because we have to |
101 // create an unpredictable directory name. Without that, we could lazily | 100 // create an unpredictable directory name. Without that, we could lazily |
102 // create the root later on the first filesystem write operation, and just | 101 // create the root later on the first filesystem write operation, and just |
103 // return GetFileSystemRootURI() here. | 102 // return GetFileSystemRootURI() here. |
104 file_system_context()->path_manager()->ValidateFileSystemRootAndGetURL( | 103 file_system_context()->path_manager()->ValidateFileSystemRootAndGetURL( |
105 origin_url, type, create, | 104 origin_url, type, create, |
106 base::Bind(&FileSystemOperation::DidGetRootPath, | 105 base::Bind(&FileSystemOperation::DidGetRootPath, |
107 weak_factory_.GetWeakPtr())); | 106 base::Owned(this))); |
108 } | 107 } |
109 | 108 |
110 void FileSystemOperation::CreateFile(const GURL& path, | 109 void FileSystemOperation::CreateFile(const GURL& path, |
111 bool exclusive) { | 110 bool exclusive) { |
112 #ifndef NDEBUG | 111 #ifndef NDEBUG |
113 DCHECK(kOperationNone == pending_operation_); | 112 DCHECK(kOperationNone == pending_operation_); |
114 pending_operation_ = kOperationCreateFile; | 113 pending_operation_ = kOperationCreateFile; |
115 #endif | 114 #endif |
116 if (!SetupSrcContextForWrite(path, true)) { | 115 if (!SetupSrcContextForWrite(path, true)) { |
117 delete this; | 116 delete this; |
118 return; | 117 return; |
119 } | 118 } |
120 exclusive_ = exclusive; | |
121 | |
122 GetUsageAndQuotaThenCallback( | 119 GetUsageAndQuotaThenCallback( |
123 operation_context_.src_origin_url(), | 120 operation_context_.src_origin_url(), |
124 base::Bind(&FileSystemOperation::DelayedCreateFileForQuota, | 121 base::Bind(&FileSystemOperation::DelayedCreateFileForQuota, |
125 weak_factory_.GetWeakPtr())); | 122 base::Unretained(this), exclusive)); |
126 } | 123 } |
127 | 124 |
128 void FileSystemOperation::DelayedCreateFileForQuota( | 125 void FileSystemOperation::DelayedCreateFileForQuota( |
| 126 bool exclusive, |
129 quota::QuotaStatusCode status, int64 usage, int64 quota) { | 127 quota::QuotaStatusCode status, int64 usage, int64 quota) { |
130 operation_context_.set_allowed_bytes_growth(quota - usage); | 128 operation_context_.set_allowed_bytes_growth(quota - usage); |
131 | 129 |
132 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 130 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
133 file_system_context(), | 131 file_system_context(), |
134 operation_context_.src_origin_url(), | 132 operation_context_.src_origin_url(), |
135 operation_context_.src_type())); | 133 operation_context_.src_type())); |
136 | 134 |
137 FileSystemFileUtilProxy::EnsureFileExists( | 135 FileSystemFileUtilProxy::EnsureFileExists( |
138 operation_context_, | 136 operation_context_, |
139 proxy_, | 137 proxy_, |
140 src_virtual_path_, | 138 src_virtual_path_, |
141 base::Bind( | 139 base::Bind( |
142 exclusive_ ? &FileSystemOperation::DidEnsureFileExistsExclusive | 140 exclusive ? &FileSystemOperation::DidEnsureFileExistsExclusive |
143 : &FileSystemOperation::DidEnsureFileExistsNonExclusive, | 141 : &FileSystemOperation::DidEnsureFileExistsNonExclusive, |
144 weak_factory_.GetWeakPtr())); | 142 base::Owned(this))); |
145 } | 143 } |
146 | 144 |
147 void FileSystemOperation::CreateDirectory(const GURL& path, | 145 void FileSystemOperation::CreateDirectory(const GURL& path, |
148 bool exclusive, | 146 bool exclusive, |
149 bool recursive) { | 147 bool recursive) { |
150 #ifndef NDEBUG | 148 #ifndef NDEBUG |
151 DCHECK(kOperationNone == pending_operation_); | 149 DCHECK(kOperationNone == pending_operation_); |
152 pending_operation_ = kOperationCreateDirectory; | 150 pending_operation_ = kOperationCreateDirectory; |
153 #endif | 151 #endif |
154 if (!SetupSrcContextForWrite(path, true)) { | 152 if (!SetupSrcContextForWrite(path, true)) { |
155 delete this; | 153 delete this; |
156 return; | 154 return; |
157 } | 155 } |
158 exclusive_ = exclusive; | |
159 recursive_ = recursive; | |
160 | |
161 GetUsageAndQuotaThenCallback( | 156 GetUsageAndQuotaThenCallback( |
162 operation_context_.src_origin_url(), | 157 operation_context_.src_origin_url(), |
163 base::Bind(&FileSystemOperation::DelayedCreateDirectoryForQuota, | 158 base::Bind(&FileSystemOperation::DelayedCreateDirectoryForQuota, |
164 weak_factory_.GetWeakPtr())); | 159 base::Unretained(this), exclusive, recursive)); |
165 } | 160 } |
166 | 161 |
167 void FileSystemOperation::DelayedCreateDirectoryForQuota( | 162 void FileSystemOperation::DelayedCreateDirectoryForQuota( |
| 163 bool exclusive, bool recursive, |
168 quota::QuotaStatusCode status, int64 usage, int64 quota) { | 164 quota::QuotaStatusCode status, int64 usage, int64 quota) { |
169 operation_context_.set_allowed_bytes_growth(quota - usage); | 165 operation_context_.set_allowed_bytes_growth(quota - usage); |
170 | 166 |
171 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 167 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
172 file_system_context(), | 168 file_system_context(), |
173 operation_context_.src_origin_url(), | 169 operation_context_.src_origin_url(), |
174 operation_context_.src_type())); | 170 operation_context_.src_type())); |
175 | 171 |
176 FileSystemFileUtilProxy::CreateDirectory( | 172 base::FileUtilProxy::RelayFileTask( |
177 operation_context_, proxy_, src_virtual_path_, exclusive_, | 173 proxy_, FROM_HERE, |
178 recursive_, | 174 base::Bind(&FileSystemFileUtil::CreateDirectory, |
| 175 base::Unretained(operation_context_.src_file_util()), |
| 176 &operation_context_, |
| 177 src_virtual_path_, exclusive, recursive), |
179 base::Bind(&FileSystemOperation::DidFinishFileOperation, | 178 base::Bind(&FileSystemOperation::DidFinishFileOperation, |
180 weak_factory_.GetWeakPtr())); | 179 base::Owned(this))); |
181 } | 180 } |
182 | 181 |
183 void FileSystemOperation::Copy(const GURL& src_path, | 182 void FileSystemOperation::Copy(const GURL& src_path, |
184 const GURL& dest_path) { | 183 const GURL& dest_path) { |
185 #ifndef NDEBUG | 184 #ifndef NDEBUG |
186 DCHECK(kOperationNone == pending_operation_); | 185 DCHECK(kOperationNone == pending_operation_); |
187 pending_operation_ = kOperationCopy; | 186 pending_operation_ = kOperationCopy; |
188 #endif | 187 #endif |
189 if (!SetupSrcContextForRead(src_path) || | 188 if (!SetupSrcContextForRead(src_path) || |
190 !SetupDestContextForWrite(dest_path, true)) { | 189 !SetupDestContextForWrite(dest_path, true)) { |
191 delete this; | 190 delete this; |
192 return; | 191 return; |
193 } | 192 } |
194 | 193 |
195 GetUsageAndQuotaThenCallback( | 194 GetUsageAndQuotaThenCallback( |
196 operation_context_.dest_origin_url(), | 195 operation_context_.dest_origin_url(), |
197 base::Bind(&FileSystemOperation::DelayedCopyForQuota, | 196 base::Bind(&FileSystemOperation::DelayedCopyForQuota, |
198 weak_factory_.GetWeakPtr())); | 197 base::Unretained(this))); |
199 } | 198 } |
200 | 199 |
201 void FileSystemOperation::DelayedCopyForQuota(quota::QuotaStatusCode status, | 200 void FileSystemOperation::DelayedCopyForQuota(quota::QuotaStatusCode status, |
202 int64 usage, int64 quota) { | 201 int64 usage, int64 quota) { |
203 operation_context_.set_allowed_bytes_growth(quota - usage); | 202 operation_context_.set_allowed_bytes_growth(quota - usage); |
204 | 203 |
205 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 204 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
206 file_system_context(), | 205 file_system_context(), |
207 operation_context_.dest_origin_url(), | 206 operation_context_.dest_origin_url(), |
208 operation_context_.dest_type())); | 207 operation_context_.dest_type())); |
209 | 208 |
210 FileSystemFileUtilProxy::Copy( | 209 base::FileUtilProxy::RelayFileTask( |
211 operation_context_, proxy_, src_virtual_path_, | 210 proxy_, FROM_HERE, |
212 dest_virtual_path_, | 211 base::Bind(&FileSystemFileUtil::Copy, |
| 212 base::Unretained(operation_context_.src_file_util()), |
| 213 &operation_context_, |
| 214 src_virtual_path_, dest_virtual_path_), |
213 base::Bind(&FileSystemOperation::DidFinishFileOperation, | 215 base::Bind(&FileSystemOperation::DidFinishFileOperation, |
214 weak_factory_.GetWeakPtr())); | 216 base::Owned(this))); |
215 } | 217 } |
216 | 218 |
217 void FileSystemOperation::Move(const GURL& src_path, | 219 void FileSystemOperation::Move(const GURL& src_path, |
218 const GURL& dest_path) { | 220 const GURL& dest_path) { |
219 #ifndef NDEBUG | 221 #ifndef NDEBUG |
220 DCHECK(kOperationNone == pending_operation_); | 222 DCHECK(kOperationNone == pending_operation_); |
221 pending_operation_ = kOperationMove; | 223 pending_operation_ = kOperationMove; |
222 #endif | 224 #endif |
223 if (!SetupSrcContextForWrite(src_path, false) || | 225 if (!SetupSrcContextForWrite(src_path, false) || |
224 !SetupDestContextForWrite(dest_path, true)) { | 226 !SetupDestContextForWrite(dest_path, true)) { |
225 delete this; | 227 delete this; |
226 return; | 228 return; |
227 } | 229 } |
228 | 230 |
229 GetUsageAndQuotaThenCallback( | 231 GetUsageAndQuotaThenCallback( |
230 operation_context_.dest_origin_url(), | 232 operation_context_.dest_origin_url(), |
231 base::Bind(&FileSystemOperation::DelayedMoveForQuota, | 233 base::Bind(&FileSystemOperation::DelayedMoveForQuota, |
232 weak_factory_.GetWeakPtr())); | 234 base::Unretained(this))); |
233 } | 235 } |
234 | 236 |
235 void FileSystemOperation::DelayedMoveForQuota(quota::QuotaStatusCode status, | 237 void FileSystemOperation::DelayedMoveForQuota(quota::QuotaStatusCode status, |
236 int64 usage, int64 quota) { | 238 int64 usage, int64 quota) { |
237 operation_context_.set_allowed_bytes_growth(quota - usage); | 239 operation_context_.set_allowed_bytes_growth(quota - usage); |
238 | 240 |
239 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 241 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
240 file_system_context(), | 242 file_system_context(), |
241 operation_context_.dest_origin_url(), | 243 operation_context_.dest_origin_url(), |
242 operation_context_.dest_type())); | 244 operation_context_.dest_type())); |
243 | 245 |
244 FileSystemFileUtilProxy::Move( | 246 base::FileUtilProxy::RelayFileTask( |
245 operation_context_, proxy_, src_virtual_path_, | 247 proxy_, FROM_HERE, |
246 dest_virtual_path_, | 248 base::Bind(&FileSystemFileUtil::Move, |
| 249 base::Unretained(operation_context_.src_file_util()), |
| 250 &operation_context_, |
| 251 src_virtual_path_, dest_virtual_path_), |
247 base::Bind(&FileSystemOperation::DidFinishFileOperation, | 252 base::Bind(&FileSystemOperation::DidFinishFileOperation, |
248 weak_factory_.GetWeakPtr())); | 253 base::Owned(this))); |
249 } | 254 } |
250 | 255 |
251 void FileSystemOperation::DirectoryExists(const GURL& path) { | 256 void FileSystemOperation::DirectoryExists(const GURL& path) { |
252 #ifndef NDEBUG | 257 #ifndef NDEBUG |
253 DCHECK(kOperationNone == pending_operation_); | 258 DCHECK(kOperationNone == pending_operation_); |
254 pending_operation_ = kOperationDirectoryExists; | 259 pending_operation_ = kOperationDirectoryExists; |
255 #endif | 260 #endif |
256 if (!SetupSrcContextForRead(path)) { | 261 if (!SetupSrcContextForRead(path)) { |
257 delete this; | 262 delete this; |
258 return; | 263 return; |
259 } | 264 } |
260 | 265 |
261 FileSystemFileUtilProxy::GetFileInfo( | 266 FileSystemFileUtilProxy::GetFileInfo( |
262 operation_context_, proxy_, src_virtual_path_, | 267 operation_context_, proxy_, src_virtual_path_, |
263 base::Bind(&FileSystemOperation::DidDirectoryExists, | 268 base::Bind(&FileSystemOperation::DidDirectoryExists, base::Owned(this))); |
264 weak_factory_.GetWeakPtr())); | |
265 } | 269 } |
266 | 270 |
267 void FileSystemOperation::FileExists(const GURL& path) { | 271 void FileSystemOperation::FileExists(const GURL& path) { |
268 #ifndef NDEBUG | 272 #ifndef NDEBUG |
269 DCHECK(kOperationNone == pending_operation_); | 273 DCHECK(kOperationNone == pending_operation_); |
270 pending_operation_ = kOperationFileExists; | 274 pending_operation_ = kOperationFileExists; |
271 #endif | 275 #endif |
272 if (!SetupSrcContextForRead(path)) { | 276 if (!SetupSrcContextForRead(path)) { |
273 delete this; | 277 delete this; |
274 return; | 278 return; |
275 } | 279 } |
276 | 280 |
277 FileSystemFileUtilProxy::GetFileInfo( | 281 FileSystemFileUtilProxy::GetFileInfo( |
278 operation_context_, proxy_, src_virtual_path_, | 282 operation_context_, proxy_, src_virtual_path_, |
279 base::Bind(&FileSystemOperation::DidFileExists, | 283 base::Bind(&FileSystemOperation::DidFileExists, base::Owned(this))); |
280 weak_factory_.GetWeakPtr())); | |
281 } | 284 } |
282 | 285 |
283 void FileSystemOperation::GetMetadata(const GURL& path) { | 286 void FileSystemOperation::GetMetadata(const GURL& path) { |
284 #ifndef NDEBUG | 287 #ifndef NDEBUG |
285 DCHECK(kOperationNone == pending_operation_); | 288 DCHECK(kOperationNone == pending_operation_); |
286 pending_operation_ = kOperationGetMetadata; | 289 pending_operation_ = kOperationGetMetadata; |
287 #endif | 290 #endif |
288 if (!SetupSrcContextForRead(path)) { | 291 if (!SetupSrcContextForRead(path)) { |
289 delete this; | 292 delete this; |
290 return; | 293 return; |
291 } | 294 } |
292 | 295 |
293 FileSystemFileUtilProxy::GetFileInfo( | 296 FileSystemFileUtilProxy::GetFileInfo( |
294 operation_context_, proxy_, src_virtual_path_, | 297 operation_context_, proxy_, src_virtual_path_, |
295 base::Bind(&FileSystemOperation::DidGetMetadata, | 298 base::Bind(&FileSystemOperation::DidGetMetadata, base::Owned(this))); |
296 weak_factory_.GetWeakPtr())); | |
297 } | 299 } |
298 | 300 |
299 void FileSystemOperation::ReadDirectory(const GURL& path) { | 301 void FileSystemOperation::ReadDirectory(const GURL& path) { |
300 #ifndef NDEBUG | 302 #ifndef NDEBUG |
301 DCHECK(kOperationNone == pending_operation_); | 303 DCHECK(kOperationNone == pending_operation_); |
302 pending_operation_ = kOperationReadDirectory; | 304 pending_operation_ = kOperationReadDirectory; |
303 #endif | 305 #endif |
304 if (!SetupSrcContextForRead(path)) { | 306 if (!SetupSrcContextForRead(path)) { |
305 delete this; | 307 delete this; |
306 return; | 308 return; |
307 } | 309 } |
308 | 310 |
309 FileSystemFileUtilProxy::ReadDirectory( | 311 FileSystemFileUtilProxy::ReadDirectory( |
310 operation_context_, proxy_, src_virtual_path_, | 312 operation_context_, proxy_, src_virtual_path_, |
311 base::Bind(&FileSystemOperation::DidReadDirectory, | 313 base::Bind(&FileSystemOperation::DidReadDirectory, base::Owned(this))); |
312 weak_factory_.GetWeakPtr())); | |
313 } | 314 } |
314 | 315 |
315 void FileSystemOperation::Remove(const GURL& path, bool recursive) { | 316 void FileSystemOperation::Remove(const GURL& path, bool recursive) { |
316 #ifndef NDEBUG | 317 #ifndef NDEBUG |
317 DCHECK(kOperationNone == pending_operation_); | 318 DCHECK(kOperationNone == pending_operation_); |
318 pending_operation_ = kOperationRemove; | 319 pending_operation_ = kOperationRemove; |
319 #endif | 320 #endif |
320 if (!SetupSrcContextForWrite(path, false)) { | 321 if (!SetupSrcContextForWrite(path, false)) { |
321 delete this; | 322 delete this; |
322 return; | 323 return; |
323 } | 324 } |
324 | 325 |
325 FileSystemFileUtilProxy::Delete( | 326 base::FileUtilProxy::RelayFileTask( |
326 operation_context_, proxy_, src_virtual_path_, recursive, | 327 proxy_, FROM_HERE, |
| 328 base::Bind(&FileSystemFileUtil::Delete, |
| 329 base::Unretained(operation_context_.src_file_util()), |
| 330 &operation_context_, |
| 331 src_virtual_path_, recursive), |
327 base::Bind(&FileSystemOperation::DidFinishFileOperation, | 332 base::Bind(&FileSystemOperation::DidFinishFileOperation, |
328 weak_factory_.GetWeakPtr())); | 333 base::Owned(this))); |
329 } | 334 } |
330 | 335 |
331 void FileSystemOperation::Write( | 336 void FileSystemOperation::Write( |
332 scoped_refptr<net::URLRequestContext> url_request_context, | 337 scoped_refptr<net::URLRequestContext> url_request_context, |
333 const GURL& path, | 338 const GURL& path, |
334 const GURL& blob_url, | 339 const GURL& blob_url, |
335 int64 offset) { | 340 int64 offset) { |
336 #ifndef NDEBUG | 341 #ifndef NDEBUG |
337 DCHECK(kOperationNone == pending_operation_); | 342 DCHECK(kOperationNone == pending_operation_); |
338 pending_operation_ = kOperationWrite; | 343 pending_operation_ = kOperationWrite; |
339 #endif | 344 #endif |
340 if (!SetupSrcContextForWrite(path, true)) { | 345 if (!SetupSrcContextForWrite(path, true)) { |
341 delete this; | 346 delete this; |
342 return; | 347 return; |
343 } | 348 } |
344 DCHECK(blob_url.is_valid()); | 349 DCHECK(blob_url.is_valid()); |
345 file_writer_delegate_.reset(new FileWriterDelegate(this, offset, proxy_)); | 350 file_writer_delegate_.reset(new FileWriterDelegate(this, offset, proxy_)); |
346 blob_request_.reset( | 351 blob_request_.reset( |
347 new net::URLRequest(blob_url, file_writer_delegate_.get())); | 352 new net::URLRequest(blob_url, file_writer_delegate_.get())); |
348 blob_request_->set_context(url_request_context); | 353 blob_request_->set_context(url_request_context); |
349 | 354 |
350 GetUsageAndQuotaThenCallback( | 355 GetUsageAndQuotaThenCallback( |
351 operation_context_.src_origin_url(), | 356 operation_context_.src_origin_url(), |
352 base::Bind(&FileSystemOperation::DelayedWriteForQuota, | 357 base::Bind(&FileSystemOperation::DelayedWriteForQuota, |
353 weak_factory_.GetWeakPtr())); | 358 base::Unretained(this))); |
354 } | 359 } |
355 | 360 |
356 void FileSystemOperation::DelayedWriteForQuota(quota::QuotaStatusCode status, | 361 void FileSystemOperation::DelayedWriteForQuota(quota::QuotaStatusCode status, |
357 int64 usage, int64 quota) { | 362 int64 usage, int64 quota) { |
358 operation_context_.set_allowed_bytes_growth(quota - usage); | 363 operation_context_.set_allowed_bytes_growth(quota - usage); |
359 | 364 |
360 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 365 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
361 file_system_context(), | 366 file_system_context(), |
362 operation_context_.src_origin_url(), | 367 operation_context_.src_origin_url(), |
363 operation_context_.src_type())); | 368 operation_context_.src_type())); |
364 | 369 |
365 int file_flags = base::PLATFORM_FILE_OPEN | | 370 int file_flags = base::PLATFORM_FILE_OPEN | |
366 base::PLATFORM_FILE_WRITE | | 371 base::PLATFORM_FILE_WRITE | |
367 base::PLATFORM_FILE_ASYNC; | 372 base::PLATFORM_FILE_ASYNC; |
368 | 373 |
369 base::FileUtilProxy::RelayCreateOrOpen( | 374 base::FileUtilProxy::RelayCreateOrOpen( |
370 proxy_, | 375 proxy_, |
371 base::Bind(&FileSystemFileUtil::CreateOrOpen, | 376 base::Bind(&FileSystemFileUtil::CreateOrOpen, |
372 base::Unretained(operation_context_.src_file_util()), | 377 base::Unretained(operation_context_.src_file_util()), |
373 base::Unretained(&operation_context_), | 378 &operation_context_, |
374 src_virtual_path_, file_flags), | 379 src_virtual_path_, file_flags), |
375 base::Bind(&FileSystemFileUtil::Close, | 380 base::Bind(&FileSystemFileUtil::Close, |
376 base::Unretained(operation_context_.src_file_util()), | 381 base::Unretained(operation_context_.src_file_util()), |
377 base::Unretained(&operation_context_)), | 382 &operation_context_), |
378 base::Bind(&FileSystemOperation::OnFileOpenedForWrite, | 383 base::Bind(&FileSystemOperation::OnFileOpenedForWrite, |
379 weak_factory_.GetWeakPtr())); | 384 base::Unretained(this))); |
380 } | 385 } |
381 | 386 |
382 void FileSystemOperation::Truncate(const GURL& path, int64 length) { | 387 void FileSystemOperation::Truncate(const GURL& path, int64 length) { |
383 #ifndef NDEBUG | 388 #ifndef NDEBUG |
384 DCHECK(kOperationNone == pending_operation_); | 389 DCHECK(kOperationNone == pending_operation_); |
385 pending_operation_ = kOperationTruncate; | 390 pending_operation_ = kOperationTruncate; |
386 #endif | 391 #endif |
387 if (!SetupSrcContextForWrite(path, false)) { | 392 if (!SetupSrcContextForWrite(path, false)) { |
388 delete this; | 393 delete this; |
389 return; | 394 return; |
390 } | 395 } |
391 length_ = length; | |
392 | |
393 GetUsageAndQuotaThenCallback( | 396 GetUsageAndQuotaThenCallback( |
394 operation_context_.src_origin_url(), | 397 operation_context_.src_origin_url(), |
395 base::Bind(&FileSystemOperation::DelayedTruncateForQuota, | 398 base::Bind(&FileSystemOperation::DelayedTruncateForQuota, |
396 weak_factory_.GetWeakPtr())); | 399 base::Unretained(this), length)); |
397 } | 400 } |
398 | 401 |
399 void FileSystemOperation::DelayedTruncateForQuota(quota::QuotaStatusCode status, | 402 void FileSystemOperation::DelayedTruncateForQuota(int64 length, |
| 403 quota::QuotaStatusCode status, |
400 int64 usage, int64 quota) { | 404 int64 usage, int64 quota) { |
401 operation_context_.set_allowed_bytes_growth(quota - usage); | 405 operation_context_.set_allowed_bytes_growth(quota - usage); |
402 | 406 |
403 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 407 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
404 file_system_context(), | 408 file_system_context(), |
405 operation_context_.src_origin_url(), | 409 operation_context_.src_origin_url(), |
406 operation_context_.src_type())); | 410 operation_context_.src_type())); |
407 | 411 |
408 FileSystemFileUtilProxy::Truncate( | 412 base::FileUtilProxy::RelayFileTask( |
409 operation_context_, proxy_, src_virtual_path_, length_, | 413 proxy_, FROM_HERE, |
| 414 base::Bind(&FileSystemFileUtil::Truncate, |
| 415 base::Unretained(operation_context_.src_file_util()), |
| 416 &operation_context_, |
| 417 src_virtual_path_, length), |
410 base::Bind(&FileSystemOperation::DidFinishFileOperation, | 418 base::Bind(&FileSystemOperation::DidFinishFileOperation, |
411 weak_factory_.GetWeakPtr())); | 419 base::Owned(this))); |
412 } | 420 } |
413 | 421 |
414 void FileSystemOperation::TouchFile(const GURL& path, | 422 void FileSystemOperation::TouchFile(const GURL& path, |
415 const base::Time& last_access_time, | 423 const base::Time& last_access_time, |
416 const base::Time& last_modified_time) { | 424 const base::Time& last_modified_time) { |
417 #ifndef NDEBUG | 425 #ifndef NDEBUG |
418 DCHECK(kOperationNone == pending_operation_); | 426 DCHECK(kOperationNone == pending_operation_); |
419 pending_operation_ = kOperationTouchFile; | 427 pending_operation_ = kOperationTouchFile; |
420 #endif | 428 #endif |
421 if (!SetupSrcContextForWrite(path, true)) { | 429 if (!SetupSrcContextForWrite(path, true)) { |
422 delete this; | 430 delete this; |
423 return; | 431 return; |
424 } | 432 } |
425 | 433 |
426 FileSystemFileUtilProxy::Touch( | 434 base::FileUtilProxy::RelayFileTask( |
427 operation_context_, proxy_, src_virtual_path_, | 435 proxy_, FROM_HERE, |
428 last_access_time, last_modified_time, | 436 base::Bind(&FileSystemFileUtil::Touch, |
429 base::Bind(&FileSystemOperation::DidTouchFile, | 437 base::Unretained(operation_context_.src_file_util()), |
430 weak_factory_.GetWeakPtr())); | 438 &operation_context_, |
| 439 src_virtual_path_, last_access_time, last_modified_time), |
| 440 base::Bind(&FileSystemOperation::DidTouchFile, base::Owned(this))); |
431 } | 441 } |
432 | 442 |
433 void FileSystemOperation::OpenFile(const GURL& path, | 443 void FileSystemOperation::OpenFile(const GURL& path, |
434 int file_flags, | 444 int file_flags, |
435 base::ProcessHandle peer_handle) { | 445 base::ProcessHandle peer_handle) { |
436 #ifndef NDEBUG | 446 #ifndef NDEBUG |
437 DCHECK(kOperationNone == pending_operation_); | 447 DCHECK(kOperationNone == pending_operation_); |
438 pending_operation_ = kOperationOpenFile; | 448 pending_operation_ = kOperationOpenFile; |
439 #endif | 449 #endif |
440 peer_handle_ = peer_handle; | 450 peer_handle_ = peer_handle; |
(...skipping 13 matching lines...) Expand all Loading... |
454 if (!SetupSrcContextForWrite(path, true)) { | 464 if (!SetupSrcContextForWrite(path, true)) { |
455 delete this; | 465 delete this; |
456 return; | 466 return; |
457 } | 467 } |
458 } else { | 468 } else { |
459 if (!SetupSrcContextForRead(path)) { | 469 if (!SetupSrcContextForRead(path)) { |
460 delete this; | 470 delete this; |
461 return; | 471 return; |
462 } | 472 } |
463 } | 473 } |
464 file_flags_ = file_flags; | |
465 | |
466 GetUsageAndQuotaThenCallback( | 474 GetUsageAndQuotaThenCallback( |
467 operation_context_.src_origin_url(), | 475 operation_context_.src_origin_url(), |
468 base::Bind(&FileSystemOperation::DelayedOpenFileForQuota, | 476 base::Bind(&FileSystemOperation::DelayedOpenFileForQuota, |
469 weak_factory_.GetWeakPtr())); | 477 base::Unretained(this), file_flags)); |
470 } | 478 } |
471 | 479 |
472 void FileSystemOperation::DelayedOpenFileForQuota(quota::QuotaStatusCode status, | 480 void FileSystemOperation::DelayedOpenFileForQuota(int file_flags, |
| 481 quota::QuotaStatusCode status, |
473 int64 usage, int64 quota) { | 482 int64 usage, int64 quota) { |
474 operation_context_.set_allowed_bytes_growth(quota - usage); | 483 operation_context_.set_allowed_bytes_growth(quota - usage); |
475 | 484 |
476 quota_util_helper_.reset(new ScopedQuotaUtilHelper( | 485 quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
477 file_system_context(), | 486 file_system_context(), |
478 operation_context_.src_origin_url(), | 487 operation_context_.src_origin_url(), |
479 operation_context_.src_type())); | 488 operation_context_.src_type())); |
480 | 489 |
481 base::FileUtilProxy::RelayCreateOrOpen( | 490 base::FileUtilProxy::RelayCreateOrOpen( |
482 proxy_, | 491 proxy_, |
483 base::Bind(&FileSystemFileUtil::CreateOrOpen, | 492 base::Bind(&FileSystemFileUtil::CreateOrOpen, |
484 base::Unretained(operation_context_.src_file_util()), | 493 base::Unretained(operation_context_.src_file_util()), |
485 base::Unretained(&operation_context_), | 494 &operation_context_, |
486 src_virtual_path_, file_flags_), | 495 src_virtual_path_, file_flags), |
487 base::Bind(&FileSystemFileUtil::Close, | 496 base::Bind(&FileSystemFileUtil::Close, |
488 base::Unretained(operation_context_.src_file_util()), | 497 base::Unretained(operation_context_.src_file_util()), |
489 base::Unretained(&operation_context_)), | 498 &operation_context_), |
490 base::Bind(&FileSystemOperation::DidOpenFile, | 499 base::Bind(&FileSystemOperation::DidOpenFile, base::Owned(this))); |
491 weak_factory_.GetWeakPtr())); | |
492 } | 500 } |
493 | 501 |
494 void FileSystemOperation::SyncGetPlatformPath(const GURL& path, | 502 void FileSystemOperation::SyncGetPlatformPath(const GURL& path, |
495 FilePath* platform_path) { | 503 FilePath* platform_path) { |
496 #ifndef NDEBUG | 504 #ifndef NDEBUG |
497 DCHECK(kOperationNone == pending_operation_); | 505 DCHECK(kOperationNone == pending_operation_); |
498 pending_operation_ = kOperationGetLocalPath; | 506 pending_operation_ = kOperationGetLocalPath; |
499 #endif | 507 #endif |
500 if (!SetupSrcContextForRead(path)) { | 508 if (!SetupSrcContextForRead(path)) { |
501 delete this; | 509 delete this; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 FileSystemTypeToQuotaStorageType( | 570 FileSystemTypeToQuotaStorageType( |
563 operation_context_.src_type()), | 571 operation_context_.src_type()), |
564 callback); | 572 callback); |
565 } | 573 } |
566 | 574 |
567 void FileSystemOperation::DidGetRootPath( | 575 void FileSystemOperation::DidGetRootPath( |
568 bool success, | 576 bool success, |
569 const FilePath& path, const std::string& name) { | 577 const FilePath& path, const std::string& name) { |
570 DCHECK(success || path.empty()); | 578 DCHECK(success || path.empty()); |
571 GURL result; | 579 GURL result; |
| 580 if (!dispatcher_.get()) |
| 581 return; |
572 // We ignore the path, and return a URL instead. The point was just to verify | 582 // We ignore the path, and return a URL instead. The point was just to verify |
573 // that we could create/find the path. | 583 // that we could create/find the path. |
574 if (success) { | 584 if (success) { |
575 result = GetFileSystemRootURI( | 585 result = GetFileSystemRootURI( |
576 operation_context_.src_origin_url(), | 586 operation_context_.src_origin_url(), |
577 operation_context_.src_type()); | 587 operation_context_.src_type()); |
578 } | 588 } |
579 if (dispatcher_.get()) | 589 dispatcher_->DidOpenFileSystem(name, result); |
580 dispatcher_->DidOpenFileSystem(name, result); | |
581 delete this; | |
582 } | 590 } |
583 | 591 |
584 void FileSystemOperation::DidEnsureFileExistsExclusive( | 592 void FileSystemOperation::DidEnsureFileExistsExclusive( |
585 base::PlatformFileError rv, bool created) { | 593 base::PlatformFileError rv, bool created) { |
586 if (rv == base::PLATFORM_FILE_OK && !created) { | 594 if (rv == base::PLATFORM_FILE_OK && !created) { |
587 if (dispatcher_.get()) | 595 if (dispatcher_.get()) |
588 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_EXISTS); | 596 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_EXISTS); |
589 delete this; | |
590 } else { | 597 } else { |
591 DidFinishFileOperation(rv); | 598 DidFinishFileOperation(rv); |
592 } | 599 } |
593 } | 600 } |
594 | 601 |
595 void FileSystemOperation::DidEnsureFileExistsNonExclusive( | 602 void FileSystemOperation::DidEnsureFileExistsNonExclusive( |
596 base::PlatformFileError rv, bool /* created */) { | 603 base::PlatformFileError rv, bool /* created */) { |
597 DidFinishFileOperation(rv); | 604 DidFinishFileOperation(rv); |
598 } | 605 } |
599 | 606 |
600 void FileSystemOperation::DidFinishFileOperation( | 607 void FileSystemOperation::DidFinishFileOperation( |
601 base::PlatformFileError rv) { | 608 base::PlatformFileError rv) { |
602 if (cancel_operation_.get()) { | 609 if (cancel_operation_.get()) { |
603 #ifndef NDEBUG | 610 #ifndef NDEBUG |
604 DCHECK(kOperationTruncate == pending_operation_); | 611 DCHECK(kOperationTruncate == pending_operation_); |
605 #endif | 612 #endif |
606 | 613 |
607 if (dispatcher_.get()) | 614 if (dispatcher_.get()) |
608 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_ABORT); | 615 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_ABORT); |
609 cancel_operation_->dispatcher_->DidSucceed(); | 616 cancel_operation_->dispatcher_->DidSucceed(); |
610 } else if (dispatcher_.get()) { | 617 } else if (dispatcher_.get()) { |
611 if (rv == base::PLATFORM_FILE_OK) | 618 if (rv == base::PLATFORM_FILE_OK) |
612 dispatcher_->DidSucceed(); | 619 dispatcher_->DidSucceed(); |
613 else | 620 else |
614 dispatcher_->DidFail(rv); | 621 dispatcher_->DidFail(rv); |
615 } | 622 } |
616 delete this; | |
617 } | 623 } |
618 | 624 |
619 void FileSystemOperation::DidDirectoryExists( | 625 void FileSystemOperation::DidDirectoryExists( |
620 base::PlatformFileError rv, | 626 base::PlatformFileError rv, |
621 const base::PlatformFileInfo& file_info, | 627 const base::PlatformFileInfo& file_info, |
622 const FilePath& unused) { | 628 const FilePath& unused) { |
623 if (!dispatcher_.get()) { | 629 if (!dispatcher_.get()) |
624 delete this; | |
625 return; | 630 return; |
626 } | |
627 if (rv == base::PLATFORM_FILE_OK) { | 631 if (rv == base::PLATFORM_FILE_OK) { |
628 if (file_info.is_directory) | 632 if (file_info.is_directory) |
629 dispatcher_->DidSucceed(); | 633 dispatcher_->DidSucceed(); |
630 else | 634 else |
631 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY); | 635 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY); |
632 } else { | 636 } else { |
633 dispatcher_->DidFail(rv); | 637 dispatcher_->DidFail(rv); |
634 } | 638 } |
635 delete this; | |
636 } | 639 } |
637 | 640 |
638 void FileSystemOperation::DidFileExists( | 641 void FileSystemOperation::DidFileExists( |
639 base::PlatformFileError rv, | 642 base::PlatformFileError rv, |
640 const base::PlatformFileInfo& file_info, | 643 const base::PlatformFileInfo& file_info, |
641 const FilePath& unused) { | 644 const FilePath& unused) { |
642 if (!dispatcher_.get()) { | 645 if (!dispatcher_.get()) |
643 delete this; | |
644 return; | 646 return; |
645 } | |
646 if (rv == base::PLATFORM_FILE_OK) { | 647 if (rv == base::PLATFORM_FILE_OK) { |
647 if (file_info.is_directory) | 648 if (file_info.is_directory) |
648 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE); | 649 dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE); |
649 else | 650 else |
650 dispatcher_->DidSucceed(); | 651 dispatcher_->DidSucceed(); |
651 } else { | 652 } else { |
652 dispatcher_->DidFail(rv); | 653 dispatcher_->DidFail(rv); |
653 } | 654 } |
654 delete this; | |
655 } | 655 } |
656 | 656 |
657 void FileSystemOperation::DidGetMetadata( | 657 void FileSystemOperation::DidGetMetadata( |
658 base::PlatformFileError rv, | 658 base::PlatformFileError rv, |
659 const base::PlatformFileInfo& file_info, | 659 const base::PlatformFileInfo& file_info, |
660 const FilePath& platform_path) { | 660 const FilePath& platform_path) { |
661 if (!dispatcher_.get()) { | 661 if (!dispatcher_.get()) |
662 delete this; | |
663 return; | 662 return; |
664 } | |
665 if (rv == base::PLATFORM_FILE_OK) | 663 if (rv == base::PLATFORM_FILE_OK) |
666 dispatcher_->DidReadMetadata(file_info, platform_path); | 664 dispatcher_->DidReadMetadata(file_info, platform_path); |
667 else | 665 else |
668 dispatcher_->DidFail(rv); | 666 dispatcher_->DidFail(rv); |
669 delete this; | |
670 } | 667 } |
671 | 668 |
672 void FileSystemOperation::DidReadDirectory( | 669 void FileSystemOperation::DidReadDirectory( |
673 base::PlatformFileError rv, | 670 base::PlatformFileError rv, |
674 const std::vector<base::FileUtilProxy::Entry>& entries) { | 671 const std::vector<base::FileUtilProxy::Entry>& entries) { |
675 if (!dispatcher_.get()) { | 672 if (!dispatcher_.get()) |
676 delete this; | |
677 return; | 673 return; |
678 } | |
679 | 674 |
680 if (rv == base::PLATFORM_FILE_OK) | 675 if (rv == base::PLATFORM_FILE_OK) |
681 dispatcher_->DidReadDirectory(entries, false /* has_more */); | 676 dispatcher_->DidReadDirectory(entries, false /* has_more */); |
682 else | 677 else |
683 dispatcher_->DidFail(rv); | 678 dispatcher_->DidFail(rv); |
684 delete this; | |
685 } | 679 } |
686 | 680 |
687 void FileSystemOperation::DidWrite( | 681 void FileSystemOperation::DidWrite( |
688 base::PlatformFileError rv, | 682 base::PlatformFileError rv, |
689 int64 bytes, | 683 int64 bytes, |
690 bool complete) { | 684 bool complete) { |
691 if (!dispatcher_.get()) { | 685 if (!dispatcher_.get()) { |
692 delete this; | 686 delete this; |
693 return; | 687 return; |
694 } | 688 } |
695 if (rv == base::PLATFORM_FILE_OK) | 689 if (rv == base::PLATFORM_FILE_OK) |
696 dispatcher_->DidWrite(bytes, complete); | 690 dispatcher_->DidWrite(bytes, complete); |
697 else | 691 else |
698 dispatcher_->DidFail(rv); | 692 dispatcher_->DidFail(rv); |
699 if (complete || rv != base::PLATFORM_FILE_OK) | 693 if (complete || rv != base::PLATFORM_FILE_OK) |
700 delete this; | 694 delete this; |
701 } | 695 } |
702 | 696 |
703 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { | 697 void FileSystemOperation::DidTouchFile(base::PlatformFileError rv) { |
704 if (!dispatcher_.get()) { | 698 if (!dispatcher_.get()) |
705 delete this; | |
706 return; | 699 return; |
707 } | |
708 if (rv == base::PLATFORM_FILE_OK) | 700 if (rv == base::PLATFORM_FILE_OK) |
709 dispatcher_->DidSucceed(); | 701 dispatcher_->DidSucceed(); |
710 else | 702 else |
711 dispatcher_->DidFail(rv); | 703 dispatcher_->DidFail(rv); |
712 delete this; | |
713 } | 704 } |
714 | 705 |
715 void FileSystemOperation::DidOpenFile( | 706 void FileSystemOperation::DidOpenFile( |
716 base::PlatformFileError rv, | 707 base::PlatformFileError rv, |
717 base::PassPlatformFile file, | 708 base::PassPlatformFile file, |
718 bool unused) { | 709 bool unused) { |
719 if (!dispatcher_.get()) { | 710 if (!dispatcher_.get()) |
720 delete this; | |
721 return; | 711 return; |
722 } | |
723 if (rv == base::PLATFORM_FILE_OK) | 712 if (rv == base::PLATFORM_FILE_OK) |
724 dispatcher_->DidOpenFile(file.ReleaseValue(), peer_handle_); | 713 dispatcher_->DidOpenFile(file.ReleaseValue(), peer_handle_); |
725 else | 714 else |
726 dispatcher_->DidFail(rv); | 715 dispatcher_->DidFail(rv); |
727 delete this; | |
728 } | 716 } |
729 | 717 |
730 void FileSystemOperation::OnFileOpenedForWrite( | 718 void FileSystemOperation::OnFileOpenedForWrite( |
731 base::PlatformFileError rv, | 719 base::PlatformFileError rv, |
732 base::PassPlatformFile file, | 720 base::PassPlatformFile file, |
733 bool created) { | 721 bool created) { |
734 if (!dispatcher_.get()) { | 722 if (base::PLATFORM_FILE_OK != rv || !dispatcher_.get()) { |
| 723 if (dispatcher_.get()) |
| 724 dispatcher_->DidFail(rv); |
735 delete this; | 725 delete this; |
736 return; | 726 return; |
737 } | 727 } |
738 if (base::PLATFORM_FILE_OK != rv) { | |
739 dispatcher_->DidFail(rv); | |
740 delete this; | |
741 return; | |
742 } | |
743 file_writer_delegate_->Start(file.ReleaseValue(), blob_request_.get()); | 728 file_writer_delegate_->Start(file.ReleaseValue(), blob_request_.get()); |
744 } | 729 } |
745 | 730 |
746 bool FileSystemOperation::VerifyFileSystemPathForRead( | 731 bool FileSystemOperation::VerifyFileSystemPathForRead( |
747 const GURL& path, GURL* origin_url, FileSystemType* type, | 732 const GURL& path, GURL* origin_url, FileSystemType* type, |
748 FilePath* virtual_path, FileSystemFileUtil** file_util) { | 733 FilePath* virtual_path, FileSystemFileUtil** file_util) { |
749 | 734 |
750 // If we have no context, we just allow any operations, for testing. | 735 // If we have no context, we just allow any operations, for testing. |
751 // TODO(ericu): Revisit this hack for security. | 736 // TODO(ericu): Revisit this hack for security. |
752 if (!file_system_context()) { | 737 if (!file_system_context()) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 bool result = VerifyFileSystemPathForWrite( | 870 bool result = VerifyFileSystemPathForWrite( |
886 path, create, &origin_url, &type, &dest_virtual_path_, &file_util); | 871 path, create, &origin_url, &type, &dest_virtual_path_, &file_util); |
887 operation_context_.set_dest_origin_url(origin_url); | 872 operation_context_.set_dest_origin_url(origin_url); |
888 operation_context_.set_dest_type(type); | 873 operation_context_.set_dest_type(type); |
889 if (!operation_context_.dest_file_util()) | 874 if (!operation_context_.dest_file_util()) |
890 operation_context_.set_dest_file_util(file_util); | 875 operation_context_.set_dest_file_util(file_util); |
891 return result; | 876 return result; |
892 } | 877 } |
893 | 878 |
894 } // namespace fileapi | 879 } // namespace fileapi |
OLD | NEW |