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

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

Issue 5996003: Revert "Revert 69755 - Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi" (Closed) Base URL: svn://svn.chromium.org/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 | « chrome/renderer/webplugin_delegate_proxy.h ('k') | chrome/test/plugin/plugin_test.cpp » ('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 "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
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
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
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 22 matching lines...) Expand all
1397 return false; 1398 return false;
1398 OnSetWindow(fake_window); 1399 OnSetWindow(fake_window);
1399 if (!Send(new PluginMsg_SetFakeAcceleratedSurfaceWindowHandle(instance_id_, 1400 if (!Send(new PluginMsg_SetFakeAcceleratedSurfaceWindowHandle(instance_id_,
1400 fake_window))) { 1401 fake_window))) {
1401 return false; 1402 return false;
1402 } 1403 }
1403 1404
1404 // Since this isn't a real window, it doesn't get initial size and location 1405 // Since this isn't a real window, it doesn't get initial size and location
1405 // information the way a real windowed plugin would, so we need to feed it its 1406 // information the way a real windowed plugin would, so we need to feed it its
1406 // starting geometry. 1407 // starting geometry.
1407 webkit_glue::WebPluginGeometry geom; 1408 webkit::npapi::WebPluginGeometry geom;
1408 geom.window = fake_window; 1409 geom.window = fake_window;
1409 geom.window_rect = plugin_rect_; 1410 geom.window_rect = plugin_rect_;
1410 geom.clip_rect = clip_rect_; 1411 geom.clip_rect = clip_rect_;
1411 geom.rects_valid = true; 1412 geom.rects_valid = true;
1412 geom.visible = true; 1413 geom.visible = true;
1413 render_view_->DidMovePlugin(geom); 1414 render_view_->DidMovePlugin(geom);
1414 // Invalidate the plugin region to ensure that the move event actually gets 1415 // Invalidate the plugin region to ensure that the move event actually gets
1415 // dispatched (for a plugin on an otherwise static page). 1416 // dispatched (for a plugin on an otherwise static page).
1416 render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(), 1417 render_view_->didInvalidateRect(WebKit::WebRect(plugin_rect_.x(),
1417 plugin_rect_.y(), 1418 plugin_rect_.y(),
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 #if defined(OS_WIN) 1537 #if defined(OS_WIN)
1537 bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() { 1538 bool WebPluginDelegateProxy::UseSynchronousGeometryUpdates() {
1538 // Need to update geometry synchronously with WMP, otherwise if a site 1539 // Need to update geometry synchronously with WMP, otherwise if a site
1539 // scripts the plugin to start playing while it's in the middle of handling 1540 // scripts the plugin to start playing while it's in the middle of handling
1540 // an update geometry message, videos don't play. See urls in bug 20260. 1541 // an update geometry message, videos don't play. See urls in bug 20260.
1541 if (info_.name.find(ASCIIToUTF16("Windows Media Player")) != string16::npos) 1542 if (info_.name.find(ASCIIToUTF16("Windows Media Player")) != string16::npos)
1542 return true; 1543 return true;
1543 1544
1544 // The move networks plugin needs to be informed of geometry updates 1545 // The move networks plugin needs to be informed of geometry updates
1545 // synchronously. 1546 // synchronously.
1546 std::vector<WebPluginMimeType>::iterator index; 1547 std::vector<webkit::npapi::WebPluginMimeType>::iterator index;
1547 for (index = info_.mime_types.begin(); index != info_.mime_types.end(); 1548 for (index = info_.mime_types.begin(); index != info_.mime_types.end();
1548 index++) { 1549 index++) {
1549 if (index->mime_type == "application/x-vnd.moveplayer.qm" || 1550 if (index->mime_type == "application/x-vnd.moveplayer.qm" ||
1550 index->mime_type == "application/x-vnd.moveplay2.qm" || 1551 index->mime_type == "application/x-vnd.moveplay2.qm" ||
1551 index->mime_type == "application/x-vnd.movenetworks.qm" || 1552 index->mime_type == "application/x-vnd.movenetworks.qm" ||
1552 index->mime_type == "application/x-vnd.mnplayer.qm") { 1553 index->mime_type == "application/x-vnd.mnplayer.qm") {
1553 return true; 1554 return true;
1554 } 1555 }
1555 } 1556 }
1556 return false; 1557 return false;
1557 } 1558 }
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
OLDNEW
« no previous file with comments | « chrome/renderer/webplugin_delegate_proxy.h ('k') | chrome/test/plugin/plugin_test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698