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