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 16 matching lines...) Expand all Loading... |
27 MTPFileStreamReader(storage::FileSystemContext* file_system_context, | 27 MTPFileStreamReader(storage::FileSystemContext* file_system_context, |
28 const storage::FileSystemURL& url, | 28 const storage::FileSystemURL& url, |
29 int64 initial_offset, | 29 int64 initial_offset, |
30 const base::Time& expected_modification_time, | 30 const base::Time& expected_modification_time, |
31 bool do_media_header_validation); | 31 bool do_media_header_validation); |
32 | 32 |
33 virtual ~MTPFileStreamReader(); | 33 virtual ~MTPFileStreamReader(); |
34 | 34 |
35 // FileStreamReader overrides. | 35 // FileStreamReader overrides. |
36 virtual int Read(net::IOBuffer* buf, int buf_len, | 36 virtual int Read(net::IOBuffer* buf, int buf_len, |
37 const net::CompletionCallback& callback) OVERRIDE; | 37 const net::CompletionCallback& callback) override; |
38 virtual int64 GetLength( | 38 virtual int64 GetLength( |
39 const net::Int64CompletionCallback& callback) OVERRIDE; | 39 const net::Int64CompletionCallback& callback) override; |
40 | 40 |
41 private: | 41 private: |
42 void FinishValidateMediaHeader( | 42 void FinishValidateMediaHeader( |
43 net::IOBuffer* header_buf, | 43 net::IOBuffer* header_buf, |
44 net::IOBuffer* buf, int buf_len, | 44 net::IOBuffer* buf, int buf_len, |
45 const net::CompletionCallback& callback, | 45 const net::CompletionCallback& callback, |
46 const base::File::Info& file_info, | 46 const base::File::Info& file_info, |
47 int header_bytes_read); | 47 int header_bytes_read); |
48 | 48 |
49 void FinishRead(const net::CompletionCallback& callback, | 49 void FinishRead(const net::CompletionCallback& callback, |
50 const base::File::Info& file_info, int bytes_read); | 50 const base::File::Info& file_info, int bytes_read); |
51 | 51 |
52 void FinishGetLength(const net::Int64CompletionCallback& callback, | 52 void FinishGetLength(const net::Int64CompletionCallback& callback, |
53 const base::File::Info& file_info); | 53 const base::File::Info& file_info); |
54 | 54 |
55 scoped_refptr<storage::FileSystemContext> file_system_context_; | 55 scoped_refptr<storage::FileSystemContext> file_system_context_; |
56 storage::FileSystemURL url_; | 56 storage::FileSystemURL url_; |
57 int64 current_offset_; | 57 int64 current_offset_; |
58 const base::Time expected_modification_time_; | 58 const base::Time expected_modification_time_; |
59 | 59 |
60 bool media_header_validated_; | 60 bool media_header_validated_; |
61 | 61 |
62 base::WeakPtrFactory<MTPFileStreamReader> weak_factory_; | 62 base::WeakPtrFactory<MTPFileStreamReader> weak_factory_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(MTPFileStreamReader); | 64 DISALLOW_COPY_AND_ASSIGN(MTPFileStreamReader); |
65 }; | 65 }; |
66 | 66 |
67 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ | 67 #endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_FILE_STREAM_READER_H_ |
OLD | NEW |