Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.h

Issue 2518443002: Experimetal copy of https://codereview.chromium.org/2512783002/ (Closed)
Patch Set: '' Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "ppapi/c/private/ppb_content_decryptor_private.h" 48 #include "ppapi/c/private/ppb_content_decryptor_private.h"
49 #include "ppapi/c/private/ppp_find_private.h" 49 #include "ppapi/c/private/ppp_find_private.h"
50 #include "ppapi/c/private/ppp_instance_private.h" 50 #include "ppapi/c/private/ppp_instance_private.h"
51 #include "ppapi/c/private/ppp_pdf.h" 51 #include "ppapi/c/private/ppp_pdf.h"
52 #include "ppapi/shared_impl/ppb_instance_shared.h" 52 #include "ppapi/shared_impl/ppb_instance_shared.h"
53 #include "ppapi/shared_impl/ppb_view_shared.h" 53 #include "ppapi/shared_impl/ppb_view_shared.h"
54 #include "ppapi/shared_impl/singleton_resource_id.h" 54 #include "ppapi/shared_impl/singleton_resource_id.h"
55 #include "ppapi/shared_impl/tracked_callback.h" 55 #include "ppapi/shared_impl/tracked_callback.h"
56 #include "ppapi/thunk/ppb_gamepad_api.h" 56 #include "ppapi/thunk/ppb_gamepad_api.h"
57 #include "ppapi/thunk/resource_creation_api.h" 57 #include "ppapi/thunk/resource_creation_api.h"
58 #include "printing/features/features.h"
58 #include "third_party/WebKit/public/platform/WebCanvas.h" 59 #include "third_party/WebKit/public/platform/WebCanvas.h"
59 #include "third_party/WebKit/public/platform/WebString.h" 60 #include "third_party/WebKit/public/platform/WebString.h"
60 #include "third_party/WebKit/public/platform/WebURLResponse.h" 61 #include "third_party/WebKit/public/platform/WebURLResponse.h"
61 #include "third_party/WebKit/public/web/WebAssociatedURLLoaderClient.h" 62 #include "third_party/WebKit/public/web/WebAssociatedURLLoaderClient.h"
62 #include "third_party/WebKit/public/web/WebPlugin.h" 63 #include "third_party/WebKit/public/web/WebPlugin.h"
63 #include "third_party/WebKit/public/web/WebUserGestureToken.h" 64 #include "third_party/WebKit/public/web/WebUserGestureToken.h"
64 #include "ui/base/ime/text_input_type.h" 65 #include "ui/base/ime/text_input_type.h"
65 #include "ui/gfx/geometry/rect.h" 66 #include "ui/gfx/geometry/rect.h"
66 #include "url/gurl.h" 67 #include "url/gurl.h"
67 #include "v8/include/v8.h" 68 #include "v8/include/v8.h"
(...skipping 23 matching lines...) Expand all
91 class Rect; 92 class Rect;
92 } 93 }
93 94
94 namespace ppapi { 95 namespace ppapi {
95 class Resource; 96 class Resource;
96 struct InputEventData; 97 struct InputEventData;
97 struct PPP_Instance_Combined; 98 struct PPP_Instance_Combined;
98 class ScopedPPVar; 99 class ScopedPPVar;
99 } 100 }
100 101
102 namespace printing {
103 class MetafileSkiaWrapper;
104 }
105
101 namespace content { 106 namespace content {
102 107
103 class ContentDecryptorDelegate; 108 class ContentDecryptorDelegate;
104 class FullscreenContainer; 109 class FullscreenContainer;
105 class MessageChannel; 110 class MessageChannel;
106 class PepperAudioController; 111 class PepperAudioController;
107 class PepperCompositorHost; 112 class PepperCompositorHost;
108 class PepperGraphics2DHost; 113 class PepperGraphics2DHost;
109 class PluginInstanceThrottlerImpl; 114 class PluginInstanceThrottlerImpl;
110 class PluginModule; 115 class PluginModule;
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 void SendDidChangeView(); 643 void SendDidChangeView();
639 644
640 // Reports the current plugin geometry to the plugin by calling 645 // Reports the current plugin geometry to the plugin by calling
641 // DidChangeView. 646 // DidChangeView.
642 void ReportGeometry(); 647 void ReportGeometry();
643 648
644 // Queries the plugin for supported print formats and sets |format| to the 649 // 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 650 // 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). 651 // print format that we can handle (we can handle only PDF).
647 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format); 652 bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format);
648 bool PrintPDFOutput(PP_Resource print_output, blink::WebCanvas* canvas); 653 bool PrintPDFOutput(PP_Resource print_output,
654 printing::MetafileSkiaWrapper* wrapper);
649 655
650 // Updates the layer for compositing. This creates a layer and attaches to the 656 // Updates the layer for compositing. This creates a layer and attaches to the
651 // container if: 657 // container if:
652 // - we have a bound Graphics3D and the Graphics3D has a texture, OR 658 // - we have a bound Graphics3D and the Graphics3D has a texture, OR
653 // we have a bound Graphics2D and are using software compositing 659 // we have a bound Graphics2D and are using software compositing
654 // - we are not in Flash full-screen mode (or transitioning to it) 660 // - we are not in Flash full-screen mode (or transitioning to it)
655 // Otherwise it destroys the layer. 661 // Otherwise it destroys the layer.
656 // It does either operation lazily. 662 // It does either operation lazily.
657 // force_creation: Force UpdateLayer() to recreate the layer and attaches 663 // force_creation: Force UpdateLayer() to recreate the layer and attaches
658 // to the container. Set to true if the bound device has been changed. 664 // to the container. Set to true if the bound device has been changed.
659 void UpdateLayer(bool force_creation); 665 void UpdateLayer(bool force_creation);
660 666
667 #if BUILDFLAG(ENABLE_PRINTING)
661 // Internal helper function for PrintPage(). 668 // Internal helper function for PrintPage().
662 void PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, 669 void PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
663 int num_ranges, 670 int num_ranges, printing::MetafileSkiaWrapper* wrapper);
664 blink::WebCanvas* canvas); 671 #endif
665 672
666 void DoSetCursor(blink::WebCursorInfo* cursor); 673 void DoSetCursor(blink::WebCursorInfo* cursor);
667 674
668 // Internal helper functions for HandleCompositionXXX(). 675 // Internal helper functions for HandleCompositionXXX().
669 bool SendCompositionEventToPlugin(PP_InputEvent_Type type, 676 bool SendCompositionEventToPlugin(PP_InputEvent_Type type,
670 const base::string16& text); 677 const base::string16& text);
671 bool SendCompositionEventWithUnderlineInformationToPlugin( 678 bool SendCompositionEventWithUnderlineInformationToPlugin(
672 PP_InputEvent_Type type, 679 PP_InputEvent_Type type,
673 const base::string16& text, 680 const base::string16& text,
674 const std::vector<blink::WebCompositionUnderline>& underlines, 681 const std::vector<blink::WebCompositionUnderline>& underlines,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 831
825 // This is only valid between a successful PrintBegin call and a PrintEnd 832 // This is only valid between a successful PrintBegin call and a PrintEnd
826 // call. 833 // call.
827 PP_PrintSettings_Dev current_print_settings_; 834 PP_PrintSettings_Dev current_print_settings_;
828 #if defined(OS_MACOSX) 835 #if defined(OS_MACOSX)
829 // On the Mac, when we draw the bitmap to the PDFContext, it seems necessary 836 // 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 837 // to keep the pixels valid until CGContextEndPage is called. We use this
831 // variable to hold on to the pixels. 838 // variable to hold on to the pixels.
832 scoped_refptr<PPB_ImageData_Impl> last_printed_page_; 839 scoped_refptr<PPB_ImageData_Impl> last_printed_page_;
833 #endif // defined(OS_MACOSX) 840 #endif // defined(OS_MACOSX)
841
842 #if BUILDFLAG(ENABLE_PRINTING)
834 // Always when printing to PDF on Linux and when printing for preview on Mac 843 // 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 844 // 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 845 // 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 846 // 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_| 847 // number in |ranges_|. The hack is in PrintEnd(), where a valid
839 // is preserved in PrintWebViewHelper::PrintPages. This makes it possible 848 // |metafile_wrapper_| is preserved in PrintWebViewHelper::PrintPages. This
840 // to generate the entire PDF given the variables below: 849 // makes it possible to generate the entire PDF given the variables below:
841 // 850 //
842 // The most recently used WebCanvas to be used in printEnd(). Caller must 851 // The most recently used metafile wrapper from the most recently used canvas.
843 // ensure that it remains valid until that point. 852 sk_sp<printing::MetafileSkiaWrapper> metafile_wrapper_;
844 blink::WebCanvas* canvas_; 853 #endif
854
845 // An array of page ranges. 855 // An array of page ranges.
846 std::vector<PP_PrintPageNumberRange_Dev> ranges_; 856 std::vector<PP_PrintPageNumberRange_Dev> ranges_;
847 857
848 scoped_refptr<ppapi::Resource> gamepad_impl_; 858 scoped_refptr<ppapi::Resource> gamepad_impl_;
849 scoped_refptr<ppapi::Resource> uma_private_impl_; 859 scoped_refptr<ppapi::Resource> uma_private_impl_;
850 860
851 // The plugin print interface. 861 // The plugin print interface.
852 const PPP_Printing_Dev* plugin_print_interface_; 862 const PPP_Printing_Dev* plugin_print_interface_;
853 863
854 // The plugin 3D interface. 864 // The plugin 3D interface.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 // view change events. 995 // view change events.
986 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_; 996 base::WeakPtrFactory<PepperPluginInstanceImpl> view_change_weak_ptr_factory_;
987 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_; 997 base::WeakPtrFactory<PepperPluginInstanceImpl> weak_factory_;
988 998
989 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl); 999 DISALLOW_COPY_AND_ASSIGN(PepperPluginInstanceImpl);
990 }; 1000 };
991 1001
992 } // namespace content 1002 } // namespace content
993 1003
994 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_ 1004 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_INSTANCE_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698