OLD | NEW |
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 "webkit/plugins/npapi/gtk_plugin_container_manager.h" | 5 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/base/gtk/gtk_compat.h" |
10 #include "ui/gfx/gtk_util.h" | 11 #include "ui/gfx/gtk_util.h" |
11 #include "webkit/plugins/npapi/gtk_plugin_container.h" | 12 #include "webkit/plugins/npapi/gtk_plugin_container.h" |
12 #include "webkit/plugins/npapi/webplugin.h" | 13 #include "webkit/plugins/npapi/webplugin.h" |
13 | 14 |
14 namespace webkit { | 15 namespace webkit { |
15 namespace npapi { | 16 namespace npapi { |
16 | 17 |
17 GtkPluginContainerManager::GtkPluginContainerManager() : host_widget_(NULL) {} | 18 GtkPluginContainerManager::GtkPluginContainerManager() : host_widget_(NULL) {} |
18 | 19 |
19 GtkPluginContainerManager::~GtkPluginContainerManager() {} | 20 GtkPluginContainerManager::~GtkPluginContainerManager() {} |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 74 } |
74 | 75 |
75 gtk_widget_show(widget); | 76 gtk_widget_show(widget); |
76 | 77 |
77 if (!move.rects_valid) | 78 if (!move.rects_valid) |
78 return; | 79 return; |
79 | 80 |
80 // TODO(piman): if the widget hasn't been realized (e.g. the tab has been | 81 // TODO(piman): if the widget hasn't been realized (e.g. the tab has been |
81 // torn off and the parent gtk widget has been detached from the hierarchy), | 82 // torn off and the parent gtk widget has been detached from the hierarchy), |
82 // we lose the cutout information. | 83 // we lose the cutout information. |
83 if (GTK_WIDGET_REALIZED(widget)) { | 84 if (gtk_widget_get_realized(widget)) { |
84 GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle(); | 85 GdkRectangle clip_rect = move.clip_rect.ToGdkRectangle(); |
85 GdkRegion* clip_region = gdk_region_rectangle(&clip_rect); | 86 GdkRegion* clip_region = gdk_region_rectangle(&clip_rect); |
86 gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects); | 87 gfx::SubtractRectanglesFromRegion(clip_region, move.cutout_rects); |
87 gdk_window_shape_combine_region(widget->window, clip_region, 0, 0); | 88 gdk_window_shape_combine_region(widget->window, clip_region, 0, 0); |
88 gdk_region_destroy(clip_region); | 89 gdk_region_destroy(clip_region); |
89 } | 90 } |
90 | 91 |
91 // Update the window position. Resizing is handled by WebPluginDelegate. | 92 // Update the window position. Resizing is handled by WebPluginDelegate. |
92 // TODO(deanm): Verify that we only need to move and not resize. | 93 // TODO(deanm): Verify that we only need to move and not resize. |
93 // TODO(evanm): we should cache the last shape and position and skip all | 94 // TODO(evanm): we should cache the last shape and position and skip all |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 GtkPluginContainerManager* plugin_container_manager = | 153 GtkPluginContainerManager* plugin_container_manager = |
153 static_cast<GtkPluginContainerManager*>(user_data); | 154 static_cast<GtkPluginContainerManager*>(user_data); |
154 | 155 |
155 gfx::PluginWindowHandle id = plugin_container_manager->MapWidgetToID(widget); | 156 gfx::PluginWindowHandle id = plugin_container_manager->MapWidgetToID(widget); |
156 if (id) | 157 if (id) |
157 gtk_socket_add_id(GTK_SOCKET(widget), id); | 158 gtk_socket_add_id(GTK_SOCKET(widget), id); |
158 } | 159 } |
159 | 160 |
160 } // namespace npapi | 161 } // namespace npapi |
161 } // namespace webkit | 162 } // namespace webkit |
OLD | NEW |