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 "chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h" | 5 #include "chrome/browser/media_galleries/linux/mtp_device_delegate_impl_linux.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" | 10 #include "chrome/browser/media_galleries/linux/mtp_device_task_helper.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // | 79 // |
80 // |storage_name| specifies the name of the storage device. | 80 // |storage_name| specifies the name of the storage device. |
81 // |success_callback| is called when the ReadDirectory request succeeds. | 81 // |success_callback| is called when the ReadDirectory request succeeds. |
82 // |error_callback| is called when the ReadDirectory request fails. | 82 // |error_callback| is called when the ReadDirectory request fails. |
83 // |success_callback| and |error_callback| runs on the IO thread. | 83 // |success_callback| and |error_callback| runs on the IO thread. |
84 void ReadDirectoryOnUIThread( | 84 void ReadDirectoryOnUIThread( |
85 const std::string& storage_name, | 85 const std::string& storage_name, |
86 const std::string& root, | 86 const std::string& root, |
87 const base::Callback< | 87 const base::Callback< |
88 void(const fileapi::AsyncFileUtil::EntryList&)>& success_callback, | 88 void(const fileapi::AsyncFileUtil::EntryList&)>& success_callback, |
89 const base::Callback<void(base::PlatformFileError)>& error_callback) { | 89 const base::Callback<void(base::File::Error)>& error_callback) { |
90 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 90 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
91 MTPDeviceTaskHelper* task_helper = | 91 MTPDeviceTaskHelper* task_helper = |
92 GetDeviceTaskHelperForStorage(storage_name); | 92 GetDeviceTaskHelperForStorage(storage_name); |
93 if (!task_helper) | 93 if (!task_helper) |
94 return; | 94 return; |
95 task_helper->ReadDirectoryByPath(root, success_callback, error_callback); | 95 task_helper->ReadDirectoryByPath(root, success_callback, error_callback); |
96 } | 96 } |
97 | 97 |
98 // Gets the |file_path| details. | 98 // Gets the |file_path| details. |
99 // | 99 // |
100 // Called on the UI thread to dispatch the request to the | 100 // Called on the UI thread to dispatch the request to the |
101 // MediaTransferProtocolManager. | 101 // MediaTransferProtocolManager. |
102 // | 102 // |
103 // |storage_name| specifies the name of the storage device. | 103 // |storage_name| specifies the name of the storage device. |
104 // |success_callback| is called when the GetFileInfo request succeeds. | 104 // |success_callback| is called when the GetFileInfo request succeeds. |
105 // |error_callback| is called when the GetFileInfo request fails. | 105 // |error_callback| is called when the GetFileInfo request fails. |
106 // |success_callback| and |error_callback| runs on the IO thread. | 106 // |success_callback| and |error_callback| runs on the IO thread. |
107 void GetFileInfoOnUIThread( | 107 void GetFileInfoOnUIThread( |
108 const std::string& storage_name, | 108 const std::string& storage_name, |
109 const std::string& file_path, | 109 const std::string& file_path, |
110 const base::Callback<void(const base::PlatformFileInfo&)>& success_callback, | 110 const base::Callback<void(const base::File::Info&)>& success_callback, |
111 const base::Callback<void(base::PlatformFileError)>& error_callback) { | 111 const base::Callback<void(base::File::Error)>& error_callback) { |
112 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 112 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
113 MTPDeviceTaskHelper* task_helper = | 113 MTPDeviceTaskHelper* task_helper = |
114 GetDeviceTaskHelperForStorage(storage_name); | 114 GetDeviceTaskHelperForStorage(storage_name); |
115 if (!task_helper) | 115 if (!task_helper) |
116 return; | 116 return; |
117 task_helper->GetFileInfoByPath(file_path, success_callback, error_callback); | 117 task_helper->GetFileInfoByPath(file_path, success_callback, error_callback); |
118 } | 118 } |
119 | 119 |
120 // Copies the contents of |device_file_path| to |snapshot_file_path|. | 120 // Copies the contents of |device_file_path| to |snapshot_file_path|. |
121 // | 121 // |
122 // Called on the UI thread to dispatch the request to the | 122 // Called on the UI thread to dispatch the request to the |
123 // MediaTransferProtocolManager. | 123 // MediaTransferProtocolManager. |
124 // | 124 // |
125 // |storage_name| specifies the name of the storage device. | 125 // |storage_name| specifies the name of the storage device. |
126 // |device_file_path| specifies the media device file path. | 126 // |device_file_path| specifies the media device file path. |
127 // |snapshot_file_path| specifies the platform path of the snapshot file. | 127 // |snapshot_file_path| specifies the platform path of the snapshot file. |
128 // |file_size| specifies the number of bytes that will be written to the | 128 // |file_size| specifies the number of bytes that will be written to the |
129 // snapshot file. | 129 // snapshot file. |
130 // |success_callback| is called when the copy operation succeeds. | 130 // |success_callback| is called when the copy operation succeeds. |
131 // |error_callback| is called when the copy operation fails. | 131 // |error_callback| is called when the copy operation fails. |
132 // |success_callback| and |error_callback| runs on the IO thread. | 132 // |success_callback| and |error_callback| runs on the IO thread. |
133 void WriteDataIntoSnapshotFileOnUIThread( | 133 void WriteDataIntoSnapshotFileOnUIThread( |
134 const std::string& storage_name, | 134 const std::string& storage_name, |
135 const SnapshotRequestInfo& request_info, | 135 const SnapshotRequestInfo& request_info, |
136 const base::PlatformFileInfo& snapshot_file_info) { | 136 const base::File::Info& snapshot_file_info) { |
137 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 137 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
138 MTPDeviceTaskHelper* task_helper = | 138 MTPDeviceTaskHelper* task_helper = |
139 GetDeviceTaskHelperForStorage(storage_name); | 139 GetDeviceTaskHelperForStorage(storage_name); |
140 if (!task_helper) | 140 if (!task_helper) |
141 return; | 141 return; |
142 task_helper->WriteDataIntoSnapshotFile(request_info, snapshot_file_info); | 142 task_helper->WriteDataIntoSnapshotFile(request_info, snapshot_file_info); |
143 } | 143 } |
144 | 144 |
145 // Copies the contents of |device_file_path| to |snapshot_file_path|. | 145 // Copies the contents of |device_file_path| to |snapshot_file_path|. |
146 // | 146 // |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 content::BrowserThread::UI, | 334 content::BrowserThread::UI, |
335 FROM_HERE, | 335 FROM_HERE, |
336 base::Bind(&OpenStorageOnUIThread, | 336 base::Bind(&OpenStorageOnUIThread, |
337 storage_name_, | 337 storage_name_, |
338 base::Bind(&MTPDeviceDelegateImplLinux::OnInitCompleted, | 338 base::Bind(&MTPDeviceDelegateImplLinux::OnInitCompleted, |
339 weak_ptr_factory_.GetWeakPtr()))); | 339 weak_ptr_factory_.GetWeakPtr()))); |
340 } | 340 } |
341 } | 341 } |
342 | 342 |
343 void MTPDeviceDelegateImplLinux::WriteDataIntoSnapshotFile( | 343 void MTPDeviceDelegateImplLinux::WriteDataIntoSnapshotFile( |
344 const base::PlatformFileInfo& file_info) { | 344 const base::File::Info& file_info) { |
345 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 345 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
346 DCHECK(current_snapshot_request_info_.get()); | 346 DCHECK(current_snapshot_request_info_.get()); |
347 DCHECK_GT(file_info.size, 0); | 347 DCHECK_GT(file_info.size, 0); |
348 task_in_progress_ = true; | 348 task_in_progress_ = true; |
349 SnapshotRequestInfo request_info( | 349 SnapshotRequestInfo request_info( |
350 current_snapshot_request_info_->device_file_path, | 350 current_snapshot_request_info_->device_file_path, |
351 current_snapshot_request_info_->snapshot_file_path, | 351 current_snapshot_request_info_->snapshot_file_path, |
352 base::Bind( | 352 base::Bind( |
353 &MTPDeviceDelegateImplLinux::OnDidWriteDataIntoSnapshotFile, | 353 &MTPDeviceDelegateImplLinux::OnDidWriteDataIntoSnapshotFile, |
354 weak_ptr_factory_.GetWeakPtr()), | 354 weak_ptr_factory_.GetWeakPtr()), |
(...skipping 26 matching lines...) Expand all Loading... |
381 | 381 |
382 void MTPDeviceDelegateImplLinux::OnInitCompleted(bool succeeded) { | 382 void MTPDeviceDelegateImplLinux::OnInitCompleted(bool succeeded) { |
383 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 383 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
384 init_state_ = succeeded ? INITIALIZED : UNINITIALIZED; | 384 init_state_ = succeeded ? INITIALIZED : UNINITIALIZED; |
385 task_in_progress_ = false; | 385 task_in_progress_ = false; |
386 ProcessNextPendingRequest(); | 386 ProcessNextPendingRequest(); |
387 } | 387 } |
388 | 388 |
389 void MTPDeviceDelegateImplLinux::OnDidGetFileInfo( | 389 void MTPDeviceDelegateImplLinux::OnDidGetFileInfo( |
390 const GetFileInfoSuccessCallback& success_callback, | 390 const GetFileInfoSuccessCallback& success_callback, |
391 const base::PlatformFileInfo& file_info) { | 391 const base::File::Info& file_info) { |
392 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 392 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
393 success_callback.Run(file_info); | 393 success_callback.Run(file_info); |
394 task_in_progress_ = false; | 394 task_in_progress_ = false; |
395 ProcessNextPendingRequest(); | 395 ProcessNextPendingRequest(); |
396 } | 396 } |
397 | 397 |
398 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToReadDirectory( | 398 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToReadDirectory( |
399 const std::string& root, | 399 const std::string& root, |
400 const ReadDirectorySuccessCallback& success_callback, | 400 const ReadDirectorySuccessCallback& success_callback, |
401 const ErrorCallback& error_callback, | 401 const ErrorCallback& error_callback, |
402 const base::PlatformFileInfo& file_info) { | 402 const base::File::Info& file_info) { |
403 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 403 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
404 DCHECK(task_in_progress_); | 404 DCHECK(task_in_progress_); |
405 if (!file_info.is_directory) { | 405 if (!file_info.is_directory) { |
406 return HandleDeviceFileError(error_callback, | 406 return HandleDeviceFileError(error_callback, |
407 base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY); | 407 base::File::FILE_ERROR_NOT_A_DIRECTORY); |
408 } | 408 } |
409 | 409 |
410 base::Closure task_closure = | 410 base::Closure task_closure = |
411 base::Bind(&ReadDirectoryOnUIThread, | 411 base::Bind(&ReadDirectoryOnUIThread, |
412 storage_name_, | 412 storage_name_, |
413 root, | 413 root, |
414 base::Bind(&MTPDeviceDelegateImplLinux::OnDidReadDirectory, | 414 base::Bind(&MTPDeviceDelegateImplLinux::OnDidReadDirectory, |
415 weak_ptr_factory_.GetWeakPtr(), | 415 weak_ptr_factory_.GetWeakPtr(), |
416 success_callback), | 416 success_callback), |
417 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, | 417 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, |
418 weak_ptr_factory_.GetWeakPtr(), | 418 weak_ptr_factory_.GetWeakPtr(), |
419 error_callback)); | 419 error_callback)); |
420 content::BrowserThread::PostTask(content::BrowserThread::UI, | 420 content::BrowserThread::PostTask(content::BrowserThread::UI, |
421 FROM_HERE, | 421 FROM_HERE, |
422 task_closure); | 422 task_closure); |
423 } | 423 } |
424 | 424 |
425 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToCreateSnapshotFile( | 425 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToCreateSnapshotFile( |
426 scoped_ptr<SnapshotRequestInfo> snapshot_request_info, | 426 scoped_ptr<SnapshotRequestInfo> snapshot_request_info, |
427 const base::PlatformFileInfo& file_info) { | 427 const base::File::Info& file_info) { |
428 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 428 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
429 DCHECK(!current_snapshot_request_info_.get()); | 429 DCHECK(!current_snapshot_request_info_.get()); |
430 DCHECK(snapshot_request_info.get()); | 430 DCHECK(snapshot_request_info.get()); |
431 DCHECK(task_in_progress_); | 431 DCHECK(task_in_progress_); |
432 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 432 base::File::Error error = base::File::FILE_OK; |
433 if (file_info.is_directory) | 433 if (file_info.is_directory) |
434 error = base::PLATFORM_FILE_ERROR_NOT_A_FILE; | 434 error = base::File::FILE_ERROR_NOT_A_FILE; |
435 else if (file_info.size < 0 || file_info.size > kuint32max) | 435 else if (file_info.size < 0 || file_info.size > kuint32max) |
436 error = base::PLATFORM_FILE_ERROR_FAILED; | 436 error = base::File::FILE_ERROR_FAILED; |
437 | 437 |
438 if (error != base::PLATFORM_FILE_OK) | 438 if (error != base::File::FILE_OK) |
439 return HandleDeviceFileError(snapshot_request_info->error_callback, error); | 439 return HandleDeviceFileError(snapshot_request_info->error_callback, error); |
440 | 440 |
441 base::PlatformFileInfo snapshot_file_info(file_info); | 441 base::File::Info snapshot_file_info(file_info); |
442 // Modify the last modified time to null. This prevents the time stamp | 442 // Modify the last modified time to null. This prevents the time stamp |
443 // verfication in LocalFileStreamReader. | 443 // verfication in LocalFileStreamReader. |
444 snapshot_file_info.last_modified = base::Time(); | 444 snapshot_file_info.last_modified = base::Time(); |
445 | 445 |
446 current_snapshot_request_info_.reset(snapshot_request_info.release()); | 446 current_snapshot_request_info_.reset(snapshot_request_info.release()); |
447 if (file_info.size == 0) { | 447 if (file_info.size == 0) { |
448 // Empty snapshot file. | 448 // Empty snapshot file. |
449 return OnDidWriteDataIntoSnapshotFile( | 449 return OnDidWriteDataIntoSnapshotFile( |
450 snapshot_file_info, current_snapshot_request_info_->snapshot_file_path); | 450 snapshot_file_info, current_snapshot_request_info_->snapshot_file_path); |
451 } | 451 } |
452 WriteDataIntoSnapshotFile(snapshot_file_info); | 452 WriteDataIntoSnapshotFile(snapshot_file_info); |
453 } | 453 } |
454 | 454 |
455 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToReadBytes( | 455 void MTPDeviceDelegateImplLinux::OnDidGetFileInfoToReadBytes( |
456 const ReadBytesRequest& request, | 456 const ReadBytesRequest& request, |
457 const base::PlatformFileInfo& file_info) { | 457 const base::File::Info& file_info) { |
458 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 458 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
459 DCHECK(request.buf); | 459 DCHECK(request.buf); |
460 DCHECK(request.buf_len >= 0); | 460 DCHECK(request.buf_len >= 0); |
461 DCHECK(task_in_progress_); | 461 DCHECK(task_in_progress_); |
462 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 462 base::File::Error error = base::File::FILE_OK; |
463 if (file_info.is_directory) | 463 if (file_info.is_directory) |
464 error = base::PLATFORM_FILE_ERROR_NOT_A_FILE; | 464 error = base::File::FILE_ERROR_NOT_A_FILE; |
465 else if (file_info.size < 0 || file_info.size > kuint32max) | 465 else if (file_info.size < 0 || file_info.size > kuint32max) |
466 error = base::PLATFORM_FILE_ERROR_FAILED; | 466 error = base::File::FILE_ERROR_FAILED; |
467 | 467 |
468 if (error != base::PLATFORM_FILE_OK) | 468 if (error != base::File::FILE_OK) |
469 return HandleDeviceFileError(request.error_callback, error); | 469 return HandleDeviceFileError(request.error_callback, error); |
470 | 470 |
471 ReadBytesRequest new_request( | 471 ReadBytesRequest new_request( |
472 request.device_file_relative_path, | 472 request.device_file_relative_path, |
473 request.buf, | 473 request.buf, |
474 request.offset, | 474 request.offset, |
475 request.buf_len, | 475 request.buf_len, |
476 base::Bind(&MTPDeviceDelegateImplLinux::OnDidReadBytes, | 476 base::Bind(&MTPDeviceDelegateImplLinux::OnDidReadBytes, |
477 weak_ptr_factory_.GetWeakPtr(), request.success_callback), | 477 weak_ptr_factory_.GetWeakPtr(), request.success_callback), |
478 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, | 478 base::Bind(&MTPDeviceDelegateImplLinux::HandleDeviceFileError, |
479 weak_ptr_factory_.GetWeakPtr(), request.error_callback)); | 479 weak_ptr_factory_.GetWeakPtr(), request.error_callback)); |
480 | 480 |
481 content::BrowserThread::PostTask( | 481 content::BrowserThread::PostTask( |
482 content::BrowserThread::UI, | 482 content::BrowserThread::UI, |
483 FROM_HERE, | 483 FROM_HERE, |
484 base::Bind(&ReadBytesOnUIThread, storage_name_, new_request)); | 484 base::Bind(&ReadBytesOnUIThread, storage_name_, new_request)); |
485 } | 485 } |
486 | 486 |
487 void MTPDeviceDelegateImplLinux::OnDidReadDirectory( | 487 void MTPDeviceDelegateImplLinux::OnDidReadDirectory( |
488 const ReadDirectorySuccessCallback& success_callback, | 488 const ReadDirectorySuccessCallback& success_callback, |
489 const fileapi::AsyncFileUtil::EntryList& file_list) { | 489 const fileapi::AsyncFileUtil::EntryList& file_list) { |
490 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 490 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
491 success_callback.Run(file_list, false /*no more entries*/); | 491 success_callback.Run(file_list, false /*no more entries*/); |
492 task_in_progress_ = false; | 492 task_in_progress_ = false; |
493 ProcessNextPendingRequest(); | 493 ProcessNextPendingRequest(); |
494 } | 494 } |
495 | 495 |
496 void MTPDeviceDelegateImplLinux::OnDidWriteDataIntoSnapshotFile( | 496 void MTPDeviceDelegateImplLinux::OnDidWriteDataIntoSnapshotFile( |
497 const base::PlatformFileInfo& file_info, | 497 const base::File::Info& file_info, |
498 const base::FilePath& snapshot_file_path) { | 498 const base::FilePath& snapshot_file_path) { |
499 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 499 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
500 DCHECK(current_snapshot_request_info_.get()); | 500 DCHECK(current_snapshot_request_info_.get()); |
501 DCHECK(task_in_progress_); | 501 DCHECK(task_in_progress_); |
502 current_snapshot_request_info_->success_callback.Run( | 502 current_snapshot_request_info_->success_callback.Run( |
503 file_info, snapshot_file_path); | 503 file_info, snapshot_file_path); |
504 task_in_progress_ = false; | 504 task_in_progress_ = false; |
505 current_snapshot_request_info_.reset(); | 505 current_snapshot_request_info_.reset(); |
506 ProcessNextPendingRequest(); | 506 ProcessNextPendingRequest(); |
507 } | 507 } |
508 | 508 |
509 void MTPDeviceDelegateImplLinux::OnWriteDataIntoSnapshotFileError( | 509 void MTPDeviceDelegateImplLinux::OnWriteDataIntoSnapshotFileError( |
510 base::PlatformFileError error) { | 510 base::File::Error error) { |
511 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 511 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
512 DCHECK(current_snapshot_request_info_.get()); | 512 DCHECK(current_snapshot_request_info_.get()); |
513 DCHECK(task_in_progress_); | 513 DCHECK(task_in_progress_); |
514 current_snapshot_request_info_->error_callback.Run(error); | 514 current_snapshot_request_info_->error_callback.Run(error); |
515 task_in_progress_ = false; | 515 task_in_progress_ = false; |
516 current_snapshot_request_info_.reset(); | 516 current_snapshot_request_info_.reset(); |
517 ProcessNextPendingRequest(); | 517 ProcessNextPendingRequest(); |
518 } | 518 } |
519 | 519 |
520 void MTPDeviceDelegateImplLinux::OnDidReadBytes( | 520 void MTPDeviceDelegateImplLinux::OnDidReadBytes( |
521 const ReadBytesSuccessCallback& success_callback, | 521 const ReadBytesSuccessCallback& success_callback, |
522 int bytes_read) { | 522 int bytes_read) { |
523 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 523 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
524 DCHECK(task_in_progress_); | 524 DCHECK(task_in_progress_); |
525 success_callback.Run(bytes_read); | 525 success_callback.Run(bytes_read); |
526 task_in_progress_ = false; | 526 task_in_progress_ = false; |
527 ProcessNextPendingRequest(); | 527 ProcessNextPendingRequest(); |
528 } | 528 } |
529 | 529 |
530 void MTPDeviceDelegateImplLinux::HandleDeviceFileError( | 530 void MTPDeviceDelegateImplLinux::HandleDeviceFileError( |
531 const ErrorCallback& error_callback, | 531 const ErrorCallback& error_callback, |
532 base::PlatformFileError error) { | 532 base::File::Error error) { |
533 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 533 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
534 DCHECK(task_in_progress_); | 534 DCHECK(task_in_progress_); |
535 error_callback.Run(error); | 535 error_callback.Run(error); |
536 task_in_progress_ = false; | 536 task_in_progress_ = false; |
537 ProcessNextPendingRequest(); | 537 ProcessNextPendingRequest(); |
538 } | 538 } |
539 | 539 |
540 void CreateMTPDeviceAsyncDelegate( | 540 void CreateMTPDeviceAsyncDelegate( |
541 const std::string& device_location, | 541 const std::string& device_location, |
542 const CreateMTPDeviceAsyncDelegateCallback& callback) { | 542 const CreateMTPDeviceAsyncDelegateCallback& callback) { |
543 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 543 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); |
544 callback.Run(new MTPDeviceDelegateImplLinux(device_location)); | 544 callback.Run(new MTPDeviceDelegateImplLinux(device_location)); |
545 } | 545 } |
OLD | NEW |