IndexedDBFactory now ForceCloses databases.
[chromium-blink-merge.git] / content / browser / renderer_host / gtk_plugin_container_manager.h
blobbd0e7c1017a8e89ef58b9b0217874d3448c94d39
1 // Copyright (c) 2011 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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_MANAGER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_MANAGER_H_
8 #include <gtk/gtk.h>
9 #include <map>
11 #include "ui/gfx/native_widget_types.h"
13 typedef struct _GtkWidget GtkWidget;
15 namespace content {
16 struct WebPluginGeometry;
18 // Helper class that creates and manages plugin containers (GtkSocket).
19 class GtkPluginContainerManager {
20 public:
21 GtkPluginContainerManager();
22 ~GtkPluginContainerManager();
24 // Sets the widget that will host the plugin containers. Must be a GtkFixed.
25 void set_host_widget(GtkWidget *widget) { host_widget_ = widget; }
27 // Creates a new plugin container, for a given plugin XID.
28 GtkWidget* CreatePluginContainer(gfx::PluginWindowHandle id);
30 // Destroys a plugin container, given the plugin XID.
31 void DestroyPluginContainer(gfx::PluginWindowHandle id);
33 // Takes an update from WebKit about a plugin's position and side and moves
34 // the plugin accordingly.
35 void MovePluginContainer(const WebPluginGeometry& move);
37 private:
38 // Maps a plugin XID to the corresponding container widget.
39 GtkWidget* MapIDToWidget(gfx::PluginWindowHandle id);
41 // Maps a container widget to the corresponding plugin XID.
42 gfx::PluginWindowHandle MapWidgetToID(GtkWidget* widget);
44 // Callback for when the plugin container gets realized, at which point it
45 // plugs the plugin XID.
46 static void RealizeCallback(GtkWidget *widget, void *user_data);
48 // Parent of the plugin containers.
49 GtkWidget* host_widget_;
51 // A map that associates plugin containers to the plugin XID.
52 typedef std::map<gfx::PluginWindowHandle, GtkWidget*> PluginWindowToWidgetMap;
53 PluginWindowToWidgetMap plugin_window_to_widget_map_;
56 } // namespace content
58 #endif // CONTENT_BROWSER_RENDERER_HOST_GTK_PLUGIN_CONTAINER_MANAGER_H_