| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 windowless_needs_set_window_(true), | 67 windowless_needs_set_window_(true), |
| 68 instance_(instance), | 68 instance_(instance), |
| 69 pixmap_(NULL), | 69 pixmap_(NULL), |
| 70 first_event_time_(-1.0), | 70 first_event_time_(-1.0), |
| 71 parent_(containing_view), | 71 parent_(containing_view), |
| 72 quirks_(0) { | 72 quirks_(0) { |
| 73 memset(&window_, 0, sizeof(window_)); | 73 memset(&window_, 0, sizeof(window_)); |
| 74 if (instance_->mime_type() == "application/x-shockwave-flash") { | 74 if (instance_->mime_type() == "application/x-shockwave-flash") { |
| 75 // Flash is tied to Firefox's whacky behavior with windowless plugins. See | 75 // Flash is tied to Firefox's whacky behavior with windowless plugins. See |
| 76 // comments in WindowlessPaint | 76 // comments in WindowlessPaint |
| 77 quirks_ |= PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW; | 77 quirks_ |= PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW |
| 78 | PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW; |
| 78 } | 79 } |
| 79 } | 80 } |
| 80 | 81 |
| 81 WebPluginDelegateImpl::~WebPluginDelegateImpl() { | 82 WebPluginDelegateImpl::~WebPluginDelegateImpl() { |
| 82 DestroyInstance(); | 83 DestroyInstance(); |
| 83 | 84 |
| 84 if (!windowless_) | 85 if (!windowless_) |
| 85 WindowedDestroyWindow(); | 86 WindowedDestroyWindow(); |
| 86 | 87 |
| 87 if (window_.ws_info) { | 88 if (window_.ws_info) { |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 extra->visual = GDK_VISUAL_XVISUAL(visual); | 610 extra->visual = GDK_VISUAL_XVISUAL(visual); |
| 610 extra->depth = visual->depth; | 611 extra->depth = visual->depth; |
| 611 GdkColormap* colormap = gdk_colormap_new(gdk_visual_get_system(), FALSE); | 612 GdkColormap* colormap = gdk_colormap_new(gdk_visual_get_system(), FALSE); |
| 612 extra->colormap = GDK_COLORMAP_XCOLORMAP(colormap); | 613 extra->colormap = GDK_COLORMAP_XCOLORMAP(colormap); |
| 613 | 614 |
| 614 if (!force_set_window) | 615 if (!force_set_window) |
| 615 windowless_needs_set_window_ = false; | 616 windowless_needs_set_window_ = false; |
| 616 | 617 |
| 617 NPError err = instance()->NPP_SetWindow(&window_); | 618 NPError err = instance()->NPP_SetWindow(&window_); |
| 618 DCHECK(err == NPERR_NO_ERROR); | 619 DCHECK(err == NPERR_NO_ERROR); |
| 620 if (quirks_ & PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW) { |
| 621 // After a NPP_SetWindow, Flash cancels its timer that generates the |
| 622 // invalidates until it gets a paint event, but doesn't explicitly call |
| 623 // NPP_InvalidateRect. |
| 624 plugin_->InvalidateRect(clip_rect_); |
| 625 } |
| 619 } | 626 } |
| 620 | 627 |
| 621 void WebPluginDelegateImpl::SetFocus() { | 628 void WebPluginDelegateImpl::SetFocus() { |
| 622 DCHECK(instance()->windowless()); | 629 DCHECK(instance()->windowless()); |
| 623 | 630 |
| 624 NPEvent np_event = {0}; | 631 NPEvent np_event = {0}; |
| 625 XFocusChangeEvent &event = np_event.xfocus; | 632 XFocusChangeEvent &event = np_event.xfocus; |
| 626 event.type = FocusIn; | 633 event.type = FocusIn; |
| 627 event.display = GDK_DISPLAY(); | 634 event.display = GDK_DISPLAY(); |
| 628 // Same values as Firefox. .serial and .window stay 0. | 635 // Same values as Firefox. .serial and .window stay 0. |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 return stream; | 860 return stream; |
| 854 } | 861 } |
| 855 | 862 |
| 856 void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, | 863 void WebPluginDelegateImpl::URLRequestRouted(const std::string&url, |
| 857 bool notify_needed, | 864 bool notify_needed, |
| 858 intptr_t notify_data) { | 865 intptr_t notify_data) { |
| 859 if (notify_needed) { | 866 if (notify_needed) { |
| 860 instance()->SetURLLoadData(GURL(url.c_str()), notify_data); | 867 instance()->SetURLLoadData(GURL(url.c_str()), notify_data); |
| 861 } | 868 } |
| 862 } | 869 } |
| OLD | NEW |