OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_GLUE_PLUGINS_GTK_PLUGIN_CONTAINER_HOST_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_GTK_PLUGIN_CONTAINER_HOST_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 #include <map> |
| 10 #include "base/gfx/native_widget_types.h" |
| 11 |
| 12 typedef struct _GtkWidget GtkWidget; |
| 13 struct WebPluginGeometry; |
| 14 |
| 15 // Helper class that creates and manages plugin containers (GtkSocket). |
| 16 class GtkPluginContainerHost { |
| 17 public: |
| 18 GtkPluginContainerHost() : host_widget_(NULL) { } |
| 19 |
| 20 // Sets the widget that will host the plugin containers. Must be a GtkFixed. |
| 21 void set_host_widget(GtkWidget *widget) { host_widget_ = widget; } |
| 22 |
| 23 // Creates a new plugin container, returning its XID. |
| 24 gfx::PluginWindowHandle CreatePluginContainer(); |
| 25 |
| 26 // Destroys a plugin container, given its XID. |
| 27 void DestroyPluginContainer(gfx::PluginWindowHandle container); |
| 28 |
| 29 // Moves a plugin container. |
| 30 void MovePluginContainer(const WebPluginGeometry& move); |
| 31 |
| 32 private: |
| 33 // Maps a plugin container XID to the corresponding widget. |
| 34 GtkWidget* MapIDToWidget(gfx::PluginWindowHandle id); |
| 35 |
| 36 // Call back for when the plugin container loses its XID, so that it can be |
| 37 // removed from plugin_window_to_widget_map_. |
| 38 static gboolean UnrealizeCallback(GtkWidget *widget, void *user_data); |
| 39 |
| 40 // Parent of the plugin containers. |
| 41 GtkWidget* host_widget_; |
| 42 |
| 43 // A map that associates plugin containers to their XID. |
| 44 typedef std::map<gfx::PluginWindowHandle, GtkWidget*> PluginWindowToWidgetMap; |
| 45 PluginWindowToWidgetMap plugin_window_to_widget_map_; |
| 46 }; |
| 47 |
| 48 #endif // WEBKIT_GLUE_PLUGINS_GTK_PLUGIN_CONTAINER_HOST_H_ |
OLD | NEW |