| 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/drive/fileapi/webkit_file_stream_reader_impl.h
" | 5 #include "chrome/browser/chromeos/drive/fileapi/webkit_file_stream_reader_impl.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 base::Bind(&WebkitFileStreamReaderImpl | 86 base::Bind(&WebkitFileStreamReaderImpl |
| 87 ::GetLengthAfterStreamReaderInitialized, | 87 ::GetLengthAfterStreamReaderInitialized, |
| 88 weak_ptr_factory_.GetWeakPtr(), | 88 weak_ptr_factory_.GetWeakPtr(), |
| 89 callback))); | 89 callback))); |
| 90 return net::ERR_IO_PENDING; | 90 return net::ERR_IO_PENDING; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void WebkitFileStreamReaderImpl::OnStreamReaderInitialized( | 93 void WebkitFileStreamReaderImpl::OnStreamReaderInitialized( |
| 94 const net::CompletionCallback& callback, | 94 const net::CompletionCallback& callback, |
| 95 int error, | 95 int error, |
| 96 scoped_ptr<ResourceEntry> entry) { | 96 std::unique_ptr<ResourceEntry> entry) { |
| 97 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 97 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 98 DCHECK(stream_reader_); | 98 DCHECK(stream_reader_); |
| 99 DCHECK(!callback.is_null()); | 99 DCHECK(!callback.is_null()); |
| 100 | 100 |
| 101 // TODO(hashimoto): Report ERR_UPLOAD_FILE_CHANGED when modification time | 101 // TODO(hashimoto): Report ERR_UPLOAD_FILE_CHANGED when modification time |
| 102 // doesn't match. crbug.com/346625 | 102 // doesn't match. crbug.com/346625 |
| 103 if (error != net::OK) { | 103 if (error != net::OK) { |
| 104 // Found an error. Close the |stream_reader_| and notify it to the caller. | 104 // Found an error. Close the |stream_reader_| and notify it to the caller. |
| 105 stream_reader_.reset(); | 105 stream_reader_.reset(); |
| 106 callback.Run(error); | 106 callback.Run(error); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 callback.Run(initialization_result); | 141 callback.Run(initialization_result); |
| 142 return; | 142 return; |
| 143 } | 143 } |
| 144 | 144 |
| 145 DCHECK_GE(file_size_, 0); | 145 DCHECK_GE(file_size_, 0); |
| 146 callback.Run(file_size_); | 146 callback.Run(file_size_); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace internal | 149 } // namespace internal |
| 150 } // namespace drive | 150 } // namespace drive |
| OLD | NEW |