OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 PDF_DOCUMENT_LOADER_H_ | 5 #ifndef PDF_DOCUMENT_LOADER_H_ |
6 #define PDF_DOCUMENT_LOADER_H_ | 6 #define PDF_DOCUMENT_LOADER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Creates request to download size byte of data data starting from position. | 94 // Creates request to download size byte of data data starting from position. |
95 pp::URLRequestInfo GetRequest(uint32_t position, uint32_t size) const; | 95 pp::URLRequestInfo GetRequest(uint32_t position, uint32_t size) const; |
96 // Updates the rendering by the Client. | 96 // Updates the rendering by the Client. |
97 void UpdateRendering(); | 97 void UpdateRendering(); |
98 | 98 |
99 // Document below size will be downloaded in one chunk. | 99 // Document below size will be downloaded in one chunk. |
100 static const uint32_t kMinFileSize = 64 * 1024; | 100 static const uint32_t kMinFileSize = 64 * 1024; |
101 // Number was chosen in crbug.com/78264#c8 | 101 // Number was chosen in crbug.com/78264#c8 |
102 enum { kDefaultRequestSize = 65536 }; | 102 enum { kDefaultRequestSize = 65536 }; |
103 | 103 |
104 Client* client_; | 104 Client* const client_; |
105 std::string url_; | 105 std::string url_; |
106 pp::URLLoader loader_; | 106 pp::URLLoader loader_; |
107 pp::CompletionCallbackFactory<DocumentLoader> loader_factory_; | 107 pp::CompletionCallbackFactory<DocumentLoader> loader_factory_; |
108 ChunkStream chunk_stream_; | 108 ChunkStream chunk_stream_; |
109 bool partial_document_; | 109 bool partial_document_; |
110 bool request_pending_; | 110 bool request_pending_; |
111 typedef std::list<std::pair<size_t, size_t> > PendingRequests; | 111 typedef std::list<std::pair<size_t, size_t> > PendingRequests; |
112 PendingRequests pending_requests_; | 112 PendingRequests pending_requests_; |
113 // The starting position of the HTTP request currently being processed. | 113 // The starting position of the HTTP request currently being processed. |
114 size_t current_request_offset_; | 114 size_t current_request_offset_; |
(...skipping 12 matching lines...) Expand all Loading... |
127 bool header_request_; | 127 bool header_request_; |
128 bool is_multipart_; | 128 bool is_multipart_; |
129 std::string multipart_boundary_; | 129 std::string multipart_boundary_; |
130 uint32_t requests_count_; | 130 uint32_t requests_count_; |
131 std::list<std::vector<unsigned char> > chunk_buffer_; | 131 std::list<std::vector<unsigned char> > chunk_buffer_; |
132 }; | 132 }; |
133 | 133 |
134 } // namespace chrome_pdf | 134 } // namespace chrome_pdf |
135 | 135 |
136 #endif // PDF_DOCUMENT_LOADER_H_ | 136 #endif // PDF_DOCUMENT_LOADER_H_ |
OLD | NEW |