| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "net/base/file_stream.h" |
| 10 #include "net/base/io_buffer.h" |
| 11 |
| 12 using content::BrowserThread; |
| 8 | 13 |
| 9 namespace drive { | 14 namespace drive { |
| 15 namespace internal { |
| 16 |
| 17 LocalReaderProxy::LocalReaderProxy(scoped_ptr<net::FileStream> file_stream) |
| 18 : file_stream_(file_stream.Pass()) { |
| 19 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 20 DCHECK(file_stream_); |
| 21 } |
| 22 |
| 23 LocalReaderProxy::~LocalReaderProxy() { |
| 24 } |
| 25 |
| 26 int LocalReaderProxy::Read(net::IOBuffer* buffer, int buffer_length, |
| 27 const net::CompletionCallback& callback) { |
| 28 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 29 DCHECK(file_stream_); |
| 30 return file_stream_->Read(buffer, buffer_length, callback); |
| 31 } |
| 32 |
| 33 void LocalReaderProxy::OnGetContent(scoped_ptr<std::string> data) { |
| 34 // This method should never be called, because no data should be received |
| 35 // from the network during the reading of local-cache file. |
| 36 NOTREACHED(); |
| 37 } |
| 38 |
| 39 void LocalReaderProxy::OnError(DriveFileError error) { |
| 40 // This method should never be called, because we don't access to the server |
| 41 // during the reading of local-cache file. |
| 42 NOTREACHED(); |
| 43 } |
| 44 |
| 45 } // namespace internal |
| 46 |
| 10 | 47 |
| 11 DriveFileStreamReader::DriveFileStreamReader() { | 48 DriveFileStreamReader::DriveFileStreamReader() { |
| 12 } | 49 } |
| 13 | 50 |
| 14 DriveFileStreamReader::~DriveFileStreamReader() { | 51 DriveFileStreamReader::~DriveFileStreamReader() { |
| 15 } | 52 } |
| 16 | 53 |
| 17 int DriveFileStreamReader::Read(net::IOBuffer* buf, int buf_len, | 54 int DriveFileStreamReader::Read(net::IOBuffer* buf, int buf_len, |
| 18 const net::CompletionCallback& callback) { | 55 const net::CompletionCallback& callback) { |
| 19 // TODO(hidehiko): Implement this. | 56 // TODO(hidehiko): Implement this. |
| 20 NOTIMPLEMENTED(); | 57 NOTIMPLEMENTED(); |
| 21 return 0; | 58 return 0; |
| 22 } | 59 } |
| 23 | 60 |
| 24 int64 DriveFileStreamReader::GetLength( | 61 int64 DriveFileStreamReader::GetLength( |
| 25 const net::Int64CompletionCallback& callback) { | 62 const net::Int64CompletionCallback& callback) { |
| 26 // TODO(hidehiko): Implement this. | 63 // TODO(hidehiko): Implement this. |
| 27 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
| 28 return 0; | 65 return 0; |
| 29 } | 66 } |
| 30 | 67 |
| 31 } // namespace drive | 68 } // namespace drive |
| OLD | NEW |