| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" | 5 #include "chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_shutdown.h" | 7 #include "chrome/browser/browser_shutdown.h" |
| 8 #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu_gtk.h" |
| 9 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" | 9 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" |
| 10 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" | 10 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 gtk_widget_grab_focus(widget); | 90 gtk_widget_grab_focus(widget); |
| 91 *return_value = FALSE; | 91 *return_value = FALSE; |
| 92 return TRUE; | 92 return TRUE; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Let the default TabContentsViewGtk::OnFocus() behaviour run. | 95 // Let the default TabContentsViewGtk::OnFocus() behaviour run. |
| 96 return FALSE; | 96 return FALSE; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ChromeTabContentsViewWrapperGtk::ShowContextMenu( | 99 void ChromeTabContentsViewWrapperGtk::ShowContextMenu( |
| 100 const ContextMenuParams& params) { | 100 const content::ContextMenuParams& params) { |
| 101 // Find out the RenderWidgetHostView that corresponds to the render widget on | 101 // Find out the RenderWidgetHostView that corresponds to the render widget on |
| 102 // which this context menu is showed, so that we can retrieve the last mouse | 102 // which this context menu is showed, so that we can retrieve the last mouse |
| 103 // down event on the render widget and use it as the timestamp of the | 103 // down event on the render widget and use it as the timestamp of the |
| 104 // activation event to show the context menu. | 104 // activation event to show the context menu. |
| 105 RenderWidgetHostView* view = NULL; | 105 RenderWidgetHostView* view = NULL; |
| 106 if (params.custom_context.render_widget_id != | 106 if (params.custom_context.render_widget_id != |
| 107 webkit_glue::CustomContextMenuContext::kCurrentRenderWidget) { | 107 content::CustomContextMenuContext::kCurrentRenderWidget) { |
| 108 IPC::Channel::Listener* listener = | 108 IPC::Channel::Listener* listener = |
| 109 view_->web_contents()->GetRenderProcessHost()->GetListenerByID( | 109 view_->web_contents()->GetRenderProcessHost()->GetListenerByID( |
| 110 params.custom_context.render_widget_id); | 110 params.custom_context.render_widget_id); |
| 111 if (!listener) { | 111 if (!listener) { |
| 112 NOTREACHED(); | 112 NOTREACHED(); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 view = static_cast<RenderWidgetHost*>(listener)->view(); | 115 view = static_cast<RenderWidgetHost*>(listener)->view(); |
| 116 } else { | 116 } else { |
| 117 view = view_->web_contents()->GetRenderWidgetHostView(); | 117 view = view_->web_contents()->GetRenderWidgetHostView(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 147 g_value_set_int(&value, child_x); | 147 g_value_set_int(&value, child_x); |
| 148 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 148 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 149 widget, "x", &value); | 149 widget, "x", &value); |
| 150 | 150 |
| 151 int child_y = std::max((allocation->height - requisition.height) / 2, 0); | 151 int child_y = std::max((allocation->height - requisition.height) / 2, 0); |
| 152 g_value_set_int(&value, child_y); | 152 g_value_set_int(&value, child_y); |
| 153 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 153 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 154 widget, "y", &value); | 154 widget, "y", &value); |
| 155 g_value_unset(&value); | 155 g_value_unset(&value); |
| 156 } | 156 } |
| OLD | NEW |