| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/drive/drive_file_stream_reader.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 if (open_result != net::OK) { | 450 if (open_result != net::OK) { |
| 451 callback.Run(net::ERR_FAILED, scoped_ptr<ResourceEntry>()); | 451 callback.Run(net::ERR_FAILED, scoped_ptr<ResourceEntry>()); |
| 452 return; | 452 return; |
| 453 } | 453 } |
| 454 | 454 |
| 455 reader_proxy_.reset( | 455 reader_proxy_.reset( |
| 456 new internal::LocalReaderProxy(file_reader.Pass(), length)); | 456 new internal::LocalReaderProxy(file_reader.Pass(), length)); |
| 457 callback.Run(net::OK, entry.Pass()); | 457 callback.Run(net::OK, entry.Pass()); |
| 458 } | 458 } |
| 459 | 459 |
| 460 void DriveFileStreamReader::OnGetContent(google_apis::GDataErrorCode error_code, | 460 void DriveFileStreamReader::OnGetContent( |
| 461 scoped_ptr<std::string> data) { | 461 google_apis::DriveApiErrorCode error_code, |
| 462 scoped_ptr<std::string> data) { |
| 462 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 463 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 463 DCHECK(reader_proxy_); | 464 DCHECK(reader_proxy_); |
| 464 reader_proxy_->OnGetContent(data.Pass()); | 465 reader_proxy_->OnGetContent(data.Pass()); |
| 465 } | 466 } |
| 466 | 467 |
| 467 void DriveFileStreamReader::OnGetFileContentCompletion( | 468 void DriveFileStreamReader::OnGetFileContentCompletion( |
| 468 const InitializeCompletionCallback& callback, | 469 const InitializeCompletionCallback& callback, |
| 469 FileError error) { | 470 FileError error) { |
| 470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 471 | 472 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 482 // Note: due to the same reason, LocalReaderProxy::OnCompleted may | 483 // Note: due to the same reason, LocalReaderProxy::OnCompleted may |
| 483 // or may not be called. This is timing issue, and it is difficult to avoid | 484 // or may not be called. This is timing issue, and it is difficult to avoid |
| 484 // unfortunately. | 485 // unfortunately. |
| 485 if (error != FILE_ERROR_OK) { | 486 if (error != FILE_ERROR_OK) { |
| 486 callback.Run(FileErrorToNetError(error), scoped_ptr<ResourceEntry>()); | 487 callback.Run(FileErrorToNetError(error), scoped_ptr<ResourceEntry>()); |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 } | 490 } |
| 490 | 491 |
| 491 } // namespace drive | 492 } // namespace drive |
| OLD | NEW |