OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <atlbase.h> | 10 #include <atlbase.h> |
11 #endif | 11 #endif |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 using WebKit::WebDragData; | 56 using WebKit::WebDragData; |
57 using WebKit::WebVector; | 57 using WebKit::WebVector; |
58 using WebKit::WebString; | 58 using WebKit::WebString; |
59 | 59 |
60 // Proxy for WebPluginResourceClient. The object owns itself after creation, | 60 // Proxy for WebPluginResourceClient. The object owns itself after creation, |
61 // deleting itself after its callback has been called. | 61 // deleting itself after its callback has been called. |
62 class ResourceClientProxy : public WebPluginResourceClient { | 62 class ResourceClientProxy : public WebPluginResourceClient { |
63 public: | 63 public: |
64 ResourceClientProxy(PluginChannelHost* channel, int instance_id) | 64 ResourceClientProxy(PluginChannelHost* channel, int instance_id) |
65 : channel_(channel), instance_id_(instance_id), resource_id_(0), | 65 : channel_(channel), instance_id_(instance_id), resource_id_(0), |
66 notify_needed_(false), notify_data_(0), | 66 notify_needed_(false), notify_data_(NULL), |
67 multibyte_response_expected_(false) { | 67 multibyte_response_expected_(false) { |
68 } | 68 } |
69 | 69 |
70 ~ResourceClientProxy() { | 70 ~ResourceClientProxy() { |
71 } | 71 } |
72 | 72 |
73 void Initialize(int resource_id, const GURL& url, bool notify_needed, | 73 void Initialize(int resource_id, const GURL& url, bool notify_needed, |
74 intptr_t notify_data, intptr_t existing_stream) { | 74 intptr_t notify_data, intptr_t existing_stream) { |
75 resource_id_ = resource_id; | 75 resource_id_ = resource_id; |
76 url_ = url; | 76 url_ = url; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 RenderView* render_view) { | 165 RenderView* render_view) { |
166 return new WebPluginDelegateProxy(mime_type, clsid, render_view); | 166 return new WebPluginDelegateProxy(mime_type, clsid, render_view); |
167 } | 167 } |
168 | 168 |
169 WebPluginDelegateProxy::WebPluginDelegateProxy(const std::string& mime_type, | 169 WebPluginDelegateProxy::WebPluginDelegateProxy(const std::string& mime_type, |
170 const std::string& clsid, | 170 const std::string& clsid, |
171 RenderView* render_view) | 171 RenderView* render_view) |
172 : render_view_(render_view), | 172 : render_view_(render_view), |
173 plugin_(NULL), | 173 plugin_(NULL), |
174 windowless_(false), | 174 windowless_(false), |
175 window_(0), | 175 window_(NULL), |
176 mime_type_(mime_type), | 176 mime_type_(mime_type), |
177 clsid_(clsid), | 177 clsid_(clsid), |
178 npobject_(NULL), | 178 npobject_(NULL), |
179 window_script_object_(NULL), | 179 window_script_object_(NULL), |
180 sad_plugin_(NULL), | 180 sad_plugin_(NULL), |
181 invalidate_pending_(false), | 181 invalidate_pending_(false), |
182 transparent_(false), | 182 transparent_(false), |
183 page_url_(render_view_->webview()->GetMainFrame()->url()) { | 183 page_url_(render_view_->webview()->GetMainFrame()->url()) { |
184 } | 184 } |
185 | 185 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 CGBitmapContextGetData(bg_context)); | 659 CGBitmapContextGetData(bg_context)); |
660 int full_bg_width = CGBitmapContextGetWidth(bg_context); | 660 int full_bg_width = CGBitmapContextGetWidth(bg_context); |
661 int full_bg_height = CGBitmapContextGetHeight(bg_context); | 661 int full_bg_height = CGBitmapContextGetHeight(bg_context); |
662 int bg_stride = CGBitmapContextGetBytesPerRow(bg_context); | 662 int bg_stride = CGBitmapContextGetBytesPerRow(bg_context); |
663 int bg_last_row = CGBitmapContextGetHeight(bg_context) - 1; | 663 int bg_last_row = CGBitmapContextGetHeight(bg_context) - 1; |
664 | 664 |
665 int bytes_per_pixel = CGBitmapContextGetBitsPerPixel(context) / 8; | 665 int bytes_per_pixel = CGBitmapContextGetBitsPerPixel(context) / 8; |
666 #else | 666 #else |
667 const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface); | 667 const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface); |
668 int page_stride = cairo_image_surface_get_stride(page_surface); | 668 int page_stride = cairo_image_surface_get_stride(page_surface); |
669 int page_start_x = static_cast<int>(page_x_double); | 669 int page_start_x = page_x_double; |
670 int page_start_y = static_cast<int>(page_y_double); | 670 int page_start_y = page_y_double; |
671 | 671 |
672 skia::PlatformDevice& device = | 672 skia::PlatformDevice& device = |
673 background_store_canvas_->getTopPlatformDevice(); | 673 background_store_canvas_->getTopPlatformDevice(); |
674 cairo_surface_t* bg_surface = cairo_get_target(device.beginPlatformPaint()); | 674 cairo_surface_t* bg_surface = cairo_get_target(device.beginPlatformPaint()); |
675 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE); | 675 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE); |
676 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32); | 676 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32); |
677 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface); | 677 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface); |
678 int full_bg_width = cairo_image_surface_get_width(bg_surface); | 678 int full_bg_width = cairo_image_surface_get_width(bg_surface); |
679 int full_bg_height = cairo_image_surface_get_height(bg_surface); | 679 int full_bg_height = cairo_image_surface_get_height(bg_surface); |
680 int bg_stride = cairo_image_surface_get_stride(bg_surface); | 680 int bg_stride = cairo_image_surface_get_stride(bg_surface); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { | 790 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { |
791 windowless_ = !window; | 791 windowless_ = !window; |
792 window_ = window; | 792 window_ = window; |
793 if (plugin_) | 793 if (plugin_) |
794 plugin_->SetWindow(window); | 794 plugin_->SetWindow(window); |
795 } | 795 } |
796 | 796 |
797 void WebPluginDelegateProxy::WillDestroyWindow() { | 797 void WebPluginDelegateProxy::WillDestroyWindow() { |
798 DCHECK(window_); | 798 DCHECK(window_); |
799 plugin_->WillDestroyWindow(window_); | 799 plugin_->WillDestroyWindow(window_); |
800 window_ = 0; | 800 window_ = NULL; |
801 } | 801 } |
802 | 802 |
803 #if defined(OS_WIN) | 803 #if defined(OS_WIN) |
804 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( | 804 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( |
805 HANDLE modal_loop_pump_messages_event) { | 805 HANDLE modal_loop_pump_messages_event) { |
806 DCHECK(modal_loop_pump_messages_event_ == NULL); | 806 DCHECK(modal_loop_pump_messages_event_ == NULL); |
807 | 807 |
808 modal_loop_pump_messages_event_.reset( | 808 modal_loop_pump_messages_event_.reset( |
809 new base::WaitableEvent(modal_loop_pump_messages_event)); | 809 new base::WaitableEvent(modal_loop_pump_messages_event)); |
810 } | 810 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { | 1067 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { |
1068 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), | 1068 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), |
1069 existing_stream, notify_needed, | 1069 existing_stream, notify_needed, |
1070 notify_data); | 1070 notify_data); |
1071 } | 1071 } |
1072 | 1072 |
1073 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, | 1073 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, |
1074 bool defer) { | 1074 bool defer) { |
1075 plugin_->SetDeferResourceLoading(resource_id, defer); | 1075 plugin_->SetDeferResourceLoading(resource_id, defer); |
1076 } | 1076 } |
OLD | NEW |