| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // (see has_webkit_focus_ below). | 299 // (see has_webkit_focus_ below). |
| 300 bool PluginHasFocus() const; | 300 bool PluginHasFocus() const; |
| 301 | 301 |
| 302 // Reports the current plugin geometry to the plugin by calling | 302 // Reports the current plugin geometry to the plugin by calling |
| 303 // DidChangeView. | 303 // DidChangeView. |
| 304 void ReportGeometry(); | 304 void ReportGeometry(); |
| 305 | 305 |
| 306 // Queries the plugin for supported print formats and sets |format| to the | 306 // Queries the plugin for supported print formats and sets |format| to the |
| 307 // best format to use. Returns false if the plugin does not support any | 307 // best format to use. Returns false if the plugin does not support any |
| 308 // print format that we can handle (we can handle raster and PDF). | 308 // print format that we can handle (we can handle raster and PDF). |
| 309 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev_0_4* format); | 309 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); |
| 310 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 310 bool PrintPDFOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
| 311 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); | 311 bool PrintRasterOutput(PP_Resource print_output, WebKit::WebCanvas* canvas); |
| 312 #if defined(OS_WIN) | 312 #if defined(OS_WIN) |
| 313 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, | 313 bool DrawJPEGToPlatformDC(const SkBitmap& bitmap, |
| 314 const gfx::Rect& printable_area, | 314 const gfx::Rect& printable_area, |
| 315 WebKit::WebCanvas* canvas); | 315 WebKit::WebCanvas* canvas); |
| 316 #elif defined(OS_MACOSX) && !defined(USE_SKIA) | 316 #elif defined(OS_MACOSX) && !defined(USE_SKIA) |
| 317 // Draws the given kARGB_8888_Config bitmap to the specified canvas starting | 317 // Draws the given kARGB_8888_Config bitmap to the specified canvas starting |
| 318 // at the specified destination rect. | 318 // at the specified destination rect. |
| 319 void DrawSkBitmapToCanvas(const SkBitmap& bitmap, WebKit::WebCanvas* canvas, | 319 void DrawSkBitmapToCanvas(const SkBitmap& bitmap, WebKit::WebCanvas* canvas, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 const PPP_Selection_Dev* plugin_selection_interface_; | 394 const PPP_Selection_Dev* plugin_selection_interface_; |
| 395 const PPP_Zoom_Dev* plugin_zoom_interface_; | 395 const PPP_Zoom_Dev* plugin_zoom_interface_; |
| 396 | 396 |
| 397 // Flags indicating whether we have asked this plugin instance for the | 397 // Flags indicating whether we have asked this plugin instance for the |
| 398 // corresponding interfaces, so that we can ask only once. | 398 // corresponding interfaces, so that we can ask only once. |
| 399 bool checked_for_plugin_input_event_interface_; | 399 bool checked_for_plugin_input_event_interface_; |
| 400 bool checked_for_plugin_messaging_interface_; | 400 bool checked_for_plugin_messaging_interface_; |
| 401 | 401 |
| 402 // This is only valid between a successful PrintBegin call and a PrintEnd | 402 // This is only valid between a successful PrintBegin call and a PrintEnd |
| 403 // call. | 403 // call. |
| 404 PP_PrintSettings_Dev_0_4 current_print_settings_; | 404 PP_PrintSettings_Dev current_print_settings_; |
| 405 #if defined(OS_MACOSX) | 405 #if defined(OS_MACOSX) |
| 406 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary | 406 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary |
| 407 // to keep the pixels valid until CGContextEndPage is called. We use this | 407 // to keep the pixels valid until CGContextEndPage is called. We use this |
| 408 // variable to hold on to the pixels. | 408 // variable to hold on to the pixels. |
| 409 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; | 409 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; |
| 410 #endif // defined(OS_MACOSX) | 410 #endif // defined(OS_MACOSX) |
| 411 #if defined(OS_LINUX) || defined(OS_WIN) | 411 #if defined(OS_LINUX) || defined(OS_WIN) |
| 412 // When printing to PDF (print preview, Linux) the entire document goes into | 412 // When printing to PDF (print preview, Linux) the entire document goes into |
| 413 // one metafile. However, when users print only a subset of all the pages, | 413 // one metafile. However, when users print only a subset of all the pages, |
| 414 // it is impossible to know if a call to PrintPage() is the last call. | 414 // it is impossible to know if a call to PrintPage() is the last call. |
| 415 // Thus in PrintPage(), just store the page number in |ranges_|. | 415 // Thus in PrintPage(), just store the page number in |ranges_|. |
| 416 // The hack is in PrintEnd(), where a valid |canvas_| is preserved in | 416 // The hack is in PrintEnd(), where a valid |canvas_| is preserved in |
| 417 // PrintWebViewHelper::PrintPages. This makes it possible to generate the | 417 // PrintWebViewHelper::PrintPages. This makes it possible to generate the |
| 418 // entire PDF given the variables below: | 418 // entire PDF given the variables below: |
| 419 // | 419 // |
| 420 // The most recently used WebCanvas, guaranteed to be valid. | 420 // The most recently used WebCanvas, guaranteed to be valid. |
| 421 SkRefPtr<WebKit::WebCanvas> canvas_; | 421 SkRefPtr<WebKit::WebCanvas> canvas_; |
| 422 // An array of page ranges. | 422 // An array of page ranges. |
| 423 std::vector<PP_PrintPageNumberRange_Dev> ranges_; | 423 std::vector<PP_PrintPageNumberRange_Dev> ranges_; |
| 424 #endif // OS_LINUX || OS_WIN | 424 #endif // OS_LINUX || OS_WIN |
| 425 | 425 |
| 426 // The plugin print interface. This nested struct adds functions needed for | 426 // The plugin print interface. |
| 427 // backwards compatibility. | 427 const PPP_Printing_Dev* plugin_print_interface_; |
| 428 struct PPP_Printing_Dev_Combined : public PPP_Printing_Dev_0_4 { | |
| 429 // Conversion constructor for the most current interface. Sets all old | |
| 430 // functions to NULL, so we know not to try to use them. | |
| 431 PPP_Printing_Dev_Combined(const PPP_Printing_Dev_0_4& base_if) | |
| 432 : PPP_Printing_Dev_0_4(base_if), | |
| 433 QuerySupportedFormats_0_3(NULL), | |
| 434 Begin_0_3(NULL) {} | |
| 435 | |
| 436 // Conversion constructor for version 0.3. Sets unsupported functions to | |
| 437 // NULL, so we know not to try to use them. | |
| 438 PPP_Printing_Dev_Combined(const PPP_Printing_Dev_0_3& old_if) | |
| 439 : PPP_Printing_Dev_0_4(), // NOTE: The parens are important, to zero- | |
| 440 // initialize the struct. | |
| 441 // Except older version of g++ doesn't! | |
| 442 // So do it explicitly in the ctor. | |
| 443 QuerySupportedFormats_0_3(old_if.QuerySupportedFormats), | |
| 444 Begin_0_3(old_if.Begin) { | |
| 445 QuerySupportedFormats = NULL; | |
| 446 Begin = NULL; | |
| 447 PrintPages = old_if.PrintPages; | |
| 448 End = old_if.End; | |
| 449 } | |
| 450 | |
| 451 // The 0.3 version of 'QuerySupportedFormats'. | |
| 452 PP_PrintOutputFormat_Dev_0_3* (*QuerySupportedFormats_0_3)( | |
| 453 PP_Instance instance, uint32_t* format_count); | |
| 454 // The 0.3 version of 'Begin'. | |
| 455 int32_t (*Begin_0_3)(PP_Instance instance, | |
| 456 const PP_PrintSettings_Dev_0_3* print_settings); | |
| 457 }; | |
| 458 scoped_ptr<PPP_Printing_Dev_Combined> plugin_print_interface_; | |
| 459 | 428 |
| 460 // The plugin 3D interface. | 429 // The plugin 3D interface. |
| 461 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; | 430 const PPP_Graphics3D_Dev* plugin_graphics_3d_interface_; |
| 462 | 431 |
| 463 // Contains the cursor if it's set by the plugin. | 432 // Contains the cursor if it's set by the plugin. |
| 464 scoped_ptr<WebKit::WebCursorInfo> cursor_; | 433 scoped_ptr<WebKit::WebCursorInfo> cursor_; |
| 465 | 434 |
| 466 // Set to true if this plugin thinks it will always be on top. This allows us | 435 // Set to true if this plugin thinks it will always be on top. This allows us |
| 467 // to use a more optimized painting path in some cases. | 436 // to use a more optimized painting path in some cases. |
| 468 bool always_on_top_; | 437 bool always_on_top_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 490 uint32_t input_event_mask_; | 459 uint32_t input_event_mask_; |
| 491 uint32_t filtered_input_event_mask_; | 460 uint32_t filtered_input_event_mask_; |
| 492 | 461 |
| 493 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 462 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 494 }; | 463 }; |
| 495 | 464 |
| 496 } // namespace ppapi | 465 } // namespace ppapi |
| 497 } // namespace webkit | 466 } // namespace webkit |
| 498 | 467 |
| 499 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 468 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |