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

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

Issue 255543006: Printing on Windows via PDF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy Created 6 years, 7 months 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 | Annotate | Revision Log
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 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #include "ppapi/shared_impl/ppb_view_shared.h" 79 #include "ppapi/shared_impl/ppb_view_shared.h"
80 #include "ppapi/shared_impl/ppp_instance_combined.h" 80 #include "ppapi/shared_impl/ppp_instance_combined.h"
81 #include "ppapi/shared_impl/resource.h" 81 #include "ppapi/shared_impl/resource.h"
82 #include "ppapi/shared_impl/scoped_pp_resource.h" 82 #include "ppapi/shared_impl/scoped_pp_resource.h"
83 #include "ppapi/shared_impl/time_conversion.h" 83 #include "ppapi/shared_impl/time_conversion.h"
84 #include "ppapi/shared_impl/url_request_info_data.h" 84 #include "ppapi/shared_impl/url_request_info_data.h"
85 #include "ppapi/shared_impl/var.h" 85 #include "ppapi/shared_impl/var.h"
86 #include "ppapi/thunk/enter.h" 86 #include "ppapi/thunk/enter.h"
87 #include "ppapi/thunk/ppb_buffer_api.h" 87 #include "ppapi/thunk/ppb_buffer_api.h"
88 #include "printing/metafile.h" 88 #include "printing/metafile.h"
89 #include "printing/metafile_impl.h"
89 #include "printing/metafile_skia_wrapper.h" 90 #include "printing/metafile_skia_wrapper.h"
90 #include "printing/units.h" 91 #include "printing/units.h"
91 #include "skia/ext/platform_canvas.h" 92 #include "skia/ext/platform_canvas.h"
92 #include "skia/ext/platform_device.h" 93 #include "skia/ext/platform_device.h"
93 #include "third_party/WebKit/public/platform/WebCursorInfo.h" 94 #include "third_party/WebKit/public/platform/WebCursorInfo.h"
94 #include "third_party/WebKit/public/platform/WebGamepads.h" 95 #include "third_party/WebKit/public/platform/WebGamepads.h"
95 #include "third_party/WebKit/public/platform/WebRect.h" 96 #include "third_party/WebKit/public/platform/WebRect.h"
96 #include "third_party/WebKit/public/platform/WebString.h" 97 #include "third_party/WebKit/public/platform/WebString.h"
97 #include "third_party/WebKit/public/platform/WebURL.h" 98 #include "third_party/WebKit/public/platform/WebURL.h"
98 #include "third_party/WebKit/public/platform/WebURLError.h" 99 #include "third_party/WebKit/public/platform/WebURLError.h"
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 1631
1631 bool PepperPluginInstanceImpl::PrintPage(int page_number, 1632 bool PepperPluginInstanceImpl::PrintPage(int page_number,
1632 blink::WebCanvas* canvas) { 1633 blink::WebCanvas* canvas) {
1633 #if defined(ENABLE_FULL_PRINTING) 1634 #if defined(ENABLE_FULL_PRINTING)
1634 DCHECK(plugin_print_interface_); 1635 DCHECK(plugin_print_interface_);
1635 PP_PrintPageNumberRange_Dev page_range; 1636 PP_PrintPageNumberRange_Dev page_range;
1636 page_range.first_page_number = page_range.last_page_number = page_number; 1637 page_range.first_page_number = page_range.last_page_number = page_number;
1637 // The canvas only has a metafile on it for print preview. 1638 // The canvas only has a metafile on it for print preview.
1638 bool save_for_later = 1639 bool save_for_later =
1639 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL); 1640 (printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas) != NULL);
1640 #if defined(OS_MACOSX) || defined(OS_WIN) 1641 #if defined(OS_MACOSX) || \
1642 (defined(OS_WIN) && !defined(PRINTING_WIN_USES_PDF_AS_METAFILE))
1641 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas); 1643 save_for_later = save_for_later && skia::IsPreviewMetafile(*canvas);
1642 #endif 1644 #endif
1643 if (save_for_later) { 1645 if (save_for_later) {
1644 ranges_.push_back(page_range); 1646 ranges_.push_back(page_range);
1645 canvas_ = skia::SharePtr(canvas); 1647 canvas_ = skia::SharePtr(canvas);
1646 return true; 1648 return true;
1647 } else { 1649 } else {
1648 return PrintPageHelper(&page_range, 1, canvas); 1650 return PrintPageHelper(&page_range, 1, canvas);
1649 } 1651 }
1650 #else // defined(ENABLED_PRINTING) 1652 #else // defined(ENABLED_PRINTING)
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3138 // Running out-of-process. Initiate an IPC call to notify the plugin 3140 // Running out-of-process. Initiate an IPC call to notify the plugin
3139 // process. 3141 // process.
3140 ppapi::proxy::HostDispatcher* dispatcher = 3142 ppapi::proxy::HostDispatcher* dispatcher =
3141 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3143 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3142 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3144 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3143 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3145 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3144 } 3146 }
3145 } 3147 }
3146 3148
3147 } // namespace content 3149 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698