OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OUT_OF_PROCESS_INSTANCE_H_ | 5 #ifndef PDF_OUT_OF_PROCESS_INSTANCE_H_ |
6 #define PDF_OUT_OF_PROCESS_INSTANCE_H_ | 6 #define PDF_OUT_OF_PROCESS_INSTANCE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void CalculateBackgroundParts(); | 156 void CalculateBackgroundParts(); |
157 | 157 |
158 // Computes document width/height in device pixels, based on current zoom and | 158 // Computes document width/height in device pixels, based on current zoom and |
159 // device scale | 159 // device scale |
160 int GetDocumentPixelWidth() const; | 160 int GetDocumentPixelWidth() const; |
161 int GetDocumentPixelHeight() const; | 161 int GetDocumentPixelHeight() const; |
162 | 162 |
163 // Draws a rectangle with the specified dimensions and color in our buffer. | 163 // Draws a rectangle with the specified dimensions and color in our buffer. |
164 void FillRect(const pp::Rect& rect, uint32_t color); | 164 void FillRect(const pp::Rect& rect, uint32_t color); |
165 | 165 |
166 void LoadUrl(const std::string& url); | 166 void LoadUrl(const std::string& url, bool is_print_preview); |
167 void LoadPreviewUrl(const std::string& url); | |
168 void LoadUrlInternal(const std::string& url, | |
169 pp::URLLoader* loader, | |
170 void (OutOfProcessInstance::*method)(int32_t)); | |
171 | 167 |
172 // Creates a URL loader and allows it to access all urls, i.e. not just the | 168 // Creates a URL loader and allows it to access all urls, i.e. not just the |
173 // frame's origin. | 169 // frame's origin. |
174 pp::URLLoader CreateURLLoaderInternal(); | 170 pp::URLLoader CreateURLLoaderInternal(); |
175 | 171 |
176 void FormDidOpen(int32_t result); | 172 void FormDidOpen(int32_t result); |
177 | 173 |
178 void UserMetricsRecordAction(const std::string& action); | 174 void UserMetricsRecordAction(const std::string& action); |
179 | 175 |
180 // Start loading accessibility information. | 176 // Start loading accessibility information. |
(...skipping 29 matching lines...) Expand all Loading... |
210 // Load the next available preview page into the blank page. | 206 // Load the next available preview page into the blank page. |
211 void LoadAvailablePreviewPage(); | 207 void LoadAvailablePreviewPage(); |
212 | 208 |
213 // Bound the given scroll offset to the document. | 209 // Bound the given scroll offset to the document. |
214 pp::FloatPoint BoundScrollOffsetToDocument( | 210 pp::FloatPoint BoundScrollOffsetToDocument( |
215 const pp::FloatPoint& scroll_offset); | 211 const pp::FloatPoint& scroll_offset); |
216 | 212 |
217 pp::ImageData image_data_; | 213 pp::ImageData image_data_; |
218 // Used when the plugin is embedded in a page and we have to create the loader | 214 // Used when the plugin is embedded in a page and we have to create the loader |
219 // ourself. | 215 // ourself. |
220 pp::CompletionCallbackFactory<OutOfProcessInstance> loader_factory_; | |
221 pp::URLLoader embed_loader_; | 216 pp::URLLoader embed_loader_; |
222 pp::URLLoader embed_preview_loader_; | 217 pp::URLLoader embed_preview_loader_; |
223 | 218 |
224 PP_CursorType_Dev cursor_; // The current cursor. | 219 PP_CursorType_Dev cursor_; // The current cursor. |
225 | 220 |
226 pp::CompletionCallbackFactory<OutOfProcessInstance> timer_factory_; | |
227 | |
228 // Size, in pixels, of plugin rectangle. | 221 // Size, in pixels, of plugin rectangle. |
229 pp::Size plugin_size_; | 222 pp::Size plugin_size_; |
230 // Size, in DIPs, of plugin rectangle. | 223 // Size, in DIPs, of plugin rectangle. |
231 pp::Size plugin_dip_size_; | 224 pp::Size plugin_dip_size_; |
232 // Remaining area, in pixels, to render the pdf in after accounting for | 225 // Remaining area, in pixels, to render the pdf in after accounting for |
233 // horizontal centering. | 226 // horizontal centering. |
234 pp::Rect available_area_; | 227 pp::Rect available_area_; |
235 // Size of entire document in pixels (i.e. if each page is 800 pixels high and | 228 // Size of entire document in pixels (i.e. if each page is 800 pixels high and |
236 // there are 10 pages, the height will be 8000). | 229 // there are 10 pages, the height will be 8000). |
237 pp::Size document_size_; | 230 pp::Size document_size_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 std::unique_ptr<PreviewModeClient> preview_client_; | 287 std::unique_ptr<PreviewModeClient> preview_client_; |
295 | 288 |
296 // This engine is used to render the individual preview page data. This is | 289 // This engine is used to render the individual preview page data. This is |
297 // used only in print preview mode. This will use |PreviewModeClient| | 290 // used only in print preview mode. This will use |PreviewModeClient| |
298 // interface which has very limited access to the pp::Instance. | 291 // interface which has very limited access to the pp::Instance. |
299 std::unique_ptr<PDFEngine> preview_engine_; | 292 std::unique_ptr<PDFEngine> preview_engine_; |
300 | 293 |
301 std::string url_; | 294 std::string url_; |
302 | 295 |
303 // Used for submitting forms. | 296 // Used for submitting forms. |
304 pp::CompletionCallbackFactory<OutOfProcessInstance> form_factory_; | |
305 pp::URLLoader form_loader_; | 297 pp::URLLoader form_loader_; |
306 | 298 |
307 // Used for printing without re-entrancy issues. | 299 pp::CompletionCallbackFactory<OutOfProcessInstance> callback_factory_; |
308 pp::CompletionCallbackFactory<OutOfProcessInstance> print_callback_factory_; | |
309 | 300 |
310 // The callback for receiving the password from the page. | 301 // The callback for receiving the password from the page. |
311 std::unique_ptr<pp::CompletionCallbackWithOutput<pp::Var>> password_callback_; | 302 std::unique_ptr<pp::CompletionCallbackWithOutput<pp::Var>> password_callback_; |
312 | 303 |
313 // True if we haven't painted the plugin viewport yet. | 304 // True if we haven't painted the plugin viewport yet. |
314 bool first_paint_; | 305 bool first_paint_; |
315 | 306 |
316 DocumentLoadState document_load_state_; | 307 DocumentLoadState document_load_state_; |
317 DocumentLoadState preview_document_load_state_; | 308 DocumentLoadState preview_document_load_state_; |
318 | 309 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 378 |
388 // True if the plugin is loaded in print preview, otherwise false. | 379 // True if the plugin is loaded in print preview, otherwise false. |
389 bool is_print_preview_; | 380 bool is_print_preview_; |
390 | 381 |
391 DISALLOW_COPY_AND_ASSIGN(OutOfProcessInstance); | 382 DISALLOW_COPY_AND_ASSIGN(OutOfProcessInstance); |
392 }; | 383 }; |
393 | 384 |
394 } // namespace chrome_pdf | 385 } // namespace chrome_pdf |
395 | 386 |
396 #endif // PDF_OUT_OF_PROCESS_INSTANCE_H_ | 387 #endif // PDF_OUT_OF_PROCESS_INSTANCE_H_ |
OLD | NEW |