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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 #include "ui/gfx/range/range.h" | 126 #include "ui/gfx/range/range.h" |
127 #include "ui/gfx/rect_conversions.h" | 127 #include "ui/gfx/rect_conversions.h" |
128 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 128 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
129 #include "v8/include/v8.h" | 129 #include "v8/include/v8.h" |
130 | 130 |
131 #if defined(OS_CHROMEOS) | 131 #if defined(OS_CHROMEOS) |
132 #include "ui/events/keycodes/keyboard_codes_posix.h" | 132 #include "ui/events/keycodes/keyboard_codes_posix.h" |
133 #endif | 133 #endif |
134 | 134 |
135 #if defined(OS_MACOSX) | 135 #if defined(OS_MACOSX) |
136 #include "printing/metafile_impl.h" | 136 #include "printing/pdf_metafile_skia.h" |
137 #endif // defined(OS_MACOSX) | 137 #endif // defined(OS_MACOSX) |
138 | 138 |
139 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
140 #include "base/metrics/histogram.h" | 140 #include "base/metrics/histogram.h" |
141 #include "base/win/windows_version.h" | 141 #include "base/win/windows_version.h" |
142 #include "skia/ext/platform_canvas.h" | 142 #include "skia/ext/platform_canvas.h" |
143 #include "ui/gfx/codec/jpeg_codec.h" | 143 #include "ui/gfx/codec/jpeg_codec.h" |
144 #include "ui/gfx/gdi_util.h" | 144 #include "ui/gfx/gdi_util.h" |
145 #endif | 145 #endif |
146 | 146 |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 if (!pdf_module) | 1944 if (!pdf_module) |
1945 return false; | 1945 return false; |
1946 RenderPDFPageToDCProc render_proc = reinterpret_cast<RenderPDFPageToDCProc>( | 1946 RenderPDFPageToDCProc render_proc = reinterpret_cast<RenderPDFPageToDCProc>( |
1947 GetProcAddress(pdf_module, "RenderPDFPageToDC")); | 1947 GetProcAddress(pdf_module, "RenderPDFPageToDC")); |
1948 if (!render_proc) | 1948 if (!render_proc) |
1949 return false; | 1949 return false; |
1950 #endif // defined(OS_WIN) | 1950 #endif // defined(OS_WIN) |
1951 | 1951 |
1952 bool ret = false; | 1952 bool ret = false; |
1953 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 1953 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
1954 // On Linux we just set the final bits in the native metafile | |
1955 // (NativeMetafile and PreviewMetafile must have compatible formats, | |
1956 // i.e. both PDF for this to work). | |
1957 printing::Metafile* metafile = | 1954 printing::Metafile* metafile = |
1958 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); | 1955 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); |
1959 DCHECK(metafile != NULL); | 1956 DCHECK(metafile != NULL); |
1960 if (metafile) | 1957 if (metafile) |
1961 ret = metafile->InitFromData(mapper.data(), mapper.size()); | 1958 ret = metafile->InitFromData(mapper.data(), mapper.size()); |
1962 #elif defined(OS_WIN) | 1959 #elif defined(OS_WIN) |
1963 printing::Metafile* metafile = | 1960 printing::Metafile* metafile = |
1964 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); | 1961 printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); |
1965 if (metafile) { | 1962 if (metafile) { |
1966 // We only have a metafile when doing print preview, so we just want to | 1963 // We only have a metafile when doing print preview, so we just want to |
(...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3319 // Running out-of-process. Initiate an IPC call to notify the plugin | 3316 // Running out-of-process. Initiate an IPC call to notify the plugin |
3320 // process. | 3317 // process. |
3321 ppapi::proxy::HostDispatcher* dispatcher = | 3318 ppapi::proxy::HostDispatcher* dispatcher = |
3322 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3319 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3323 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3320 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3324 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3321 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3325 } | 3322 } |
3326 } | 3323 } |
3327 | 3324 |
3328 } // namespace content | 3325 } // namespace content |
OLD | NEW |