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

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

Issue 181014: Eliminate remaining WebCore dependencies from webplugin_impl.cc... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
OLDNEW
1 // Copyright (c) 2006-2008 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>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 using WebKit::WebBindings; 53 using WebKit::WebBindings;
54 using WebKit::WebCursorInfo; 54 using WebKit::WebCursorInfo;
55 using WebKit::WebInputEvent; 55 using WebKit::WebInputEvent;
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 webkit_glue::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_(NULL), 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
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 intptr_t notify_data_; 155 intptr_t notify_data_;
156 // Set to true if the response expected is a multibyte response. 156 // Set to true if the response expected is a multibyte response.
157 // For e.g. response for a HTTP byte range request. 157 // For e.g. response for a HTTP byte range request.
158 bool multibyte_response_expected_; 158 bool multibyte_response_expected_;
159 }; 159 };
160 160
161 WebPluginDelegateProxy* WebPluginDelegateProxy::Create( 161 WebPluginDelegateProxy* WebPluginDelegateProxy::Create(
162 const GURL& url, 162 const GURL& url,
163 const std::string& mime_type, 163 const std::string& mime_type,
164 const std::string& clsid, 164 const std::string& clsid,
165 RenderView* render_view) { 165 const base::WeakPtr<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(
170 const std::string& clsid, 170 const std::string& mime_type,
171 RenderView* render_view) 171 const std::string& clsid,
172 const base::WeakPtr<RenderView>& render_view)
172 : render_view_(render_view), 173 : render_view_(render_view),
173 plugin_(NULL), 174 plugin_(NULL),
174 windowless_(false), 175 windowless_(false),
175 window_(NULL), 176 window_(NULL),
176 mime_type_(mime_type), 177 mime_type_(mime_type),
177 clsid_(clsid), 178 clsid_(clsid),
178 npobject_(NULL), 179 npobject_(NULL),
179 window_script_object_(NULL), 180 window_script_object_(NULL),
180 sad_plugin_(NULL), 181 sad_plugin_(NULL),
181 invalidate_pending_(false), 182 invalidate_pending_(false),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // Release the channel host now. If we are is the last reference to the 215 // Release the channel host now. If we are is the last reference to the
215 // channel, this avoids a race where this renderer asks a new connection to 216 // channel, this avoids a race where this renderer asks a new connection to
216 // the same plugin between now and the time 'this' is actually deleted. 217 // the same plugin between now and the time 'this' is actually deleted.
217 // Destroying the channel host is what releases the channel name -> FD 218 // Destroying the channel host is what releases the channel name -> FD
218 // association on POSIX, and if we ask for a new connection before it is 219 // association on POSIX, and if we ask for a new connection before it is
219 // released, the plugin will give us a new FD, and we'll assert when trying 220 // released, the plugin will give us a new FD, and we'll assert when trying
220 // to associate it with the channel name. 221 // to associate it with the channel name.
221 channel_host_ = NULL; 222 channel_host_ = NULL;
222 } 223 }
223 224
224 render_view_->PluginDestroyed(this);
225 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 225 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
226 } 226 }
227 227
228 bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn, 228 bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn,
229 char** argv, int argc, 229 char** argv, int argc,
230 WebPlugin* plugin, 230 webkit_glue::WebPlugin* plugin,
231 bool load_manually) { 231 bool load_manually) {
232 IPC::ChannelHandle channel_handle; 232 IPC::ChannelHandle channel_handle;
233 FilePath plugin_path; 233 FilePath plugin_path;
234 if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin( 234 if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin(
235 url, mime_type_, clsid_, webkit_glue::GetWebKitLocale(), 235 url, mime_type_, clsid_, webkit_glue::GetWebKitLocale(),
236 &channel_handle, &plugin_path))) { 236 &channel_handle, &plugin_path))) {
237 return false; 237 return false;
238 } 238 }
239 239
240 #if defined(OS_POSIX) 240 #if defined(OS_POSIX)
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 std::string* cookies) { 874 std::string* cookies) {
875 DCHECK(cookies); 875 DCHECK(cookies);
876 if (plugin_) 876 if (plugin_)
877 *cookies = plugin_->GetCookies(url, first_party_for_cookies); 877 *cookies = plugin_->GetCookies(url, first_party_for_cookies);
878 } 878 }
879 879
880 void WebPluginDelegateProxy::OnShowModalHTMLDialog( 880 void WebPluginDelegateProxy::OnShowModalHTMLDialog(
881 const GURL& url, int width, int height, const std::string& json_arguments, 881 const GURL& url, int width, int height, const std::string& json_arguments,
882 std::string* json_retval) { 882 std::string* json_retval) {
883 DCHECK(json_retval); 883 DCHECK(json_retval);
884 if (render_view_) 884 if (render_view_) {
885 render_view_->ShowModalHTMLDialog(url, width, height, json_arguments, 885 render_view_->ShowModalHTMLDialogForPlugin(
886 json_retval); 886 url, gfx::Size(width, height), json_arguments, json_retval);
887 }
887 } 888 }
888 889
889 static void EncodeDragData(const WebDragData& data, bool add_data, 890 static void EncodeDragData(const WebDragData& data, bool add_data,
890 NPVariant* drag_type, NPVariant* drag_data) { 891 NPVariant* drag_type, NPVariant* drag_data) {
891 const NPString* np_drag_type; 892 const NPString* np_drag_type;
892 if (data.hasFileNames()) { 893 if (data.hasFileNames()) {
893 static const NPString kFiles = { "Files", 5 }; 894 static const NPString kFiles = { "Files", 5 };
894 np_drag_type = &kFiles; 895 np_drag_type = &kFiles;
895 } else { 896 } else {
896 static const NPString kEmpty = { "" , 0 }; 897 static const NPString kEmpty = { "" , 0 };
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 target = params.target.c_str(); 1042 target = params.target.c_str();
1042 1043
1043 plugin_->HandleURLRequest(params.method.c_str(), 1044 plugin_->HandleURLRequest(params.method.c_str(),
1044 params.is_javascript_url, target, 1045 params.is_javascript_url, target,
1045 static_cast<unsigned int>(params.buffer.size()), 1046 static_cast<unsigned int>(params.buffer.size()),
1046 data, params.is_file_data, params.notify, 1047 data, params.is_file_data, params.notify,
1047 params.url.c_str(), params.notify_data, 1048 params.url.c_str(), params.notify_data,
1048 params.popups_allowed); 1049 params.popups_allowed);
1049 } 1050 }
1050 1051
1051 WebPluginResourceClient* WebPluginDelegateProxy::CreateResourceClient( 1052 webkit_glue::WebPluginResourceClient*
1053 WebPluginDelegateProxy::CreateResourceClient(
1052 int resource_id, const GURL& url, bool notify_needed, 1054 int resource_id, const GURL& url, bool notify_needed,
1053 intptr_t notify_data, intptr_t npstream) { 1055 intptr_t notify_data, intptr_t npstream) {
1054 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, 1056 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_,
1055 instance_id_); 1057 instance_id_);
1056 proxy->Initialize(resource_id, url, notify_needed, notify_data, npstream); 1058 proxy->Initialize(resource_id, url, notify_needed, notify_data, npstream);
1057 return proxy; 1059 return proxy;
1058 } 1060 }
1059 1061
1062 bool WebPluginDelegateProxy::IsWindowless() const {
1063 NOTREACHED();
1064 return false;
1065 }
1066
1067 gfx::Rect WebPluginDelegateProxy::GetRect() const {
1068 NOTREACHED();
1069 return gfx::Rect();
1070 }
1071
1072 gfx::Rect WebPluginDelegateProxy::GetClipRect() const {
1073 NOTREACHED();
1074 return gfx::Rect();
1075 }
1076
1077 int WebPluginDelegateProxy::GetQuirks() const {
1078 NOTREACHED();
1079 return 0;
1080 }
1081
1060 void WebPluginDelegateProxy::OnCancelDocumentLoad() { 1082 void WebPluginDelegateProxy::OnCancelDocumentLoad() {
1061 plugin_->CancelDocumentLoad(); 1083 plugin_->CancelDocumentLoad();
1062 } 1084 }
1063 1085
1064 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest( 1086 void WebPluginDelegateProxy::OnInitiateHTTPRangeRequest(
1065 const std::string& url, const std::string& range_info, 1087 const std::string& url, const std::string& range_info,
1066 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { 1088 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) {
1067 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), 1089 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
1068 existing_stream, notify_needed, 1090 existing_stream, notify_needed,
1069 notify_data); 1091 notify_data);
1070 } 1092 }
1071 1093
1072 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, 1094 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id,
1073 bool defer) { 1095 bool defer) {
1074 plugin_->SetDeferResourceLoading(resource_id, defer); 1096 plugin_->SetDeferResourceLoading(resource_id, defer);
1075 } 1097 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698