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 11 matching lines...) Expand all Loading... | |
22 class DocumentLoader { | 22 class DocumentLoader { |
23 public: | 23 public: |
24 class Client { | 24 class Client { |
25 public: | 25 public: |
26 virtual ~Client(); | 26 virtual ~Client(); |
27 | 27 |
28 // Gets the pp::Instance object. | 28 // Gets the pp::Instance object. |
29 virtual pp::Instance* GetPluginInstance() = 0; | 29 virtual pp::Instance* GetPluginInstance() = 0; |
30 // Creates new URLLoader based on client settings. | 30 // Creates new URLLoader based on client settings. |
31 virtual pp::URLLoader CreateURLLoader() = 0; | 31 virtual pp::URLLoader CreateURLLoader() = 0; |
32 // Notification called when the actual loaded URL is available. | |
33 virtual void OnGotActualURL(const std::string& url) = 0; | |
32 // Notification called when partial information about document is available. | 34 // Notification called when partial information about document is available. |
33 // Only called for urls that returns full content size and supports byte | 35 // Only called for urls that returns full content size and supports byte |
34 // range requests. | 36 // range requests. |
35 virtual void OnPartialDocumentLoaded() = 0; | 37 virtual void OnPartialDocumentLoaded() = 0; |
36 // Notification called when all outstanding pending requests are complete. | 38 // Notification called when all outstanding pending requests are complete. |
37 virtual void OnPendingRequestComplete() = 0; | 39 virtual void OnPendingRequestComplete() = 0; |
38 // Notification called when new data is available. | 40 // Notification called when new data is available. |
39 virtual void OnNewDataAvailable() = 0; | 41 virtual void OnNewDataAvailable() = 0; |
40 // Notification called when document is fully loaded. | 42 // Notification called when document is fully loaded. |
41 virtual void OnDocumentComplete() = 0; | 43 virtual void OnDocumentComplete() = 0; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 // Updates the rendering by the Client. | 98 // Updates the rendering by the Client. |
97 void UpdateRendering(); | 99 void UpdateRendering(); |
98 | 100 |
99 // Document below size will be downloaded in one chunk. | 101 // Document below size will be downloaded in one chunk. |
100 static const uint32_t kMinFileSize = 64 * 1024; | 102 static const uint32_t kMinFileSize = 64 * 1024; |
101 // Number was chosen in crbug.com/78264#c8 | 103 // Number was chosen in crbug.com/78264#c8 |
102 enum { kDefaultRequestSize = 65536 }; | 104 enum { kDefaultRequestSize = 65536 }; |
103 | 105 |
104 Client* const client_; | 106 Client* const client_; |
105 std::string url_; | 107 std::string url_; |
108 std::string actual_url_; | |
Tom Sepez
2016/10/11 16:10:47
nit: maybe a comment that explains how this differ
| |
106 pp::URLLoader loader_; | 109 pp::URLLoader loader_; |
107 pp::CompletionCallbackFactory<DocumentLoader> loader_factory_; | 110 pp::CompletionCallbackFactory<DocumentLoader> loader_factory_; |
108 ChunkStream chunk_stream_; | 111 ChunkStream chunk_stream_; |
109 bool partial_document_; | 112 bool partial_document_; |
110 bool request_pending_; | 113 bool request_pending_; |
111 typedef std::list<std::pair<size_t, size_t> > PendingRequests; | 114 typedef std::list<std::pair<size_t, size_t> > PendingRequests; |
112 PendingRequests pending_requests_; | 115 PendingRequests pending_requests_; |
113 // The starting position of the HTTP request currently being processed. | 116 // The starting position of the HTTP request currently being processed. |
114 size_t current_request_offset_; | 117 size_t current_request_offset_; |
115 // The size of the byte range the current HTTP request must download before | 118 // The size of the byte range the current HTTP request must download before |
(...skipping 11 matching lines...) Expand all Loading... | |
127 bool header_request_; | 130 bool header_request_; |
128 bool is_multipart_; | 131 bool is_multipart_; |
129 std::string multipart_boundary_; | 132 std::string multipart_boundary_; |
130 uint32_t requests_count_; | 133 uint32_t requests_count_; |
131 std::vector<std::vector<unsigned char> > chunk_buffer_; | 134 std::vector<std::vector<unsigned char> > chunk_buffer_; |
132 }; | 135 }; |
133 | 136 |
134 } // namespace chrome_pdf | 137 } // namespace chrome_pdf |
135 | 138 |
136 #endif // PDF_DOCUMENT_LOADER_H_ | 139 #endif // PDF_DOCUMENT_LOADER_H_ |
OLD | NEW |