| OLD | NEW |
| 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 "webkit/glue/plugins/webplugin_delegate_impl.h" | 5 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "third_party/npapi/bindings/npapi_x11.h" | 32 #include "third_party/npapi/bindings/npapi_x11.h" |
| 33 | 33 |
| 34 using WebKit::WebCursorInfo; | 34 using WebKit::WebCursorInfo; |
| 35 using WebKit::WebKeyboardEvent; | 35 using WebKit::WebKeyboardEvent; |
| 36 using WebKit::WebInputEvent; | 36 using WebKit::WebInputEvent; |
| 37 using WebKit::WebMouseEvent; | 37 using WebKit::WebMouseEvent; |
| 38 | 38 |
| 39 WebPluginDelegateImpl::WebPluginDelegateImpl( | 39 WebPluginDelegateImpl::WebPluginDelegateImpl( |
| 40 gfx::PluginWindowHandle containing_view, | 40 gfx::PluginWindowHandle containing_view, |
| 41 NPAPI::PluginInstance *instance) | 41 NPAPI::PluginInstance *instance) |
| 42 : | 42 : windowed_handle_(0), |
| 43 windowed_handle_(0), | |
| 44 windowed_did_set_window_(false), | 43 windowed_did_set_window_(false), |
| 45 windowless_(false), | 44 windowless_(false), |
| 46 plugin_(NULL), | 45 plugin_(NULL), |
| 47 windowless_needs_set_window_(true), | 46 windowless_needs_set_window_(true), |
| 48 instance_(instance), | 47 instance_(instance), |
| 49 pixmap_(NULL), | 48 pixmap_(NULL), |
| 50 first_event_time_(-1.0), | 49 first_event_time_(-1.0), |
| 51 plug_(NULL), | 50 plug_(NULL), |
| 52 socket_(NULL), | 51 socket_(NULL), |
| 53 parent_(containing_view), | 52 parent_(containing_view), |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 110 } |
| 112 | 111 |
| 113 void WebPluginDelegateImpl::InstallMissingPlugin() { | 112 void WebPluginDelegateImpl::InstallMissingPlugin() { |
| 114 NOTIMPLEMENTED(); | 113 NOTIMPLEMENTED(); |
| 115 } | 114 } |
| 116 | 115 |
| 117 bool WebPluginDelegateImpl::WindowedCreatePlugin() { | 116 bool WebPluginDelegateImpl::WindowedCreatePlugin() { |
| 118 DCHECK(!windowed_handle_); | 117 DCHECK(!windowed_handle_); |
| 119 DCHECK(!plug_); | 118 DCHECK(!plug_); |
| 120 | 119 |
| 121 bool xembed; | 120 // NPP_GetValue() will write 4 bytes of data to this variable. Don't use a |
| 121 // single byte bool, use an int instead. |
| 122 int xembed; |
| 122 NPError err = instance_->NPP_GetValue(NPPVpluginNeedsXEmbed, &xembed); | 123 NPError err = instance_->NPP_GetValue(NPPVpluginNeedsXEmbed, &xembed); |
| 123 DCHECK(err == NPERR_NO_ERROR); | 124 DCHECK(err == NPERR_NO_ERROR); |
| 124 if (!xembed) { | 125 if (!xembed) { |
| 125 NOTIMPLEMENTED() << "Windowed plugin but without xembed."; | 126 NOTIMPLEMENTED() << "Windowed plugin but without xembed."; |
| 126 return false; | 127 return false; |
| 127 } | 128 } |
| 128 | 129 |
| 129 // Passing 0 as the socket XID creates a plug without plugging it in a socket | 130 // Passing 0 as the socket XID creates a plug without plugging it in a socket |
| 130 // yet, so that it can be latter added with gtk_socket_add_id(). | 131 // yet, so that it can be latter added with gtk_socket_add_id(). |
| 131 plug_ = gtk_plug_new(0); | 132 plug_ = gtk_plug_new(0); |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 if (event->event == WM_MOUSEMOVE) { | 702 if (event->event == WM_MOUSEMOVE) { |
| 702 // Snag a reference to the current cursor ASAP in case the plugin modified | 703 // Snag a reference to the current cursor ASAP in case the plugin modified |
| 703 // it. There is a nasty race condition here with the multiprocess browser | 704 // it. There is a nasty race condition here with the multiprocess browser |
| 704 // as someone might be setting the cursor in the main process as well. | 705 // as someone might be setting the cursor in the main process as well. |
| 705 *cursor = current_windowless_cursor_; | 706 *cursor = current_windowless_cursor_; |
| 706 } | 707 } |
| 707 #endif | 708 #endif |
| 708 | 709 |
| 709 return ret; | 710 return ret; |
| 710 } | 711 } |
| OLD | NEW |