OLD | NEW |
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 "chrome/renderer/webplugin_delegate_proxy.h" | 5 #include "chrome/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "net/base/mime_util.h" | 41 #include "net/base/mime_util.h" |
42 #include "printing/native_metafile.h" | 42 #include "printing/native_metafile.h" |
43 #include "skia/ext/platform_canvas.h" | 43 #include "skia/ext/platform_canvas.h" |
44 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" | 44 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
45 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" | 45 #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" |
46 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" | 46 #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h" |
47 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 47 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
48 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 48 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
49 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 49 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
50 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 50 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
51 #include "webkit/glue/plugins/webplugin.h" | 51 #include "webkit/plugins/npapi/webplugin.h" |
52 #include "webkit/glue/webkit_glue.h" | 52 #include "webkit/glue/webkit_glue.h" |
53 | 53 |
54 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
55 #include "ipc/ipc_channel_posix.h" | 55 #include "ipc/ipc_channel_posix.h" |
56 #endif | 56 #endif |
57 | 57 |
58 using WebKit::WebBindings; | 58 using WebKit::WebBindings; |
59 using WebKit::WebCursorInfo; | 59 using WebKit::WebCursorInfo; |
60 using WebKit::WebDragData; | 60 using WebKit::WebDragData; |
61 using WebKit::WebInputEvent; | 61 using WebKit::WebInputEvent; |
62 using WebKit::WebString; | 62 using WebKit::WebString; |
63 using WebKit::WebVector; | 63 using WebKit::WebVector; |
64 using WebKit::WebView; | 64 using WebKit::WebView; |
65 | 65 |
66 // Proxy for WebPluginResourceClient. The object owns itself after creation, | 66 // Proxy for WebPluginResourceClient. The object owns itself after creation, |
67 // deleting itself after its callback has been called. | 67 // deleting itself after its callback has been called. |
68 class ResourceClientProxy : public webkit_glue::WebPluginResourceClient { | 68 class ResourceClientProxy : public webkit::npapi::WebPluginResourceClient { |
69 public: | 69 public: |
70 ResourceClientProxy(PluginChannelHost* channel, int instance_id) | 70 ResourceClientProxy(PluginChannelHost* channel, int instance_id) |
71 : channel_(channel), instance_id_(instance_id), resource_id_(0), | 71 : channel_(channel), instance_id_(instance_id), resource_id_(0), |
72 multibyte_response_expected_(false) { | 72 multibyte_response_expected_(false) { |
73 } | 73 } |
74 | 74 |
75 ~ResourceClientProxy() { | 75 ~ResourceClientProxy() { |
76 } | 76 } |
77 | 77 |
78 void Initialize(unsigned long resource_id, const GURL& url, int notify_id) { | 78 void Initialize(unsigned long resource_id, const GURL& url, int notify_id) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 base::SplitString(value_string, ',', &components); | 260 base::SplitString(value_string, ',', &components); |
261 if (components.size() == 4 && !StartsWithASCII(components[0], "1", false)) | 261 if (components.size() == 4 && !StartsWithASCII(components[0], "1", false)) |
262 return true; | 262 return true; |
263 } else if (LowerCaseEqualsASCII(color, "transparent")) { | 263 } else if (LowerCaseEqualsASCII(color, "transparent")) { |
264 return true; | 264 return true; |
265 } | 265 } |
266 // Anything else is a named, opaque color or an RGB form with no alpha. | 266 // Anything else is a named, opaque color or an RGB form with no alpha. |
267 return false; | 267 return false; |
268 } | 268 } |
269 | 269 |
270 bool WebPluginDelegateProxy::Initialize(const GURL& url, | 270 bool WebPluginDelegateProxy::Initialize( |
| 271 const GURL& url, |
271 const std::vector<std::string>& arg_names, | 272 const std::vector<std::string>& arg_names, |
272 const std::vector<std::string>& arg_values, | 273 const std::vector<std::string>& arg_values, |
273 webkit_glue::WebPlugin* plugin, | 274 webkit::npapi::WebPlugin* plugin, |
274 bool load_manually) { | 275 bool load_manually) { |
275 IPC::ChannelHandle channel_handle; | 276 IPC::ChannelHandle channel_handle; |
276 if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin( | 277 if (!RenderThread::current()->Send(new ViewHostMsg_OpenChannelToPlugin( |
277 url, mime_type_, &channel_handle, &info_))) { | 278 url, mime_type_, &channel_handle, &info_))) { |
278 return false; | 279 return false; |
279 } | 280 } |
280 | 281 |
281 if (channel_handle.name.empty()) { | 282 if (channel_handle.name.empty()) { |
282 // We got an invalid handle. Either the plugin couldn't be found (which | 283 // We got an invalid handle. Either the plugin couldn't be found (which |
283 // shouldn't happen, since if we got here the plugin should exist) or the | 284 // shouldn't happen, since if we got here the plugin should exist) or the |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 const char* target = NULL; | 1343 const char* target = NULL; |
1343 if (params.target.length()) | 1344 if (params.target.length()) |
1344 target = params.target.c_str(); | 1345 target = params.target.c_str(); |
1345 | 1346 |
1346 plugin_->HandleURLRequest( | 1347 plugin_->HandleURLRequest( |
1347 params.url.c_str(), params.method.c_str(), target, data, | 1348 params.url.c_str(), params.method.c_str(), target, data, |
1348 static_cast<unsigned int>(params.buffer.size()), params.notify_id, | 1349 static_cast<unsigned int>(params.buffer.size()), params.notify_id, |
1349 params.popups_allowed, params.notify_redirects); | 1350 params.popups_allowed, params.notify_redirects); |
1350 } | 1351 } |
1351 | 1352 |
1352 webkit_glue::WebPluginResourceClient* | 1353 webkit::npapi::WebPluginResourceClient* |
1353 WebPluginDelegateProxy::CreateResourceClient( | 1354 WebPluginDelegateProxy::CreateResourceClient( |
1354 unsigned long resource_id, const GURL& url, int notify_id) { | 1355 unsigned long resource_id, const GURL& url, int notify_id) { |
1355 if (!channel_host_) | 1356 if (!channel_host_) |
1356 return NULL; | 1357 return NULL; |
1357 | 1358 |
1358 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, | 1359 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, |
1359 instance_id_); | 1360 instance_id_); |
1360 proxy->Initialize(resource_id, url, notify_id); | 1361 proxy->Initialize(resource_id, url, notify_id); |
1361 return proxy; | 1362 return proxy; |
1362 } | 1363 } |
1363 | 1364 |
1364 webkit_glue::WebPluginResourceClient* | 1365 webkit::npapi::WebPluginResourceClient* |
1365 WebPluginDelegateProxy::CreateSeekableResourceClient( | 1366 WebPluginDelegateProxy::CreateSeekableResourceClient( |
1366 unsigned long resource_id, int range_request_id) { | 1367 unsigned long resource_id, int range_request_id) { |
1367 if (!channel_host_) | 1368 if (!channel_host_) |
1368 return NULL; | 1369 return NULL; |
1369 | 1370 |
1370 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, | 1371 ResourceClientProxy* proxy = new ResourceClientProxy(channel_host_, |
1371 instance_id_); | 1372 instance_id_); |
1372 proxy->InitializeForSeekableStream(resource_id, range_request_id); | 1373 proxy->InitializeForSeekableStream(resource_id, range_request_id); |
1373 return proxy; | 1374 return proxy; |
1374 } | 1375 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 #endif | 1559 #endif |
1559 | 1560 |
1560 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1561 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1561 int resource_id) { | 1562 int resource_id) { |
1562 if (!plugin_) | 1563 if (!plugin_) |
1563 return; | 1564 return; |
1564 | 1565 |
1565 plugin_->URLRedirectResponse(allow, resource_id); | 1566 plugin_->URLRedirectResponse(allow, resource_id); |
1566 } | 1567 } |
1567 | 1568 |
OLD | NEW |