| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 pixmap_(NULL), | 48 pixmap_(NULL), |
| 49 first_event_time_(-1.0), | 49 first_event_time_(-1.0), |
| 50 plug_(NULL), | 50 plug_(NULL), |
| 51 socket_(NULL), | 51 socket_(NULL), |
| 52 parent_(containing_view), | 52 parent_(containing_view), |
| 53 quirks_(0), | 53 quirks_(0), |
| 54 handle_event_depth_(0) { | 54 handle_event_depth_(0) { |
| 55 memset(&window_, 0, sizeof(window_)); | 55 memset(&window_, 0, sizeof(window_)); |
| 56 if (instance_->mime_type() == "application/x-shockwave-flash") { | 56 if (instance_->mime_type() == "application/x-shockwave-flash") { |
| 57 // Flash is tied to Firefox's whacky behavior with windowless plugins. See | 57 // Flash is tied to Firefox's whacky behavior with windowless plugins. See |
| 58 // comments in WindowlessPaint | 58 // comments in WindowlessPaint. |
| 59 // TODO(viettrungluu): PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK: Don't allow |
| 60 // right-clicks in windowless content since Flash 10.1 (initial release, at |
| 61 // least) hangs in that case. Remove this once Flash is fixed. |
| 59 quirks_ |= PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW | 62 quirks_ |= PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW |
| 60 | PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW; | 63 | PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW |
| 64 | PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK; |
| 61 } | 65 } |
| 62 | 66 |
| 63 // TODO(evanm): I played with this for quite a while but couldn't | 67 // TODO(evanm): I played with this for quite a while but couldn't |
| 64 // figure out a way to make Flash not crash unless I didn't call | 68 // figure out a way to make Flash not crash unless I didn't call |
| 65 // NPP_SetWindow. | 69 // NPP_SetWindow. |
| 66 // However, after piman's grand refactor of windowed plugins, maybe | 70 // However, after piman's grand refactor of windowed plugins, maybe |
| 67 // this is no longer necessary. | 71 // this is no longer necessary. |
| 68 quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY; | 72 quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY; |
| 69 } | 73 } |
| 70 | 74 |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 const WebInputEvent& event, WebCursorInfo* cursor_info) { | 693 const WebInputEvent& event, WebCursorInfo* cursor_info) { |
| 690 | 694 |
| 691 if (first_event_time_ < 0.0) | 695 if (first_event_time_ < 0.0) |
| 692 first_event_time_ = event.timeStampSeconds; | 696 first_event_time_ = event.timeStampSeconds; |
| 693 Time timestamp = static_cast<Time>( | 697 Time timestamp = static_cast<Time>( |
| 694 (event.timeStampSeconds - first_event_time_) * 1.0e3); | 698 (event.timeStampSeconds - first_event_time_) * 1.0e3); |
| 695 NPEvent np_event = {0}; | 699 NPEvent np_event = {0}; |
| 696 if (!NPEventFromWebInputEvent(event, timestamp, &np_event)) { | 700 if (!NPEventFromWebInputEvent(event, timestamp, &np_event)) { |
| 697 return false; | 701 return false; |
| 698 } | 702 } |
| 703 // See comment about PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK in constructor. |
| 704 if (windowless_ && |
| 705 (quirks_ & PLUGIN_QUIRK_WINDOWLESS_NO_RIGHT_CLICK) && |
| 706 (np_event.type == ButtonPress || np_event.type == ButtonRelease) && |
| 707 (np_event.xbutton.button == Button3)) { |
| 708 return false; |
| 709 } |
| 710 |
| 699 bool ret = instance()->NPP_HandleEvent(&np_event) != 0; | 711 bool ret = instance()->NPP_HandleEvent(&np_event) != 0; |
| 700 | 712 |
| 701 // Flash always returns false, even when the event is handled. | 713 // Flash always returns false, even when the event is handled. |
| 702 ret = true; | 714 ret = true; |
| 703 | 715 |
| 704 #if 0 | 716 #if 0 |
| 705 if (event->event == WM_MOUSEMOVE) { | 717 if (event->event == WM_MOUSEMOVE) { |
| 706 // Snag a reference to the current cursor ASAP in case the plugin modified | 718 // Snag a reference to the current cursor ASAP in case the plugin modified |
| 707 // it. There is a nasty race condition here with the multiprocess browser | 719 // it. There is a nasty race condition here with the multiprocess browser |
| 708 // as someone might be setting the cursor in the main process as well. | 720 // as someone might be setting the cursor in the main process as well. |
| 709 *cursor = current_windowless_cursor_; | 721 *cursor = current_windowless_cursor_; |
| 710 } | 722 } |
| 711 #endif | 723 #endif |
| 712 | 724 |
| 713 return ret; | 725 return ret; |
| 714 } | 726 } |
| OLD | NEW |