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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/pepper/pepper_plugin_instance_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_plugin_instance_impl.h
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.h b/content/renderer/pepper/pepper_plugin_instance_impl.h
index dade2ee2e63503878d7917311a4de7a5f33ce407..a124563e35d3bfafa9ecacf47d1a74f48cae004b 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.h
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.h
@@ -55,6 +55,7 @@
#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/ppb_gamepad_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "printing/features/features.h"
#include "third_party/WebKit/public/platform/WebCanvas.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURLResponse.h"
@@ -98,6 +99,10 @@ struct PPP_Instance_Combined;
class ScopedPPVar;
}
+namespace printing {
+class MetafileSkiaWrapper;
+}
+
namespace content {
class ContentDecryptorDelegate;
@@ -645,7 +650,8 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// best format to use. Returns false if the plugin does not support any
// print format that we can handle (we can handle only PDF).
bool GetPreferredPrintOutputFormat(PP_PrintOutputFormat_Dev* format);
- bool PrintPDFOutput(PP_Resource print_output, blink::WebCanvas* canvas);
+ bool PrintPDFOutput(PP_Resource print_output,
+ printing::MetafileSkiaWrapper* wrapper);
// Updates the layer for compositing. This creates a layer and attaches to the
// container if:
@@ -658,10 +664,11 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// to the container. Set to true if the bound device has been changed.
void UpdateLayer(bool force_creation);
+#if BUILDFLAG(ENABLE_PRINTING)
// Internal helper function for PrintPage().
void PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges,
- int num_ranges,
- blink::WebCanvas* canvas);
+ int num_ranges, printing::MetafileSkiaWrapper* wrapper);
+#endif
void DoSetCursor(blink::WebCursorInfo* cursor);
@@ -831,17 +838,20 @@ class CONTENT_EXPORT PepperPluginInstanceImpl
// variable to hold on to the pixels.
scoped_refptr<PPB_ImageData_Impl> last_printed_page_;
#endif // defined(OS_MACOSX)
+
+#if BUILDFLAG(ENABLE_PRINTING)
// Always when printing to PDF on Linux and when printing for preview on Mac
// and Win, the entire document goes into one metafile. However, when users
// print only a subset of all the pages, it is impossible to know if a call
// to PrintPage() is the last call. Thus in PrintPage(), just store the page
- // number in |ranges_|. The hack is in PrintEnd(), where a valid |canvas_|
- // is preserved in PrintWebViewHelper::PrintPages. This makes it possible
- // to generate the entire PDF given the variables below:
+ // number in |ranges_|. The hack is in PrintEnd(), where a valid
+ // |metafile_wrapper_| is preserved in PrintWebViewHelper::PrintPages. This
+ // makes it possible to generate the entire PDF given the variables below:
//
- // The most recently used WebCanvas to be used in printEnd(). Caller must
- // ensure that it remains valid until that point.
- blink::WebCanvas* canvas_;
+ // The most recently used metafile wrapper from the most recently used canvas.
+ sk_sp<printing::MetafileSkiaWrapper> metafile_wrapper_;
+#endif
+
// An array of page ranges.
std::vector<PP_PrintPageNumberRange_Dev> ranges_;
« 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