Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
Lei Zhang
2011/05/24 00:11:32
Can you leave ppapi_plugin_instance.* alone for no
| |
| 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> |
| 11 #include <vector> | 11 #include <vector> |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 bool checked_for_plugin_messaging_interface_; | 368 bool checked_for_plugin_messaging_interface_; |
| 369 | 369 |
| 370 // This is only valid between a successful PrintBegin call and a PrintEnd | 370 // This is only valid between a successful PrintBegin call and a PrintEnd |
| 371 // call. | 371 // call. |
| 372 PP_PrintSettings_Dev current_print_settings_; | 372 PP_PrintSettings_Dev current_print_settings_; |
| 373 #if defined(OS_MACOSX) | 373 #if defined(OS_MACOSX) |
| 374 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary | 374 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary |
| 375 // to keep the pixels valid until CGContextEndPage is called. We use this | 375 // to keep the pixels valid until CGContextEndPage is called. We use this |
| 376 // variable to hold on to the pixels. | 376 // variable to hold on to the pixels. |
| 377 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; | 377 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; |
| 378 #elif defined(OS_LINUX) | 378 #elif defined(OS_POSIX) |
| 379 // On Linux, all pages need to be written to a PDF file in one shot. However, | 379 // On Unix, all pages need to be written to a PDF file in one shot. However, |
| 380 // when users print only a subset of all the pages, it is impossible to know | 380 // when users print only a subset of all the pages, it is impossible to know |
| 381 // if a call to PrintPage() is the last call. Thus in PrintPage(), just store | 381 // if a call to PrintPage() is the last call. Thus in PrintPage(), just store |
| 382 // the page number in |ranges_|. | 382 // the page number in |ranges_|. |
| 383 // The hack is in PrintEnd(), where a valid |canvas_| is preserved in | 383 // The hack is in PrintEnd(), where a valid |canvas_| is preserved in |
| 384 // PrintWebViewHelper::PrintPages. This makes it possible to generate the | 384 // PrintWebViewHelper::PrintPages. This makes it possible to generate the |
| 385 // entire PDF given the variables below: | 385 // entire PDF given the variables below: |
| 386 // | 386 // |
| 387 // The most recently used WebCanvas, guaranteed to be valid. | 387 // The most recently used WebCanvas, guaranteed to be valid. |
| 388 WebKit::WebCanvas* canvas_; | 388 WebKit::WebCanvas* canvas_; |
| 389 // An array of page ranges. | 389 // An array of page ranges. |
| 390 std::vector<PP_PrintPageNumberRange_Dev> ranges_; | 390 std::vector<PP_PrintPageNumberRange_Dev> ranges_; |
| 391 #endif // defined(OS_LINUX) | 391 #endif // defined(OS_POSIX) |
| 392 | 392 |
| 393 // The plugin print interface. This nested struct adds functions needed for | 393 // The plugin print interface. This nested struct adds functions needed for |
| 394 // backwards compatibility. | 394 // backwards compatibility. |
| 395 struct PPP_Printing_Dev_Combined : public PPP_Printing_Dev { | 395 struct PPP_Printing_Dev_Combined : public PPP_Printing_Dev { |
| 396 // Conversion constructor for the most current interface. Sets all old | 396 // Conversion constructor for the most current interface. Sets all old |
| 397 // functions to NULL, so we know not to try to use them. | 397 // functions to NULL, so we know not to try to use them. |
| 398 PPP_Printing_Dev_Combined(const PPP_Printing_Dev& base_if) | 398 PPP_Printing_Dev_Combined(const PPP_Printing_Dev& base_if) |
| 399 : PPP_Printing_Dev(base_if), | 399 : PPP_Printing_Dev(base_if), |
| 400 QuerySupportedFormats_0_3(NULL), | 400 QuerySupportedFormats_0_3(NULL), |
| 401 Begin_0_3(NULL) {} | 401 Begin_0_3(NULL) {} |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; | 454 typedef std::map<NPObject*, ObjectVar*> NPObjectToObjectVarMap; |
| 455 NPObjectToObjectVarMap np_object_to_object_var_; | 455 NPObjectToObjectVarMap np_object_to_object_var_; |
| 456 | 456 |
| 457 DISALLOW_COPY_AND_ASSIGN(PluginInstance); | 457 DISALLOW_COPY_AND_ASSIGN(PluginInstance); |
| 458 }; | 458 }; |
| 459 | 459 |
| 460 } // namespace ppapi | 460 } // namespace ppapi |
| 461 } // namespace webkit | 461 } // namespace webkit |
| 462 | 462 |
| 463 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ | 463 #endif // WEBKIT_PLUGINS_PPAPI_PPAPI_PLUGIN_INSTANCE_H_ |
| OLD | NEW |