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

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
« no previous file with comments | « webkit/plugins/ppapi/plugin_instance.h ('k') | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ppapi {
76 79
77 #if defined(OS_WIN) 80 #if defined(OS_WIN)
78 // Exported by pdf.dll 81 // Exported by pdf.dll
79 typedef bool (*RenderPDFPageToDCProc)( 82 typedef bool (*RenderPDFPageToDCProc)(
80 const unsigned char* pdf_buffer, int buffer_size, int page_number, HDC dc, 83 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, 84 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, 85 int bounds_width, int bounds_height, bool fit_to_bounds,
83 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds); 86 bool stretch_to_bounds, bool keep_aspect_ratio, bool center_in_bounds);
84 #endif // defined(OS_WIN) 87 #endif // defined(OS_WIN)
85 88
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 : delegate_(delegate), 294 : delegate_(delegate),
292 module_(module), 295 module_(module),
293 instance_interface_(instance_interface), 296 instance_interface_(instance_interface),
294 pp_instance_(0), 297 pp_instance_(0),
295 container_(NULL), 298 container_(NULL),
296 full_frame_(false), 299 full_frame_(false),
297 has_webkit_focus_(false), 300 has_webkit_focus_(false),
298 has_content_area_focus_(false), 301 has_content_area_focus_(false),
299 find_identifier_(-1), 302 find_identifier_(-1),
300 plugin_find_interface_(NULL), 303 plugin_find_interface_(NULL),
301 plugin_private_interface_(NULL), 304 plugin_pdf_interface_(NULL),
302 plugin_selection_interface_(NULL), 305 plugin_selection_interface_(NULL),
303 plugin_zoom_interface_(NULL), 306 plugin_zoom_interface_(NULL),
304 #if defined (OS_LINUX) 307 #if defined (OS_LINUX)
305 num_pages_(0), 308 num_pages_(0),
306 pdf_output_done_(false), 309 pdf_output_done_(false),
307 #endif // defined (OS_LINUX) 310 #endif // defined (OS_LINUX)
308 plugin_print_interface_(NULL), 311 plugin_print_interface_(NULL),
309 plugin_graphics_3d_interface_(NULL), 312 plugin_graphics_3d_interface_(NULL),
310 always_on_top_(false), 313 always_on_top_(false),
311 fullscreen_container_(NULL) { 314 fullscreen_container_(NULL) {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 } else if (bound_graphics_.get()) { 432 } else if (bound_graphics_.get()) {
430 bound_graphics_3d()->SetSwapBuffersCallback(NULL); 433 bound_graphics_3d()->SetSwapBuffersCallback(NULL);
431 bound_graphics_3d()->BindToInstance(NULL); 434 bound_graphics_3d()->BindToInstance(NULL);
432 } 435 }
433 InvalidateRect(gfx::Rect()); 436 InvalidateRect(gfx::Rect());
434 } 437 }
435 bound_graphics_ = NULL; 438 bound_graphics_ = NULL;
436 return true; 439 return true;
437 } 440 }
438 441
439 scoped_refptr<Graphics2D> graphics_2d = 442 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d =
440 Resource::GetAs<Graphics2D>(graphics_id); 443 Resource::GetAs<PPB_Graphics2D_Impl>(graphics_id);
441 scoped_refptr<Graphics3D> graphics_3d = 444 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d =
442 Resource::GetAs<Graphics3D>(graphics_id); 445 Resource::GetAs<PPB_Graphics3D_Impl>(graphics_id);
443 446
444 if (graphics_2d) { 447 if (graphics_2d) {
445 if (!graphics_2d->BindToInstance(this)) 448 if (!graphics_2d->BindToInstance(this))
446 return false; // Can't bind to more than one instance. 449 return false; // Can't bind to more than one instance.
447 450
448 // See http://crbug.com/49403: this can be further optimized by keeping the 451 // See http://crbug.com/49403: this can be further optimized by keeping the
449 // old device around and painting from it. 452 // old device around and painting from it.
450 if (bound_graphics_2d()) { 453 if (bound_graphics_2d()) {
451 // Start the new image with the content of the old image until the plugin 454 // Start the new image with the content of the old image until the plugin
452 // repaints. 455 // repaints.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 argv[argc] = arg_values[i].c_str(); 549 argv[argc] = arg_values[i].c_str();
547 argc++; 550 argc++;
548 } 551 }
549 552
550 return PPBoolToBool(instance_interface_->DidCreate(pp_instance(), 553 return PPBoolToBool(instance_interface_->DidCreate(pp_instance(),
551 argc, 554 argc,
552 argn.get(), 555 argn.get(),
553 argv.get())); 556 argv.get()));
554 } 557 }
555 558
556 bool PluginInstance::HandleDocumentLoad(URLLoader* loader) { 559 bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) {
557 Resource::ScopedResourceId resource(loader); 560 Resource::ScopedResourceId resource(loader);
558 return PPBoolToBool(instance_interface_->HandleDocumentLoad(pp_instance(), 561 return PPBoolToBool(instance_interface_->HandleDocumentLoad(pp_instance(),
559 resource.id)); 562 resource.id));
560 } 563 }
561 564
562 bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event, 565 bool PluginInstance::HandleInputEvent(const WebKit::WebInputEvent& event,
563 WebCursorInfo* cursor_info) { 566 WebCursorInfo* cursor_info) {
564 std::vector<PP_InputEvent> pp_events; 567 std::vector<PP_InputEvent> pp_events;
565 CreatePPEvent(event, &pp_events); 568 CreatePPEvent(event, &pp_events);
566 569
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 gfx::Rect* location, 652 gfx::Rect* location,
650 gfx::Rect* clip) { 653 gfx::Rect* clip) {
651 if (!always_on_top_) 654 if (!always_on_top_)
652 return false; 655 return false;
653 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque()) 656 if (!bound_graphics_2d() || !bound_graphics_2d()->is_always_opaque())
654 return false; 657 return false;
655 658
656 // We specifically want to compare against the area covered by the backing 659 // 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 660 // store when seeing if we cover the given paint bounds, since the backing
658 // store could be smaller than the declared plugin area. 661 // store could be smaller than the declared plugin area.
659 ImageData* image_data = bound_graphics_2d()->image_data(); 662 PPB_ImageData_Impl* image_data = bound_graphics_2d()->image_data();
660 gfx::Rect plugin_backing_store_rect(position_.origin(), 663 gfx::Rect plugin_backing_store_rect(position_.origin(),
661 gfx::Size(image_data->width(), 664 gfx::Size(image_data->width(),
662 image_data->height())); 665 image_data->height()));
663 gfx::Rect clip_page(clip_); 666 gfx::Rect clip_page(clip_);
664 clip_page.Offset(position_.origin()); 667 clip_page.Offset(position_.origin());
665 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page); 668 gfx::Rect plugin_paint_rect = plugin_backing_store_rect.Intersect(clip_page);
666 if (!plugin_paint_rect.Contains(paint_bounds)) 669 if (!plugin_paint_rect.Contains(paint_bounds))
667 return false; 670 return false;
668 671
669 *dib = image_data->platform_image()->GetTransportDIB(); 672 *dib = image_data->platform_image()->GetTransportDIB();
670 *location = plugin_backing_store_rect; 673 *location = plugin_backing_store_rect;
671 *clip = clip_page; 674 *clip = clip_page;
672 return true; 675 return true;
673 } 676 }
674 677
675 string16 PluginInstance::GetSelectedText(bool html) { 678 string16 PluginInstance::GetSelectedText(bool html) {
676 if (!LoadSelectionInterface()) 679 if (!LoadSelectionInterface())
677 return string16(); 680 return string16();
678 681
679 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(), 682 PP_Var rv = plugin_selection_interface_->GetSelectedText(pp_instance(),
680 BoolToPPBool(html)); 683 BoolToPPBool(html));
681 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); 684 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv));
682 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. 685 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us.
683 if (!string) 686 if (!string)
684 return string16(); 687 return string16();
685 return UTF8ToUTF16(string->value()); 688 return UTF8ToUTF16(string->value());
686 } 689 }
687 690
688 string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) { 691 string16 PluginInstance::GetLinkAtPosition(const gfx::Point& point) {
689 if (!LoadPrivateInterface()) 692 if (!LoadPdfInterface())
690 return string16(); 693 return string16();
691 694
692 PP_Point p; 695 PP_Point p;
693 p.x = point.x(); 696 p.x = point.x();
694 p.y = point.y(); 697 p.y = point.y();
695 PP_Var rv = plugin_private_interface_->GetLinkAtPosition(pp_instance(), p); 698 PP_Var rv = plugin_pdf_interface_->GetLinkAtPosition(pp_instance(), p);
696 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv)); 699 scoped_refptr<StringVar> string(StringVar::FromPPVar(rv));
697 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us. 700 Var::PluginReleasePPVar(rv); // Release the ref the plugin transfered to us.
698 if (!string) 701 if (!string)
699 return string16(); 702 return string16();
700 return UTF8ToUTF16(string->value()); 703 return UTF8ToUTF16(string->value());
701 } 704 }
702 705
703 void PluginInstance::Zoom(double factor, bool text_only) { 706 void PluginInstance::Zoom(double factor, bool text_only) {
704 if (!LoadZoomInterface()) 707 if (!LoadZoomInterface())
705 return; 708 return;
(...skipping 29 matching lines...) Expand all
735 bool PluginInstance::LoadFindInterface() { 738 bool PluginInstance::LoadFindInterface() {
736 if (!plugin_find_interface_) { 739 if (!plugin_find_interface_) {
737 plugin_find_interface_ = 740 plugin_find_interface_ =
738 reinterpret_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( 741 reinterpret_cast<const PPP_Find_Dev*>(module_->GetPluginInterface(
739 PPP_FIND_DEV_INTERFACE)); 742 PPP_FIND_DEV_INTERFACE));
740 } 743 }
741 744
742 return !!plugin_find_interface_; 745 return !!plugin_find_interface_;
743 } 746 }
744 747
745 bool PluginInstance::LoadPrivateInterface() { 748 bool PluginInstance::LoadPdfInterface() {
746 if (!plugin_private_interface_) { 749 if (!plugin_pdf_interface_) {
747 plugin_private_interface_ = 750 plugin_pdf_interface_ =
748 reinterpret_cast<const PPP_Private*>(module_->GetPluginInterface( 751 reinterpret_cast<const PPP_Pdf*>(module_->GetPluginInterface(
749 PPP_PRIVATE_INTERFACE)); 752 PPP_PDF_INTERFACE));
750 } 753 }
751 754
752 return !!plugin_private_interface_; 755 return !!plugin_pdf_interface_;
753 } 756 }
754 757
755 bool PluginInstance::LoadSelectionInterface() { 758 bool PluginInstance::LoadSelectionInterface() {
756 if (!plugin_selection_interface_) { 759 if (!plugin_selection_interface_) {
757 plugin_selection_interface_ = 760 plugin_selection_interface_ =
758 reinterpret_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface( 761 reinterpret_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface(
759 PPP_SELECTION_DEV_INTERFACE)); 762 PPP_SELECTION_DEV_INTERFACE));
760 } 763 }
761 764
762 return !!plugin_selection_interface_; 765 return !!plugin_selection_interface_;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 request.setHTTPMethod(WebString::fromUTF8("GET")); 935 request.setHTTPMethod(WebString::fromUTF8("GET"));
933 request.setFirstPartyForCookies(document.firstPartyForCookies()); 936 request.setFirstPartyForCookies(document.firstPartyForCookies());
934 937
935 WebString target_str = WebString::fromUTF8(target); 938 WebString target_str = WebString::fromUTF8(target);
936 container_->loadFrameRequest(request, target_str, false, NULL); 939 container_->loadFrameRequest(request, target_str, false, NULL);
937 return true; 940 return true;
938 } 941 }
939 942
940 bool PluginInstance::PrintPDFOutput(PP_Resource print_output, 943 bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
941 WebKit::WebCanvas* canvas) { 944 WebKit::WebCanvas* canvas) {
942 scoped_refptr<Buffer> buffer(Resource::GetAs<Buffer>(print_output)); 945 scoped_refptr<PPB_Buffer_Impl> buffer(
946 Resource::GetAs<PPB_Buffer_Impl>(print_output));
943 if (!buffer.get() || !buffer->is_mapped() || !buffer->size()) { 947 if (!buffer.get() || !buffer->is_mapped() || !buffer->size()) {
944 NOTREACHED(); 948 NOTREACHED();
945 return false; 949 return false;
946 } 950 }
947 #if defined(OS_WIN) 951 #if defined(OS_WIN)
948 // For Windows, we need the PDF DLL to render the output PDF to a DC. 952 // For Windows, we need the PDF DLL to render the output PDF to a DC.
949 HMODULE pdf_module = GetModuleHandle(L"pdf.dll"); 953 HMODULE pdf_module = GetModuleHandle(L"pdf.dll");
950 if (!pdf_module) 954 if (!pdf_module)
951 return false; 955 return false;
952 RenderPDFPageToDCProc render_proc = 956 RenderPDFPageToDCProc render_proc =
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 current_print_settings_.dpi, current_print_settings_.dpi, 1020 current_print_settings_.dpi, current_print_settings_.dpi,
1017 0, 0, size_in_pixels.width(), 1021 0, 0, size_in_pixels.width(),
1018 size_in_pixels.height(), true, false, true, true); 1022 size_in_pixels.height(), true, false, true, true);
1019 #endif // defined(OS_WIN) 1023 #endif // defined(OS_WIN)
1020 1024
1021 return ret; 1025 return ret;
1022 } 1026 }
1023 1027
1024 bool PluginInstance::PrintRasterOutput(PP_Resource print_output, 1028 bool PluginInstance::PrintRasterOutput(PP_Resource print_output,
1025 WebKit::WebCanvas* canvas) { 1029 WebKit::WebCanvas* canvas) {
1026 scoped_refptr<ImageData> image(Resource::GetAs<ImageData>(print_output)); 1030 scoped_refptr<PPB_ImageData_Impl> image(
1031 Resource::GetAs<PPB_ImageData_Impl>(print_output));
1027 if (!image.get() || !image->is_mapped()) 1032 if (!image.get() || !image->is_mapped())
1028 return false; 1033 return false;
1029 1034
1030 const SkBitmap* bitmap = image->GetMappedBitmap(); 1035 const SkBitmap* bitmap = image->GetMappedBitmap();
1031 if (!bitmap) 1036 if (!bitmap)
1032 return false; 1037 return false;
1033 1038
1034 // Draw the printed image into the supplied canvas. 1039 // Draw the printed image into the supplied canvas.
1035 SkIRect src_rect; 1040 SkIRect src_rect;
1036 src_rect.set(0, 0, bitmap->width(), bitmap->height()); 1041 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(); 1160 bounds.origin.x = dest_rect.x();
1156 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height(); 1161 bounds.origin.y = canvas_height - dest_rect.y() - dest_rect.height();
1157 bounds.size.width = dest_rect.width(); 1162 bounds.size.width = dest_rect.width();
1158 bounds.size.height = dest_rect.height(); 1163 bounds.size.height = dest_rect.height();
1159 1164
1160 CGContextDrawImage(canvas, bounds, image); 1165 CGContextDrawImage(canvas, bounds, image);
1161 CGContextRestoreGState(canvas); 1166 CGContextRestoreGState(canvas);
1162 } 1167 }
1163 #endif // defined(OS_MACOSX) 1168 #endif // defined(OS_MACOSX)
1164 1169
1165 Graphics2D* PluginInstance::bound_graphics_2d() const { 1170 PPB_Graphics2D_Impl* PluginInstance::bound_graphics_2d() const {
1166 if (bound_graphics_.get() == NULL) 1171 if (bound_graphics_.get() == NULL)
1167 return NULL; 1172 return NULL;
1168 1173
1169 return bound_graphics_->Cast<Graphics2D>(); 1174 return bound_graphics_->Cast<PPB_Graphics2D_Impl>();
1170 } 1175 }
1171 1176
1172 Graphics3D* PluginInstance::bound_graphics_3d() const { 1177 PPB_Graphics3D_Impl* PluginInstance::bound_graphics_3d() const {
1173 if (bound_graphics_.get() == NULL) 1178 if (bound_graphics_.get() == NULL)
1174 return NULL; 1179 return NULL;
1175 1180
1176 return bound_graphics_->Cast<Graphics3D>(); 1181 return bound_graphics_->Cast<PPB_Graphics3D_Impl>();
1177 } 1182 }
1178 1183
1179 } // namespace pepper 1184 } // namespace ppapi
1185 } // namespace webkit
1186
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_instance.h ('k') | webkit/plugins/ppapi/plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698