Chromium Code Reviews| 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 CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 class Rect; | 91 class Rect; |
| 92 } | 92 } |
| 93 | 93 |
| 94 namespace ppapi { | 94 namespace ppapi { |
| 95 class Resource; | 95 class Resource; |
| 96 struct InputEventData; | 96 struct InputEventData; |
| 97 struct PPP_Instance_Combined; | 97 struct PPP_Instance_Combined; |
| 98 class ScopedPPVar; | 98 class ScopedPPVar; |
| 99 } | 99 } |
| 100 | 100 |
| 101 namespace printing { | |
| 102 class MetafileSkiaWrapper; | |
| 103 } | |
| 104 | |
| 101 namespace content { | 105 namespace content { |
| 102 | 106 |
| 103 class ContentDecryptorDelegate; | 107 class ContentDecryptorDelegate; |
| 104 class FullscreenContainer; | 108 class FullscreenContainer; |
| 105 class MessageChannel; | 109 class MessageChannel; |
| 106 class PepperAudioController; | 110 class PepperAudioController; |
| 107 class PepperCompositorHost; | 111 class PepperCompositorHost; |
| 108 class PepperGraphics2DHost; | 112 class PepperGraphics2DHost; |
| 109 class PluginInstanceThrottlerImpl; | 113 class PluginInstanceThrottlerImpl; |
| 110 class PluginModule; | 114 class PluginModule; |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 638 void SendDidChangeView(); | 642 void SendDidChangeView(); |
| 639 | 643 |
| 640 // Reports the current plugin geometry to the plugin by calling | 644 // Reports the current plugin geometry to the plugin by calling |
| 641 // DidChangeView. | 645 // DidChangeView. |
| 642 void ReportGeometry(); | 646 void ReportGeometry(); |
| 643 | 647 |
| 644 // Queries the plugin for supported print formats and sets |format| to the | 648 // Queries the plugin for supported print formats and sets |format| to the |
| 645 // best format to use. Returns false if the plugin does not support any | 649 // best format to use. Returns false if the plugin does not support any |
| 646 // print format that we can handle (we can handle only PDF). | 650 // print format that we can handle (we can handle only PDF). |
| 647 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); | 651 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); |
| 648 bool PrintPDFOutput(PP_Resource print_output, blink::WebCanvas* canvas); | 652 bool PrintPDFOutput(PP_Resource print_output, |
| 653 printing::MetafileSkiaWrapper* wrapper); | |
| 649 | 654 |
| 650 // Updates the layer for compositing. This creates a layer and attaches to the | 655 // Updates the layer for compositing. This creates a layer and attaches to the |
| 651 // container if: | 656 // container if: |
| 652 // - we have a bound Graphics3D and the Graphics3D has a texture, OR | 657 // - we have a bound Graphics3D and the Graphics3D has a texture, OR |
| 653 // we have a bound Graphics2D and are using software compositing | 658 // we have a bound Graphics2D and are using software compositing |
| 654 // - we are not in Flash full-screen mode (or transitioning to it) | 659 // - we are not in Flash full-screen mode (or transitioning to it) |
| 655 // Otherwise it destroys the layer. | 660 // Otherwise it destroys the layer. |
| 656 // It does either operation lazily. | 661 // It does either operation lazily. |
| 657 // force_creation: Force UpdateLayer() to recreate the layer and attaches | 662 // force_creation: Force UpdateLayer() to recreate the layer and attaches |
| 658 // to the container. Set to true if the bound device has been changed. | 663 // to the container. Set to true if the bound device has been changed. |
| 659 void UpdateLayer(bool force_creation); | 664 void UpdateLayer(bool force_creation); |
| 660 | 665 |
| 661 // Internal helper function for PrintPage(). | 666 // Internal helper function for PrintPage(). |
| 662 void PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, | 667 void PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
| 663 int num_ranges, | 668 int num_ranges, printing::MetafileSkiaWrapper* wrapper); |
| 664 blink::WebCanvas* canvas); | |
| 665 | 669 |
| 666 void DoSetCursor(blink::WebCursorInfo* cursor); | 670 void DoSetCursor(blink::WebCursorInfo* cursor); |
| 667 | 671 |
| 668 // Internal helper functions for HandleCompositionXXX(). | 672 // Internal helper functions for HandleCompositionXXX(). |
| 669 bool SendCompositionEventToPlugin(PP_InputEvent_Type type, | 673 bool SendCompositionEventToPlugin(PP_InputEvent_Type type, |
| 670 const base::string16& text); | 674 const base::string16& text); |
| 671 bool SendCompositionEventWithUnderlineInformationToPlugin( | 675 bool SendCompositionEventWithUnderlineInformationToPlugin( |
| 672 PP_InputEvent_Type type, | 676 PP_InputEvent_Type type, |
| 673 const base::string16& text, | 677 const base::string16& text, |
| 674 const std::vector<blink::WebCompositionUnderline>& underlines, | 678 const std::vector<blink::WebCompositionUnderline>& underlines, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 828 #if defined(OS_MACOSX) | 832 #if defined(OS_MACOSX) |
| 829 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary | 833 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary |
| 830 // to keep the pixels valid until CGContextEndPage is called. We use this | 834 // to keep the pixels valid until CGContextEndPage is called. We use this |
| 831 // variable to hold on to the pixels. | 835 // variable to hold on to the pixels. |
| 832 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; | 836 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; |
| 833 #endif // defined(OS_MACOSX) | 837 #endif // defined(OS_MACOSX) |
| 834 // Always when printing to PDF on Linux and when printing for preview on Mac | 838 // Always when printing to PDF on Linux and when printing for preview on Mac |
| 835 // and Win, the entire document goes into one metafile. However, when users | 839 // and Win, the entire document goes into one metafile. However, when users |
| 836 // print only a subset of all the pages, it is impossible to know if a call | 840 // print only a subset of all the pages, it is impossible to know if a call |
| 837 // to PrintPage() is the last call. Thus in PrintPage(), just store the page | 841 // to PrintPage() is the last call. Thus in PrintPage(), just store the page |
| 838 // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_| | 842 // number in |ranges_|. The hack is in PrintEnd(), where a valid |
| 843 // |metafile_wrapper_| | |
|
bbudge
2016/11/17 22:37:00
nit: formatting is a little hard to read here.
| |
| 839 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible | 844 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible |
| 840 // to generate the entire PDF given the variables below: | 845 // to generate the entire PDF given the variables below: |
| 841 // | 846 // |
| 842 // The most recently used WebCanvas to be used in printEnd(). Caller must | 847 // The most recently used metafile wrapper from the most recently used canvas |
| 843 // ensure that it remains valid until that point. | 848 sk_sp<printing::MetafileSkiaWrapper> metafile_wrapper_; |
|
Lei Zhang
2016/11/18 02:25:53
So this is slightly problematic as-is because it a
| |
| 844 blink::WebCanvas* canvas_; | |
| 845 // An array of page ranges. | 849 // An array of page ranges. |
| 846 std::vector<PP_PrintPageNumberRange_Dev> ranges_; | 850 std::vector<PP_PrintPageNumberRange_Dev> ranges_; |
| 847 | 851 |
| 848 scoped_refptr<ppapi::Resource> gamepad_impl_; | 852 scoped_refptr<ppapi::Resource> gamepad_impl_; |
| 849 scoped_refptr<ppapi::Resource> uma_private_impl_; | 853 scoped_refptr<ppapi::Resource> uma_private_impl_; |
| 850 | 854 |
| 851 // The plugin print interface. | 855 // The plugin print interface. |
| 852 const PPP_Printing_Dev* plugin_print_interface_; | 856 const PPP_Printing_Dev* plugin_print_interface_; |
| 853 | 857 |
| 854 // The plugin 3D interface. | 858 // The plugin 3D interface. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 985 // view change events. | 989 // view change events. |
| 986 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; | 990 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; |
| 987 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_; | 991 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_; |
| 988 | 992 |
| 989 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); | 993 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); |
| 990 }; | 994 }; |
| 991 | 995 |
| 992 } // namespace content | 996 } // namespace content |
| 993 | 997 |
| 994 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ | 998 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ |
| OLD | NEW |