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

Side by Side Diff: chrome/renderer/webplugin_delegate_proxy.cc

Issue 195067: Turn NULL used as int to 0.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 2 months 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 | « chrome/renderer/render_widget.cc ('k') | chrome/test/render_view_test.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "app/gfx/blit.h" 9 #include "app/gfx/blit.h"
10 #include "app/gfx/canvas.h" 10 #include "app/gfx/canvas.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 using WebKit::WebDragData; 53 using WebKit::WebDragData;
54 using WebKit::WebVector; 54 using WebKit::WebVector;
55 using WebKit::WebString; 55 using WebKit::WebString;
56 56
57 // Proxy for WebPluginResourceClient. The object owns itself after creation, 57 // Proxy for WebPluginResourceClient. The object owns itself after creation,
58 // deleting itself after its callback has been called. 58 // deleting itself after its callback has been called.
59 class ResourceClientProxy : public webkit_glue::WebPluginResourceClient { 59 class ResourceClientProxy : public webkit_glue::WebPluginResourceClient {
60 public: 60 public:
61 ResourceClientProxy(PluginChannelHost* channel, int instance_id) 61 ResourceClientProxy(PluginChannelHost* channel, int instance_id)
62 : channel_(channel), instance_id_(instance_id), resource_id_(0), 62 : channel_(channel), instance_id_(instance_id), resource_id_(0),
63 notify_needed_(false), notify_data_(NULL), 63 notify_needed_(false), notify_data_(0),
64 multibyte_response_expected_(false) { 64 multibyte_response_expected_(false) {
65 } 65 }
66 66
67 ~ResourceClientProxy() { 67 ~ResourceClientProxy() {
68 } 68 }
69 69
70 void Initialize(int resource_id, const GURL& url, bool notify_needed, 70 void Initialize(int resource_id, const GURL& url, bool notify_needed,
71 intptr_t notify_data, intptr_t existing_stream) { 71 intptr_t notify_data, intptr_t existing_stream) {
72 resource_id_ = resource_id; 72 resource_id_ = resource_id;
73 url_ = url; 73 url_ = url;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // For e.g. response for a HTTP byte range request. 154 // For e.g. response for a HTTP byte range request.
155 bool multibyte_response_expected_; 155 bool multibyte_response_expected_;
156 }; 156 };
157 157
158 WebPluginDelegateProxy::WebPluginDelegateProxy( 158 WebPluginDelegateProxy::WebPluginDelegateProxy(
159 const std::string& mime_type, 159 const std::string& mime_type,
160 const base::WeakPtr<RenderView>& render_view) 160 const base::WeakPtr<RenderView>& render_view)
161 : render_view_(render_view), 161 : render_view_(render_view),
162 plugin_(NULL), 162 plugin_(NULL),
163 windowless_(false), 163 windowless_(false),
164 window_(NULL), 164 window_(gfx::kNullPluginWindow),
165 mime_type_(mime_type), 165 mime_type_(mime_type),
166 instance_id_(MSG_ROUTING_NONE), 166 instance_id_(MSG_ROUTING_NONE),
167 npobject_(NULL), 167 npobject_(NULL),
168 sad_plugin_(NULL), 168 sad_plugin_(NULL),
169 invalidate_pending_(false), 169 invalidate_pending_(false),
170 transparent_(false), 170 transparent_(false),
171 page_url_(render_view_->webview()->mainFrame()->url()) { 171 page_url_(render_view_->webview()->mainFrame()->url()) {
172 } 172 }
173 173
174 WebPluginDelegateProxy::~WebPluginDelegateProxy() { 174 WebPluginDelegateProxy::~WebPluginDelegateProxy() {
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 CGBitmapContextGetData(bg_context)); 649 CGBitmapContextGetData(bg_context));
650 int full_bg_width = CGBitmapContextGetWidth(bg_context); 650 int full_bg_width = CGBitmapContextGetWidth(bg_context);
651 int full_bg_height = CGBitmapContextGetHeight(bg_context); 651 int full_bg_height = CGBitmapContextGetHeight(bg_context);
652 int bg_stride = CGBitmapContextGetBytesPerRow(bg_context); 652 int bg_stride = CGBitmapContextGetBytesPerRow(bg_context);
653 int bg_last_row = CGBitmapContextGetHeight(bg_context) - 1; 653 int bg_last_row = CGBitmapContextGetHeight(bg_context) - 1;
654 654
655 int bytes_per_pixel = CGBitmapContextGetBitsPerPixel(context) / 8; 655 int bytes_per_pixel = CGBitmapContextGetBitsPerPixel(context) / 8;
656 #else 656 #else
657 const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface); 657 const unsigned char* page_bytes = cairo_image_surface_get_data(page_surface);
658 int page_stride = cairo_image_surface_get_stride(page_surface); 658 int page_stride = cairo_image_surface_get_stride(page_surface);
659 int page_start_x = page_x_double; 659 int page_start_x = static_cast<int>(page_x_double);
660 int page_start_y = page_y_double; 660 int page_start_y = static_cast<int>(page_y_double);
661 661
662 skia::PlatformDevice& device = 662 skia::PlatformDevice& device =
663 background_store_canvas_->getTopPlatformDevice(); 663 background_store_canvas_->getTopPlatformDevice();
664 cairo_surface_t* bg_surface = cairo_get_target(device.beginPlatformPaint()); 664 cairo_surface_t* bg_surface = cairo_get_target(device.beginPlatformPaint());
665 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE); 665 DCHECK_EQ(cairo_surface_get_type(bg_surface), CAIRO_SURFACE_TYPE_IMAGE);
666 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32); 666 DCHECK_EQ(cairo_image_surface_get_format(bg_surface), CAIRO_FORMAT_ARGB32);
667 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface); 667 const unsigned char* bg_bytes = cairo_image_surface_get_data(bg_surface);
668 int full_bg_width = cairo_image_surface_get_width(bg_surface); 668 int full_bg_width = cairo_image_surface_get_width(bg_surface);
669 int full_bg_height = cairo_image_surface_get_height(bg_surface); 669 int full_bg_height = cairo_image_surface_get_height(bg_surface);
670 int bg_stride = cairo_image_surface_get_stride(bg_surface); 670 int bg_stride = cairo_image_surface_get_stride(bg_surface);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) { 779 void WebPluginDelegateProxy::OnSetWindow(gfx::PluginWindowHandle window) {
780 windowless_ = !window; 780 windowless_ = !window;
781 window_ = window; 781 window_ = window;
782 if (plugin_) 782 if (plugin_)
783 plugin_->SetWindow(window); 783 plugin_->SetWindow(window);
784 } 784 }
785 785
786 void WebPluginDelegateProxy::WillDestroyWindow() { 786 void WebPluginDelegateProxy::WillDestroyWindow() {
787 DCHECK(window_); 787 DCHECK(window_);
788 plugin_->WillDestroyWindow(window_); 788 plugin_->WillDestroyWindow(window_);
789 window_ = NULL; 789 window_ = gfx::kNullPluginWindow;
790 } 790 }
791 791
792 #if defined(OS_WIN) 792 #if defined(OS_WIN)
793 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent( 793 void WebPluginDelegateProxy::OnSetWindowlessPumpEvent(
794 HANDLE modal_loop_pump_messages_event) { 794 HANDLE modal_loop_pump_messages_event) {
795 DCHECK(modal_loop_pump_messages_event_ == NULL); 795 DCHECK(modal_loop_pump_messages_event_ == NULL);
796 796
797 modal_loop_pump_messages_event_.reset( 797 modal_loop_pump_messages_event_.reset(
798 new base::WaitableEvent(modal_loop_pump_messages_event)); 798 new base::WaitableEvent(modal_loop_pump_messages_event));
799 } 799 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 return; 929 return;
930 930
931 NPVariant results[4]; 931 NPVariant results[4];
932 INT32_TO_NPVARIANT(drag_id, results[0]); 932 INT32_TO_NPVARIANT(drag_id, results[0]);
933 INT32_TO_NPVARIANT(event_id, results[1]); 933 INT32_TO_NPVARIANT(event_id, results[1]);
934 EncodeDragData(data, add_data, &results[2], &results[3]); 934 EncodeDragData(data, add_data, &results[2], &results[3]);
935 935
936 for (size_t i = 0; i < arraysize(results); ++i) { 936 for (size_t i = 0; i < arraysize(results); ++i) {
937 values->push_back(NPVariant_Param()); 937 values->push_back(NPVariant_Param());
938 CreateNPVariantParam( 938 CreateNPVariantParam(
939 results[i], NULL, &values->back(), false, NULL, page_url_); 939 results[i], NULL, &values->back(), false, 0, page_url_);
940 } 940 }
941 941
942 *success = true; 942 *success = true;
943 } 943 }
944 944
945 void WebPluginDelegateProxy::OnSetDropEffect(const NPVariant_Param& object, 945 void WebPluginDelegateProxy::OnSetDropEffect(const NPVariant_Param& object,
946 int effect, 946 int effect,
947 bool* success) { 947 bool* success) {
948 DCHECK(success); 948 DCHECK(success);
949 *success = false; 949 *success = false;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { 1054 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) {
1055 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), 1055 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
1056 existing_stream, notify_needed, 1056 existing_stream, notify_needed,
1057 notify_data); 1057 notify_data);
1058 } 1058 }
1059 1059
1060 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, 1060 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id,
1061 bool defer) { 1061 bool defer) {
1062 plugin_->SetDeferResourceLoading(resource_id, defer); 1062 plugin_->SetDeferResourceLoading(resource_id, defer);
1063 } 1063 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_widget.cc ('k') | chrome/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698