OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi
le_util.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi
le_util.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 void OnMoveEntry(const storage::AsyncFileUtil::StatusCallback& callback, | 244 void OnMoveEntry(const storage::AsyncFileUtil::StatusCallback& callback, |
245 base::File::Error result) { | 245 base::File::Error result) { |
246 BrowserThread::PostTask( | 246 BrowserThread::PostTask( |
247 BrowserThread::IO, FROM_HERE, base::Bind(callback, result)); | 247 BrowserThread::IO, FROM_HERE, base::Bind(callback, result)); |
248 } | 248 } |
249 | 249 |
250 // Executes Truncate on the UI thread. | 250 // Executes Truncate on the UI thread. |
251 void TruncateOnUIThread( | 251 void TruncateOnUIThread( |
252 scoped_ptr<storage::FileSystemOperationContext> context, | 252 scoped_ptr<storage::FileSystemOperationContext> context, |
253 const storage::FileSystemURL& url, | 253 const storage::FileSystemURL& url, |
254 int64 length, | 254 int64_t length, |
255 const storage::AsyncFileUtil::StatusCallback& callback) { | 255 const storage::AsyncFileUtil::StatusCallback& callback) { |
256 util::FileSystemURLParser parser(url); | 256 util::FileSystemURLParser parser(url); |
257 if (!parser.Parse()) { | 257 if (!parser.Parse()) { |
258 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 258 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
259 return; | 259 return; |
260 } | 260 } |
261 | 261 |
262 parser.file_system()->Truncate(parser.file_path(), length, callback); | 262 parser.file_system()->Truncate(parser.file_path(), length, callback); |
263 } | 263 } |
264 | 264 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 const base::Time& last_access_time, | 358 const base::Time& last_access_time, |
359 const base::Time& last_modified_time, | 359 const base::Time& last_modified_time, |
360 const StatusCallback& callback) { | 360 const StatusCallback& callback) { |
361 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 361 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
362 callback.Run(base::File::FILE_ERROR_ACCESS_DENIED); | 362 callback.Run(base::File::FILE_ERROR_ACCESS_DENIED); |
363 } | 363 } |
364 | 364 |
365 void ProviderAsyncFileUtil::Truncate( | 365 void ProviderAsyncFileUtil::Truncate( |
366 scoped_ptr<storage::FileSystemOperationContext> context, | 366 scoped_ptr<storage::FileSystemOperationContext> context, |
367 const storage::FileSystemURL& url, | 367 const storage::FileSystemURL& url, |
368 int64 length, | 368 int64_t length, |
369 const StatusCallback& callback) { | 369 const StatusCallback& callback) { |
370 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 370 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
371 BrowserThread::PostTask(BrowserThread::UI, | 371 BrowserThread::PostTask(BrowserThread::UI, |
372 FROM_HERE, | 372 FROM_HERE, |
373 base::Bind(&TruncateOnUIThread, | 373 base::Bind(&TruncateOnUIThread, |
374 base::Passed(&context), | 374 base::Passed(&context), |
375 url, | 375 url, |
376 length, | 376 length, |
377 base::Bind(&OnTruncate, callback))); | 377 base::Bind(&OnTruncate, callback))); |
378 } | 378 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 NOTIMPLEMENTED(); | 473 NOTIMPLEMENTED(); |
474 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, | 474 callback.Run(base::File::FILE_ERROR_INVALID_OPERATION, |
475 base::File::Info(), | 475 base::File::Info(), |
476 base::FilePath(), | 476 base::FilePath(), |
477 scoped_refptr<storage::ShareableFileReference>()); | 477 scoped_refptr<storage::ShareableFileReference>()); |
478 } | 478 } |
479 | 479 |
480 } // namespace internal | 480 } // namespace internal |
481 } // namespace file_system_provider | 481 } // namespace file_system_provider |
482 } // namespace chromeos | 482 } // namespace chromeos |
OLD | NEW |