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