OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 // This is only valid between a successful PrintBegin call and a PrintEnd | 395 // This is only valid between a successful PrintBegin call and a PrintEnd |
396 // call. | 396 // call. |
397 PP_PrintSettings_Dev_0_4 current_print_settings_; | 397 PP_PrintSettings_Dev_0_4 current_print_settings_; |
398 #if defined(OS_MACOSX) | 398 #if defined(OS_MACOSX) |
399 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary | 399 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary |
400 // to keep the pixels valid until CGContextEndPage is called. We use this | 400 // to keep the pixels valid until CGContextEndPage is called. We use this |
401 // variable to hold on to the pixels. | 401 // variable to hold on to the pixels. |
402 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; | 402 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; |
403 #endif // defined(OS_MACOSX) | 403 #endif // defined(OS_MACOSX) |
404 #if WEBKIT_USING_SKIA | 404 #if defined(OS_LINUX) || defined(OS_WIN) |
405 // When printing to PDF (print preview, Linux) the entire document goes into | 405 // When printing to PDF (print preview, Linux) the entire document goes into |
406 // one metafile. However, when users print only a subset of all the pages, | 406 // one metafile. However, when users print only a subset of all the pages, |
407 // it is impossible to know if a call to PrintPage() is the last call. | 407 // it is impossible to know if a call to PrintPage() is the last call. |
408 // Thus in PrintPage(), just store the page number in |ranges_|. | 408 // Thus in PrintPage(), just store the page number in |ranges_|. |
409 // The hack is in PrintEnd(), where a valid |canvas_| is preserved in | 409 // The hack is in PrintEnd(), where a valid |canvas_| is preserved in |
410 // PrintWebViewHelper::PrintPages. This makes it possible to generate the | 410 // PrintWebViewHelper::PrintPages. This makes it possible to generate the |
411 // entire PDF given the variables below: | 411 // entire PDF given the variables below: |
412 // | 412 // |
413 // The most recently used WebCanvas, guaranteed to be valid. | 413 // The most recently used WebCanvas, guaranteed to be valid. |
414 SkRefPtr<WebKit::WebCanvas> canvas_; | 414 SkRefPtr<WebKit::WebCanvas> canvas_; |
415 // An array of page ranges. | 415 // An array of page ranges. |
416 std::vector<PP_PrintPageNumberRange_Dev> ranges_; | 416 std::vector<PP_PrintPageNumberRange_Dev> ranges_; |
417 #endif // WEBKIT_USING_SKIA | 417 #endif // OS_LINUX || OS_WIN |
418 | 418 |
419 // The plugin print interface. This nested struct adds functions needed for | 419 // The plugin print interface. This nested struct adds functions needed for |
420 // backwards compatibility. | 420 // backwards compatibility. |
421 struct PPP_Printing_Dev_Combined : public PPP_Printing_Dev_0_4 { | 421 struct PPP_Printing_Dev_Combined : public PPP_Printing_Dev_0_4 { |
422 // Conversion constructor for the most current interface. Sets all old | 422 // Conversion constructor for the most current interface. Sets all old |
423 // functions to NULL, so we know not to try to use them. | 423 // functions to NULL, so we know not to try to use them. |
424 PPP_Printing_Dev_Combined(const PPP_Printing_Dev_0_4& base_if) | 424 PPP_Printing_Dev_Combined(const PPP_Printing_Dev_0_4& base_if) |
425 : PPP_Printing_Dev_0_4(base_if), | 425 : PPP_Printing_Dev_0_4(base_if), |
426 QuerySupportedFormats_0_3(NULL), | 426 QuerySupportedFormats_0_3(NULL), |
427 Begin_0_3(NULL) {} | 427 Begin_0_3(NULL) {} |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; | 483 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; |
484 NPObjectToObjectVarMap np_object_to_object_var_; | 484 NPObjectToObjectVarMap np_object_to_object_var_; |
485 | 485 |
486 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 486 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
487 }; | 487 }; |
488 | 488 |
489 } // namespace ppapi | 489 } // namespace ppapi |
490 } // namespace webkit | 490 } // namespace webkit |
491 | 491 |
492 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 492 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
OLD | NEW |