OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 printing::NativeMetafile* metafile = | 1089 printing::NativeMetafile* metafile = |
1090 printing::PdfPsMetafile::FromCairoContext(context); | 1090 printing::PdfPsMetafile::FromCairoContext(context); |
1091 DCHECK(metafile); | 1091 DCHECK(metafile); |
1092 if (metafile) | 1092 if (metafile) |
1093 ret = metafile->SetRawData(buffer->mapped_buffer(), buffer->size()); | 1093 ret = metafile->SetRawData(buffer->mapped_buffer(), buffer->size()); |
1094 canvas->endPlatformPaint(); | 1094 canvas->endPlatformPaint(); |
1095 #elif defined(OS_MACOSX) | 1095 #elif defined(OS_MACOSX) |
1096 scoped_ptr<printing::NativeMetafile> metafile( | 1096 scoped_ptr<printing::NativeMetafile> metafile( |
1097 printing::NativeMetafileFactory::CreateMetafile()); | 1097 printing::NativeMetafileFactory::CreateMetafile()); |
1098 // Create a PDF metafile and render from there into the passed in context. | 1098 // Create a PDF metafile and render from there into the passed in context. |
1099 if (metafile->Init(buffer->mapped_buffer(), buffer->size())) { | 1099 if (metafile->InitFromData(buffer->mapped_buffer(), buffer->size())) { |
1100 // Flip the transform. | 1100 // Flip the transform. |
1101 CGContextSaveGState(canvas); | 1101 CGContextSaveGState(canvas); |
1102 CGContextTranslateCTM(canvas, 0, | 1102 CGContextTranslateCTM(canvas, 0, |
1103 current_print_settings_.printable_area.size.height); | 1103 current_print_settings_.printable_area.size.height); |
1104 CGContextScaleCTM(canvas, 1.0, -1.0); | 1104 CGContextScaleCTM(canvas, 1.0, -1.0); |
1105 CGRect page_rect; | 1105 CGRect page_rect; |
1106 page_rect.origin.x = current_print_settings_.printable_area.point.x; | 1106 page_rect.origin.x = current_print_settings_.printable_area.point.x; |
1107 page_rect.origin.y = current_print_settings_.printable_area.point.y; | 1107 page_rect.origin.y = current_print_settings_.printable_area.point.y; |
1108 page_rect.size.width = current_print_settings_.printable_area.size.width; | 1108 page_rect.size.width = current_print_settings_.printable_area.size.width; |
1109 page_rect.size.height = current_print_settings_.printable_area.size.height; | 1109 page_rect.size.height = current_print_settings_.printable_area.size.height; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 return found->second; | 1355 return found->second; |
1356 } | 1356 } |
1357 | 1357 |
1358 bool PluginInstance::IsFullPagePlugin() const { | 1358 bool PluginInstance::IsFullPagePlugin() const { |
1359 WebFrame* frame = container()->element().document().frame(); | 1359 WebFrame* frame = container()->element().document().frame(); |
1360 return frame->view()->mainFrame()->document().isPluginDocument(); | 1360 return frame->view()->mainFrame()->document().isPluginDocument(); |
1361 } | 1361 } |
1362 | 1362 |
1363 } // namespace ppapi | 1363 } // namespace ppapi |
1364 } // namespace webkit | 1364 } // namespace webkit |
OLD | NEW |