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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 parent_ = parent_host_view->GetNativeView(); | 414 parent_ = parent_host_view->GetNativeView(); |
415 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); | 415 GtkWidget* popup = gtk_window_new(GTK_WINDOW_POPUP); |
416 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); | 416 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); |
417 plugin_container_manager_.set_host_widget(view_.get()); | 417 plugin_container_manager_.set_host_widget(view_.get()); |
418 gtk_container_add(GTK_CONTAINER(popup), view_.get()); | 418 gtk_container_add(GTK_CONTAINER(popup), view_.get()); |
419 | 419 |
420 // If we are not activatable, we don't want to grab keyboard input, | 420 // If we are not activatable, we don't want to grab keyboard input, |
421 // and webkit will manage our destruction. | 421 // and webkit will manage our destruction. |
422 if (activatable()) { | 422 if (activatable()) { |
423 // Grab all input for the app. If a click lands outside the bounds of the | 423 // Grab all input for the app. If a click lands outside the bounds of the |
424 // popup, WebKit will notice and destroy us. | 424 // popup, WebKit will notice and destroy us. Before doing this we need |
| 425 // to ensure that the the popup is added to the browser's window group, |
| 426 // to allow for the grabs to work correctly. |
| 427 gtk_window_group_add_window(gtk_window_get_group( |
| 428 GTK_WINDOW(gtk_widget_get_toplevel(parent_))), GTK_WINDOW(popup)); |
425 gtk_grab_add(view_.get()); | 429 gtk_grab_add(view_.get()); |
| 430 |
426 // Now grab all of X's input. | 431 // Now grab all of X's input. |
427 gdk_pointer_grab( | 432 gdk_pointer_grab( |
428 parent_->window, | 433 parent_->window, |
429 TRUE, // Only events outside of the window are reported with respect | 434 TRUE, // Only events outside of the window are reported with respect |
430 // to |parent_->window|. | 435 // to |parent_->window|. |
431 static_cast<GdkEventMask>(GDK_BUTTON_PRESS_MASK | | 436 static_cast<GdkEventMask>(GDK_BUTTON_PRESS_MASK | |
432 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK), | 437 GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK), |
433 NULL, | 438 NULL, |
434 NULL, | 439 NULL, |
435 GDK_CURRENT_TIME); | 440 GDK_CURRENT_TIME); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 765 } |
761 } | 766 } |
762 | 767 |
763 void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) { | 768 void RenderWidgetHostViewGtk::PluginProcessCrashed(base::ProcessId pid) { |
764 for (PluginPidMap::iterator i = plugin_pid_map_.find(pid); | 769 for (PluginPidMap::iterator i = plugin_pid_map_.find(pid); |
765 i != plugin_pid_map_.end() && i->first == pid; ++i) { | 770 i != plugin_pid_map_.end() && i->first == pid; ++i) { |
766 plugin_container_manager_.DestroyPluginContainer(i->second); | 771 plugin_container_manager_.DestroyPluginContainer(i->second); |
767 } | 772 } |
768 plugin_pid_map_.erase(pid); | 773 plugin_pid_map_.erase(pid); |
769 } | 774 } |
OLD | NEW |