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

Side by Side Diff: webkit/plugins/ppapi/plugin_instance.cc

Issue 5828003: Move the Pepper implementation from webkit/glue/plugins/pepper_* to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/glue/plugins/pepper_plugin_instance.h" 5 #include "webkit/plugins/ppapi/plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #if defined(OS_MACOSX)
10 #include "base/mac_util.h"
11 #include "base/mac/scoped_cftyperef.h"
12 #endif
13 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
14 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
15 #include "gfx/rect.h" 11 #include "gfx/rect.h"
16 #if defined(OS_WIN)
17 #include "gfx/codec/jpeg_codec.h"
18 #include "gfx/gdi_util.h"
19 #endif
20 #include "gfx/skia_util.h" 12 #include "gfx/skia_util.h"
21 #include "ppapi/c/dev/ppb_find_dev.h" 13 #include "ppapi/c/dev/ppb_find_dev.h"
22 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 14 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
23 #include "ppapi/c/dev/ppb_zoom_dev.h" 15 #include "ppapi/c/dev/ppb_zoom_dev.h"
24 #include "ppapi/c/dev/ppp_find_dev.h" 16 #include "ppapi/c/dev/ppp_find_dev.h"
25 #include "ppapi/c/dev/ppp_selection_dev.h" 17 #include "ppapi/c/dev/ppp_selection_dev.h"
26 #include "ppapi/c/dev/ppp_zoom_dev.h" 18 #include "ppapi/c/dev/ppp_zoom_dev.h"
27 #include "ppapi/c/pp_input_event.h" 19 #include "ppapi/c/pp_input_event.h"
28 #include "ppapi/c/pp_instance.h" 20 #include "ppapi/c/pp_instance.h"
29 #include "ppapi/c/pp_rect.h" 21 #include "ppapi/c/pp_rect.h"
(...skipping 10 matching lines...) Expand all
40 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" 32 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
41 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" 33 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h"
42 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h" 34 #include "third_party/WebKit/WebKit/chromium/public/WebElement.h"
43 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" 35 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
44 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" 36 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
45 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h" 37 #include "third_party/WebKit/WebKit/chromium/public/WebPluginContainer.h"
46 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" 38 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
47 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 39 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
48 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" 40 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
49 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" 41 #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
50 #include "webkit/glue/plugins/pepper_buffer.h" 42 #include "webkit/plugins/ppapi/common.h"
51 #include "webkit/glue/plugins/pepper_common.h" 43 #include "webkit/plugins/ppapi/event_conversion.h"
52 #include "webkit/glue/plugins/pepper_graphics_2d.h" 44 #include "webkit/plugins/ppapi/fullscreen_container.h"
53 #include "webkit/glue/plugins/pepper_graphics_3d.h" 45 #include "webkit/plugins/ppapi/plugin_delegate.h"
54 #include "webkit/glue/plugins/pepper_event_conversion.h" 46 #include "webkit/plugins/ppapi/plugin_module.h"
55 #include "webkit/glue/plugins/pepper_fullscreen_container.h" 47 #include "webkit/plugins/ppapi/ppb_buffer_impl.h"
56 #include "webkit/glue/plugins/pepper_image_data.h" 48 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h"
57 #include "webkit/glue/plugins/pepper_plugin_delegate.h" 49 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h"
58 #include "webkit/glue/plugins/pepper_plugin_module.h" 50 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
59 #include "webkit/glue/plugins/pepper_string.h" 51 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
60 #include "webkit/glue/plugins/pepper_url_loader.h" 52 #include "webkit/plugins/ppapi/ppp_pdf.h"
61 #include "webkit/glue/plugins/pepper_var.h" 53 #include "webkit/plugins/ppapi/string.h"
62 #include "webkit/glue/plugins/ppp_private.h" 54 #include "webkit/plugins/ppapi/var.h"
55
56 #if defined(OS_MACOSX)
57 #include "base/mac_util.h"
58 #include "base/mac/scoped_cftyperef.h"
59 #endif
60
61 #if defined(OS_WIN)
62 #include "gfx/codec/jpeg_codec.h"
63 #include "gfx/gdi_util.h"
64 #endif
63 65
64 using WebKit::WebBindings; 66 using WebKit::WebBindings;
65 using WebKit::WebCanvas; 67 using WebKit::WebCanvas;
66 using WebKit::WebCursorInfo; 68 using WebKit::WebCursorInfo;
67 using WebKit::WebDocument; 69 using WebKit::WebDocument;
68 using WebKit::WebFrame; 70 using WebKit::WebFrame;
69 using WebKit::WebInputEvent; 71 using WebKit::WebInputEvent;
70 using WebKit::WebPluginContainer; 72 using WebKit::WebPluginContainer;
71 using WebKit::WebString; 73 using WebKit::WebString;
72 using WebKit::WebURLRequest; 74 using WebKit::WebURLRequest;
73 using WebKit::WebView; 75 using WebKit::WebView;
74 76
75 namespace pepper { 77 namespace webkit {
78 namespace plugins {
79 namespace ppapi {
76 80
77 #if defined(OS_WIN) 81 #if defined(OS_WIN)
78 // Exported by pdf.dll 82 // Exported by pdf.dll
79 typedef bool (*RenderPDFPageToDCProc)( 83 typedef bool (*RenderPDFPageToDCProc)(
80 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, 84 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc,
81 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y, 85 int dpi_x, int dpi_y, int bounds_origin_x, int bounds_origin_y,
82 int bounds_width, int bounds_height, bool fit_to_bounds, 86 int bounds_width, int bounds_height, bool fit_to_bounds,
83 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds); 87 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds);
84 #endif // defined(OS_WIN) 88 #endif // defined(OS_WIN)
85 89
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 : delegate_(delegate), 295 : delegate_(delegate),
292 module_(module), 296 module_(module),
293 instance_interface_(instance_interface), 297 instance_interface_(instance_interface),
294 pp_instance_(0), 298 pp_instance_(0),
295 container_(NULL), 299 container_(NULL),
296 full_frame_(false), 300 full_frame_(false),
297 has_webkit_focus_(false), 301 has_webkit_focus_(false),
298 has_content_area_focus_(false), 302 has_content_area_focus_(false),
299 find_identifier_(-1), 303 find_identifier_(-1),
300 plugin_find_interface_(NULL), 304 plugin_find_interface_(NULL),
301 plugin_private_interface_(NULL), 305 plugin_pdf_interface_(NULL),
302 plugin_selection_interface_(NULL), 306 plugin_selection_interface_(NULL),
303 plugin_zoom_interface_(NULL), 307 plugin_zoom_interface_(NULL),
304 #if defined (OS_LINUX) 308 #if defined (OS_LINUX)
305 num_pages_(0), 309 num_pages_(0),
306 pdf_output_done_(false), 310 pdf_output_done_(false),
307 #endif // defined (OS_LINUX) 311 #endif // defined (OS_LINUX)
308 plugin_print_interface_(NULL), 312 plugin_print_interface_(NULL),
309 plugin_graphics_3d_interface_(NULL), 313 plugin_graphics_3d_interface_(NULL),
310 always_on_top_(false), 314 always_on_top_(false),
311 fullscreen_container_(NULL) { 315 fullscreen_container_(NULL) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } else if (bound_graphics_.get()) { 433 } else if (bound_graphics_.get()) {
430 bound_graphics_3d()->SetSwapBuffersCallback(NULL); 434 bound_graphics_3d()->SetSwapBuffersCallback(NULL);
431 bound_graphics_3d()->BindToInstance(NULL); 435 bound_graphics_3d()->BindToInstance(NULL);
432 } 436 }
433 InvalidateRect(gfx::Rect()); 437 InvalidateRect(gfx::Rect());
434 } 438 }
435 bound_graphics_ = NULL; 439 bound_graphics_ = NULL;
436 return true; 440 return true;
437 } 441 }
438 442
439 scoped_refptr<Graphics2D> graphics_2d = 443 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d =
440 Resource::GetAs<Graphics2D>(graphics_id); 444 Resource::GetAs<PPB_Graphics2D_Impl>(graphics_id);
441 scoped_refptr<Graphics3D> graphics_3d = 445 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d =
442 Resource::GetAs<Graphics3D>(graphics_id); 446 Resource::GetAs<PPB_Graphics3D_Impl>(graphics_id);
443 447
444 if (graphics_2d) { 448 if (graphics_2d) {
445 if (!graphics_2d->BindToInstance(this)) 449 if (!graphics_2d->BindToInstance(this))
446 return false; // Can't bind to more than one instance. 450 return false; // Can't bind to more than one instance.
447 451
448 // See http://crbug.com/49403: this can be further optimized by keeping the 452 // See http://crbug.com/49403: this can be further optimized by keeping the
449 // old device around and painting from it. 453 // old device around and painting from it.
450 if (bound_graphics_2d()) { 454 if (bound_graphics_2d()) {
451 // Start the new image with the content of the old image until the plugin 455 // Start the new image with the content of the old image until the plugin
452 // repaints. 456 // repaints.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 argv[argc] = arg_values[i].c_str(); 550 argv[argc] = arg_values[i].c_str();
547 argc++; 551 argc++;
548 } 552 }
549 553
550 return PPBoolToBool(instance_interface_->DidCreate(pp_instance(), 554 return PPBoolToBool(instance_interface_->DidCreate(pp_instance(),
551 argc, 555 argc,
552 argn.get(), 556 argn.get(),
553 argv.get())); 557 argv.get()));
554 } 558 }
555 559
556 bool PluginInstance::HandleDocumentLoad(URLLoader* loader) { 560 bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) {
557 Resource::ScopedResourceId resource(loader); 561 Resource::ScopedResourceId resource(loader);
558 return PPBoolToBool(instance_interface_->HandleDocumentLoad(pp_instance(), 562 return PPBoolToBool(instance_interface_->HandleDocumentLoad(pp_instance(),
559 resource.id)); 563 resource.id));
560 } 564 }
561 565
562 bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, 566 bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
563 WebCursorInfo* cursor_info) { 567 WebCursorInfo* cursor_info) {
564 std::vector<PP_InputEvent> pp_events; 568 std::vector<PP_InputEvent> pp_events;
565 CreatePPEvent(event, &pp_events); 569 CreatePPEvent(event, &pp_events);
566 570
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 gfx::Rect* location, 653 gfx::Rect* location,
650 gfx::Rect* clip) { 654 gfx::Rect* clip) {
651 if (!always_on_top_) 655 if (!always_on_top_)
652 return false; 656 return false;
653 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque()) 657 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque())
654 return false; 658 return false;
655 659
656 // We specifically want to compare against the area covered by the backing 660 // We specifically want to compare against the area covered by the backing
657 // store when seeing if we cover the given paint bounds, since the backing 661 // store when seeing if we cover the given paint bounds, since the backing
658 // store could be smaller than the declared plugin area. 662 // store could be smaller than the declared plugin area.
659 ImageData* image_data = bound_graphics_2d()->image_data(); 663 PPB_ImageData_Impl* image_data = bound_graphics_2d()->image_data();
660 gfx::Rect plugin_backing_store_rect(position_.origin(), 664 gfx::Rect plugin_backing_store_rect(position_.origin(),
661 gfx::Size(image_data->width(), 665 gfx::Size(image_data->width(),
662 image_data->height())); 666 image_data->height()));
663 gfx::Rect clip_page(clip_); 667 gfx::Rect clip_page(clip_);
664 clip_page.Offset(position_.origin()); 668 clip_page.Offset(position_.origin());
665 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); 669 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page);
666 if (!plugin_paint_rect.Contains(paint_bounds)) 670 if (!plugin_paint_rect.Contains(paint_bounds))
667 return false; 671 return false;
668 672
669 *dib = image_data->platform_image()->GetTransportDIB(); 673 *dib = image_data->platform_image()->GetTransportDIB();
670 *location = plugin_backing_store_rect; 674 *location = plugin_backing_store_rect;
671 *clip = clip_page; 675 *clip = clip_page;
672 return true; 676 return true;
673 } 677 }
674 678
675 string16 PluginInstance::GetSelectedText(bool html) { 679 string16 PluginInstance::GetSelectedText(bool html) {
676 if (!LoadSelectionInterface()) 680 if (!LoadSelectionInterface())
677 return string16(); 681 return string16();
678 682
679 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), 683 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(),
680 BoolToPPBool(html)); 684 BoolToPPBool(html));
681 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); 685 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv));
682 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. 686 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us.
683 if (!string) 687 if (!string)
684 return string16(); 688 return string16();
685 return UTF8ToUTF16(string->value()); 689 return UTF8ToUTF16(string->value());
686 } 690 }
687 691
688 string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { 692 string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) {
689 if (!LoadPrivateInterface()) 693 if (!LoadPdfInterface())
690 return string16(); 694 return string16();
691 695
692 PP_Point p; 696 PP_Point p;
693 p.x = point.x(); 697 p.x = point.x();
694 p.y = point.y(); 698 p.y = point.y();
695 PP_Var rv = plugin_private_interface_->GetLinkAtPosition(pp_instance(), p); 699 PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p);
696 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); 700 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv));
697 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. 701 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us.
698 if (!string) 702 if (!string)
699 return string16(); 703 return string16();
700 return UTF8ToUTF16(string->value()); 704 return UTF8ToUTF16(string->value());
701 } 705 }
702 706
703 void PluginInstance::Zoom(double factor, bool text_only) { 707 void PluginInstance::Zoom(double factor, bool text_only) {
704 if (!LoadZoomInterface()) 708 if (!LoadZoomInterface())
705 return; 709 return;
(...skipping 29 matching lines...) Expand all
735 bool PluginInstance::LoadFindInterface() { 739 bool PluginInstance::LoadFindInterface() {
736 if (!plugin_find_interface_) { 740 if (!plugin_find_interface_) {
737 plugin_find_interface_ = 741 plugin_find_interface_ =
738 reinterpret_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( 742 reinterpret_cast<const PPP_Find_Dev*>(module_->GetPluginInterface(
739 PPP_FIND_DEV_INTERFACE)); 743 PPP_FIND_DEV_INTERFACE));
740 } 744 }
741 745
742 return !!plugin_find_interface_; 746 return !!plugin_find_interface_;
743 } 747 }
744 748
745 bool PluginInstance::LoadPrivateInterface() { 749 bool PluginInstance::LoadPdfInterface() {
746 if (!plugin_private_interface_) { 750 if (!plugin_pdf_interface_) {
747 plugin_private_interface_ = 751 plugin_pdf_interface_ =
748 reinterpret_cast<const PPP_Private*>(module_->GetPluginInterface( 752 reinterpret_cast<const PPP_Pdf*>(module_->GetPluginInterface(
749 PPP_PRIVATE_INTERFACE)); 753 PPP_PDF_INTERFACE));
750 } 754 }
751 755
752 return !!plugin_private_interface_; 756 return !!plugin_pdf_interface_;
753 } 757 }
754 758
755 bool PluginInstance::LoadSelectionInterface() { 759 bool PluginInstance::LoadSelectionInterface() {
756 if (!plugin_selection_interface_) { 760 if (!plugin_selection_interface_) {
757 plugin_selection_interface_ = 761 plugin_selection_interface_ =
758 reinterpret_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface( 762 reinterpret_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface(
759 PPP_SELECTION_DEV_INTERFACE)); 763 PPP_SELECTION_DEV_INTERFACE));
760 } 764 }
761 765
762 return !!plugin_selection_interface_; 766 return !!plugin_selection_interface_;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 request.setHTTPMethod(WebString::fromUTF8("GET")); 936 request.setHTTPMethod(WebString::fromUTF8("GET"));
933 request.setFirstPartyForCookies(document.firstPartyForCookies()); 937 request.setFirstPartyForCookies(document.firstPartyForCookies());
934 938
935 WebString target_str = WebString::fromUTF8(target); 939 WebString target_str = WebString::fromUTF8(target);
936 container_->loadFrameRequest(request, target_str, false, NULL); 940 container_->loadFrameRequest(request, target_str, false, NULL);
937 return true; 941 return true;
938 } 942 }
939 943
940 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, 944 bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
941 WebKit::WebCanvas* canvas) { 945 WebKit::WebCanvas* canvas) {
942 scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(print_output)); 946 scoped_refptr<PPB_Buffer_Impl> buffer(
947 Resource::GetAs<PPB_Buffer_Impl>(print_output));
943 if (!buffer.get() || !buffer->is_mapped() || !buffer->size()) { 948 if (!buffer.get() || !buffer->is_mapped() || !buffer->size()) {
944 NOTREACHED(); 949 NOTREACHED();
945 return false; 950 return false;
946 } 951 }
947 #if defined(OS_WIN) 952 #if defined(OS_WIN)
948 // For Windows, we need the PDF DLL to render the output PDF to a DC. 953 // For Windows, we need the PDF DLL to render the output PDF to a DC.
949 HMODULE pdf_module = GetModuleHandle(L"pdf.dll"); 954 HMODULE pdf_module = GetModuleHandle(L"pdf.dll");
950 if (!pdf_module) 955 if (!pdf_module)
951 return false; 956 return false;
952 RenderPDFPageToDCProc render_proc = 957 RenderPDFPageToDCProc render_proc =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 current_print_settings_.dpi, current_print_settings_.dpi, 1021 current_print_settings_.dpi, current_print_settings_.dpi,
1017 0, 0, size_in_pixels.width(), 1022 0, 0, size_in_pixels.width(),
1018 size_in_pixels.height(), true, false, true, true); 1023 size_in_pixels.height(), true, false, true, true);
1019 #endif // defined(OS_WIN) 1024 #endif // defined(OS_WIN)
1020 1025
1021 return ret; 1026 return ret;
1022 } 1027 }
1023 1028
1024 bool PluginInstance::PrintRasterOutput(PP_Resource print_output, 1029 bool PluginInstance::PrintRasterOutput(PP_Resource print_output,
1025 WebKit::WebCanvas* canvas) { 1030 WebKit::WebCanvas* canvas) {
1026 scoped_refptr<ImageData> image(Resource::GetAs<ImageData>(print_output)); 1031 scoped_refptr<PPB_ImageData_Impl> image(
1032 Resource::GetAs<PPB_ImageData_Impl>(print_output));
1027 if (!image.get() || !image->is_mapped()) 1033 if (!image.get() || !image->is_mapped())
1028 return false; 1034 return false;
1029 1035
1030 const SkBitmap* bitmap = image->GetMappedBitmap(); 1036 const SkBitmap* bitmap = image->GetMappedBitmap();
1031 if (!bitmap) 1037 if (!bitmap)
1032 return false; 1038 return false;
1033 1039
1034 // Draw the printed image into the supplied canvas. 1040 // Draw the printed image into the supplied canvas.
1035 SkIRect src_rect; 1041 SkIRect src_rect;
1036 src_rect.set(0, 0, bitmap->width(), bitmap->height()); 1042 src_rect.set(0, 0, bitmap->width(), bitmap->height());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 bounds.origin.x = dest_rect.x(); 1161 bounds.origin.x = dest_rect.x();
1156 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height(); 1162 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height();
1157 bounds.size.width = dest_rect.width(); 1163 bounds.size.width = dest_rect.width();
1158 bounds.size.height = dest_rect.height(); 1164 bounds.size.height = dest_rect.height();
1159 1165
1160 CGContextDrawImage(canvas, bounds, image); 1166 CGContextDrawImage(canvas, bounds, image);
1161 CGContextRestoreGState(canvas); 1167 CGContextRestoreGState(canvas);
1162 } 1168 }
1163 #endif // defined(OS_MACOSX) 1169 #endif // defined(OS_MACOSX)
1164 1170
1165 Graphics2D* PluginInstance::bound_graphics_2d() const { 1171 PPB_Graphics2D_Impl* PluginInstance::bound_graphics_2d() const {
1166 if (bound_graphics_.get() == NULL) 1172 if (bound_graphics_.get() == NULL)
1167 return NULL; 1173 return NULL;
1168 1174
1169 return bound_graphics_->Cast<Graphics2D>(); 1175 return bound_graphics_->Cast<PPB_Graphics2D_Impl>();
1170 } 1176 }
1171 1177
1172 Graphics3D* PluginInstance::bound_graphics_3d() const { 1178 PPB_Graphics3D_Impl* PluginInstance::bound_graphics_3d() const {
1173 if (bound_graphics_.get() == NULL) 1179 if (bound_graphics_.get() == NULL)
1174 return NULL; 1180 return NULL;
1175 1181
1176 return bound_graphics_->Cast<Graphics3D>(); 1182 return bound_graphics_->Cast<PPB_Graphics3D_Impl>();
1177 } 1183 }
1178 1184
1179 } // namespace pepper 1185 } // namespace ppapi
1186 } // namespace plugins
1187 } // namespace webkit
1188
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698