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 #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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 #include "ppapi/shared_impl/ppb_view_shared.h" | 85 #include "ppapi/shared_impl/ppb_view_shared.h" |
86 #include "ppapi/shared_impl/ppp_instance_combined.h" | 86 #include "ppapi/shared_impl/ppp_instance_combined.h" |
87 #include "ppapi/shared_impl/resource.h" | 87 #include "ppapi/shared_impl/resource.h" |
88 #include "ppapi/shared_impl/scoped_pp_resource.h" | 88 #include "ppapi/shared_impl/scoped_pp_resource.h" |
89 #include "ppapi/shared_impl/scoped_pp_var.h" | 89 #include "ppapi/shared_impl/scoped_pp_var.h" |
90 #include "ppapi/shared_impl/time_conversion.h" | 90 #include "ppapi/shared_impl/time_conversion.h" |
91 #include "ppapi/shared_impl/url_request_info_data.h" | 91 #include "ppapi/shared_impl/url_request_info_data.h" |
92 #include "ppapi/shared_impl/var.h" | 92 #include "ppapi/shared_impl/var.h" |
93 #include "ppapi/thunk/enter.h" | 93 #include "ppapi/thunk/enter.h" |
94 #include "ppapi/thunk/ppb_buffer_api.h" | 94 #include "ppapi/thunk/ppb_buffer_api.h" |
95 #include "printing/metafile.h" | |
96 #include "printing/metafile_skia_wrapper.h" | 95 #include "printing/metafile_skia_wrapper.h" |
| 96 #include "printing/pdf_metafile_skia.h" |
97 #include "printing/units.h" | 97 #include "printing/units.h" |
98 #include "skia/ext/platform_canvas.h" | 98 #include "skia/ext/platform_canvas.h" |
99 #include "skia/ext/platform_device.h" | 99 #include "skia/ext/platform_device.h" |
100 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 100 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
101 #include "third_party/WebKit/public/platform/WebGamepads.h" | 101 #include "third_party/WebKit/public/platform/WebGamepads.h" |
102 #include "third_party/WebKit/public/platform/WebRect.h" | 102 #include "third_party/WebKit/public/platform/WebRect.h" |
103 #include "third_party/WebKit/public/platform/WebString.h" | 103 #include "third_party/WebKit/public/platform/WebString.h" |
104 #include "third_party/WebKit/public/platform/WebURL.h" | 104 #include "third_party/WebKit/public/platform/WebURL.h" |
105 #include "third_party/WebKit/public/platform/WebURLError.h" | 105 #include "third_party/WebKit/public/platform/WebURLError.h" |
106 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 106 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
(...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1966 if (!pdf_module) | 1966 if (!pdf_module) |
1967 return false; | 1967 return false; |
1968 RenderPDFPageToDCProc render_proc = reinterpret_cast<RenderPDFPageToDCProc>( | 1968 RenderPDFPageToDCProc render_proc = reinterpret_cast<RenderPDFPageToDCProc>( |
1969 GetProcAddress(pdf_module, "RenderPDFPageToDC")); | 1969 GetProcAddress(pdf_module, "RenderPDFPageToDC")); |
1970 if (!render_proc) | 1970 if (!render_proc) |
1971 return false; | 1971 return false; |
1972 #endif // defined(OS_WIN) | 1972 #endif // defined(OS_WIN) |
1973 | 1973 |
1974 bool ret = false; | 1974 bool ret = false; |
1975 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 1975 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
1976 printing::Metafile* metafile = | 1976 printing::PdfMetafileSkia* metafile = |
1977 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); | 1977 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); |
1978 DCHECK(metafile != NULL); | 1978 DCHECK(metafile != NULL); |
1979 if (metafile) | 1979 if (metafile) |
1980 ret = metafile->InitFromData(mapper.data(), mapper.size()); | 1980 ret = metafile->InitFromData(mapper.data(), mapper.size()); |
1981 #elif defined(OS_WIN) | 1981 #elif defined(OS_WIN) |
1982 printing::Metafile* metafile = | 1982 printing::PdfMetafileSkia* metafile = |
1983 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); | 1983 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); |
1984 if (metafile) { | 1984 if (metafile) { |
1985 // We only have a metafile when doing print preview, so we just want to | 1985 // We only have a metafile when doing print preview, so we just want to |
1986 // pass the PDF off to preview. | 1986 // pass the PDF off to preview. |
1987 ret = metafile->InitFromData(mapper.data(), mapper.size()); | 1987 ret = metafile->InitFromData(mapper.data(), mapper.size()); |
1988 } else { | 1988 } else { |
1989 // On Windows, we now need to render the PDF to the DC that backs the | 1989 // On Windows, we now need to render the PDF to the DC that backs the |
1990 // supplied canvas. | 1990 // supplied canvas. |
1991 HDC dc = skia::BeginPlatformPaint(canvas); | 1991 HDC dc = skia::BeginPlatformPaint(canvas); |
1992 DrawEmptyRectangle(dc); | 1992 DrawEmptyRectangle(dc); |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3367 // Running out-of-process. Initiate an IPC call to notify the plugin | 3367 // Running out-of-process. Initiate an IPC call to notify the plugin |
3368 // process. | 3368 // process. |
3369 ppapi::proxy::HostDispatcher* dispatcher = | 3369 ppapi::proxy::HostDispatcher* dispatcher = |
3370 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3370 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3371 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3371 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3372 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3372 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3373 } | 3373 } |
3374 } | 3374 } |
3375 | 3375 |
3376 } // namespace content | 3376 } // namespace content |
OLD | NEW |