| 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/glue/plugins/gtk_plugin_container_manager.h" | 5 #include "webkit/glue/plugins/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 "gfx/gtk_util.h" | 10 #include "gfx/gtk_util.h" |
| 11 #include "webkit/glue/plugins/gtk_plugin_container.h" | 11 #include "webkit/glue/plugins/gtk_plugin_container.h" |
| 12 #include "webkit/glue/plugins/webplugin.h" | 12 #include "webkit/glue/plugins/webplugin.h" |
| 13 | 13 |
| 14 GtkPluginContainerManager::GtkPluginContainerManager() : host_widget_(NULL) {} |
| 15 |
| 16 GtkPluginContainerManager::~GtkPluginContainerManager() {} |
| 17 |
| 14 GtkWidget* GtkPluginContainerManager::CreatePluginContainer( | 18 GtkWidget* GtkPluginContainerManager::CreatePluginContainer( |
| 15 gfx::PluginWindowHandle id) { | 19 gfx::PluginWindowHandle id) { |
| 16 DCHECK(host_widget_); | 20 DCHECK(host_widget_); |
| 17 GtkWidget *widget = gtk_plugin_container_new(); | 21 GtkWidget *widget = gtk_plugin_container_new(); |
| 18 plugin_window_to_widget_map_.insert(std::make_pair(id, widget)); | 22 plugin_window_to_widget_map_.insert(std::make_pair(id, widget)); |
| 19 | 23 |
| 20 // The Realize callback is responsible for adding the plug into the socket. | 24 // The Realize callback is responsible for adding the plug into the socket. |
| 21 // The reason is 2-fold: | 25 // The reason is 2-fold: |
| 22 // - the plug can't be added until the socket is realized, but this may not | 26 // - the plug can't be added until the socket is realized, but this may not |
| 23 // happen until the socket is attached to a top-level window, which isn't the | 27 // happen until the socket is attached to a top-level window, which isn't the |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // static | 146 // static |
| 143 void GtkPluginContainerManager::RealizeCallback(GtkWidget* widget, | 147 void GtkPluginContainerManager::RealizeCallback(GtkWidget* widget, |
| 144 void* user_data) { | 148 void* user_data) { |
| 145 GtkPluginContainerManager* plugin_container_manager = | 149 GtkPluginContainerManager* plugin_container_manager = |
| 146 static_cast<GtkPluginContainerManager*>(user_data); | 150 static_cast<GtkPluginContainerManager*>(user_data); |
| 147 | 151 |
| 148 gfx::PluginWindowHandle id = plugin_container_manager->MapWidgetToID(widget); | 152 gfx::PluginWindowHandle id = plugin_container_manager->MapWidgetToID(widget); |
| 149 if (id) | 153 if (id) |
| 150 gtk_socket_add_id(GTK_SOCKET(widget), id); | 154 gtk_socket_add_id(GTK_SOCKET(widget), id); |
| 151 } | 155 } |
| OLD | NEW |