| 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_url_request_job.h" | 5 #include "chrome/browser/chromeos/drive/drive_url_request_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 base::FilePath drive_file_path(util::DriveURLToFilePath(request_->url())); | 92 base::FilePath drive_file_path(util::DriveURLToFilePath(request_->url())); |
| 93 if (drive_file_path.empty()) { | 93 if (drive_file_path.empty()) { |
| 94 // Not a valid url. | 94 // Not a valid url. |
| 95 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 95 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
| 96 net::ERR_INVALID_URL)); | 96 net::ERR_INVALID_URL)); |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 | 99 |
| 100 // Initialize the stream reader. | 100 // Initialize the stream reader. |
| 101 stream_reader_.reset( | 101 stream_reader_.reset( |
| 102 new DriveFileStreamReader(file_system_getter_, file_task_runner_)); | 102 new DriveFileStreamReader(file_system_getter_, file_task_runner_.get())); |
| 103 stream_reader_->Initialize( | 103 stream_reader_->Initialize( |
| 104 drive_file_path, | 104 drive_file_path, |
| 105 byte_range_, | 105 byte_range_, |
| 106 base::Bind(&DriveURLRequestJob::OnDriveFileStreamReaderInitialized, | 106 base::Bind(&DriveURLRequestJob::OnDriveFileStreamReaderInitialized, |
| 107 weak_ptr_factory_.GetWeakPtr())); | 107 weak_ptr_factory_.GetWeakPtr())); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void DriveURLRequestJob::Kill() { | 110 void DriveURLRequestJob::Kill() { |
| 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 112 | 112 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 DCHECK_NE(read_result, net::ERR_IO_PENDING); | 201 DCHECK_NE(read_result, net::ERR_IO_PENDING); |
| 202 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 202 NotifyDone(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
| 203 read_result)); | 203 read_result)); |
| 204 } | 204 } |
| 205 | 205 |
| 206 SetStatus(net::URLRequestStatus()); // Clear the IO_PENDING status. | 206 SetStatus(net::URLRequestStatus()); // Clear the IO_PENDING status. |
| 207 NotifyReadComplete(read_result); | 207 NotifyReadComplete(read_result); |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace drive | 210 } // namespace drive |
| OLD | NEW |