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 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ |
6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ | 6 #define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 virtual ~MTPFileStreamReader(); | 32 virtual ~MTPFileStreamReader(); |
33 | 33 |
34 // FileStreamReader overrides. | 34 // FileStreamReader overrides. |
35 virtual int Read(net::IOBuffer* buf, int buf_len, | 35 virtual int Read(net::IOBuffer* buf, int buf_len, |
36 const net::CompletionCallback& callback) OVERRIDE; | 36 const net::CompletionCallback& callback) OVERRIDE; |
37 virtual int64 GetLength( | 37 virtual int64 GetLength( |
38 const net::Int64CompletionCallback& callback) OVERRIDE; | 38 const net::Int64CompletionCallback& callback) OVERRIDE; |
39 | 39 |
40 private: | 40 private: |
41 void OnFileInfoForRead(net::IOBuffer* buf, int buf_len, | |
42 const net::CompletionCallback& callback, | |
43 const base::File::Info& file_info); | |
44 | |
45 void FinishValidateMediaHeader( | 41 void FinishValidateMediaHeader( |
46 net::IOBuffer* header_buf, | 42 net::IOBuffer* header_buf, |
47 const base::File::Info& file_info, | |
48 net::IOBuffer* buf, int buf_len, | 43 net::IOBuffer* buf, int buf_len, |
49 const net::CompletionCallback& callback, | 44 const net::CompletionCallback& callback, |
| 45 const base::File::Info& file_info, |
50 int header_bytes_read); | 46 int header_bytes_read); |
51 | 47 |
52 void FinishRead(const net::CompletionCallback& callback, | 48 void FinishRead(const net::CompletionCallback& callback, |
53 int bytes_read); | 49 const base::File::Info& file_info, int bytes_read); |
54 | 50 |
55 void FinishGetLength(const net::Int64CompletionCallback& callback, | 51 void FinishGetLength(const net::Int64CompletionCallback& callback, |
56 const base::File::Info& file_info); | 52 const base::File::Info& file_info); |
57 | 53 |
58 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 54 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
59 fileapi::FileSystemURL url_; | 55 fileapi::FileSystemURL url_; |
60 int64 current_offset_; | 56 int64 current_offset_; |
61 const base::Time expected_modification_time_; | 57 const base::Time expected_modification_time_; |
62 | 58 |
63 bool media_header_validated_; | 59 bool media_header_validated_; |
64 | 60 |
65 base::WeakPtrFactory<MTPFileStreamReader> weak_factory_; | 61 base::WeakPtrFactory<MTPFileStreamReader> weak_factory_; |
66 | 62 |
67 DISALLOW_COPY_AND_ASSIGN(MTPFileStreamReader); | 63 DISALLOW_COPY_AND_ASSIGN(MTPFileStreamReader); |
68 }; | 64 }; |
69 | 65 |
70 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ | 66 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ |
OLD | NEW |