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 "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
9 #include <gdk/gdkkeysyms.h> | 9 #include <gdk/gdkkeysyms.h> |
10 #include <gdk/gdkx.h> | 10 #include <gdk/gdkx.h> |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 parent_ = parent_host_view->GetNativeView(); | 866 parent_ = parent_host_view->GetNativeView(); |
867 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); | 867 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); |
868 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); | 868 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); |
869 plugin_container_manager_.set_host_widget(view_.get()); | 869 plugin_container_manager_.set_host_widget(view_.get()); |
870 gtk_container_add(GTK_CONTAINER(popup), view_.get()); | 870 gtk_container_add(GTK_CONTAINER(popup), view_.get()); |
871 | 871 |
872 // If we are not activatable, we don't want to grab keyboard input, | 872 // If we are not activatable, we don't want to grab keyboard input, |
873 // and webkit will manage our destruction. | 873 // and webkit will manage our destruction. |
874 if (activatable()) { | 874 if (activatable()) { |
875 // Grab all input for the app. If a click lands outside the bounds of the | 875 // Grab all input for the app. If a click lands outside the bounds of the |
876 // popup, WebKit will notice and destroy us. | 876 // popup, WebKit will notice and destroy us. Before doing this we need |
| 877 // to ensure that the the popup is added to the browser's window group, |
| 878 // to allow for the grabs to work correctly. |
| 879 gtk_window_group_add_window(gtk_window_get_group( |
| 880 GTK_WINDOW(gtk_widget_get_toplevel(parent_))), GTK_WINDOW(popup)); |
877 gtk_grab_add(view_.get()); | 881 gtk_grab_add(view_.get()); |
| 882 |
878 // Now grab all of X's input. | 883 // Now grab all of X's input. |
879 gdk_pointer_grab( | 884 gdk_pointer_grab( |
880 parent_->window, | 885 parent_->window, |
881 TRUE, // Only events outside of the window are reported with respect | 886 TRUE, // Only events outside of the window are reported with respect |
882 // to |parent_->window|. | 887 // to |parent_->window|. |
883 static_cast<GdkEventMask>(GDK_BUTTON_PRESS_MASK | | 888 static_cast<GdkEventMask>(GDK_BUTTON_PRESS_MASK | |
884 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK), | 889 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK), |
885 NULL, | 890 NULL, |
886 NULL, | 891 NULL, |
887 GDK_CURRENT_TIME); | 892 GDK_CURRENT_TIME); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 } | 1196 } |
1192 } | 1197 } |
1193 | 1198 |
1194 void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) { | 1199 void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) { |
1195 for (PluginPidMap::iterator i = plugin_pid_map_.find(pid); | 1200 for (PluginPidMap::iterator i = plugin_pid_map_.find(pid); |
1196 i != plugin_pid_map_.end() && i->first == pid; ++i) { | 1201 i != plugin_pid_map_.end() && i->first == pid; ++i) { |
1197 plugin_container_manager_.DestroyPluginContainer(i->second); | 1202 plugin_container_manager_.DestroyPluginContainer(i->second); |
1198 } | 1203 } |
1199 plugin_pid_map_.erase(pid); | 1204 plugin_pid_map_.erase(pid); |
1200 } | 1205 } |
OLD | NEW |