Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.cc

Issue 8561006: GTK: Speculative revert of r109465 to fix right clicking. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix stupid typo Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/tab_contents_view_gtk.h" 9 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h"
10 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h" 10 #include "chrome/browser/tab_contents/web_drag_bookmark_handler_gtk.h"
11 #include "chrome/browser/ui/gtk/constrained_window_gtk.h" 11 #include "chrome/browser/ui/gtk/constrained_window_gtk.h"
12 #include "content/browser/renderer_host/render_view_host.h" 12 #include "content/browser/renderer_host/render_view_host.h"
13 #include "content/browser/renderer_host/render_widget_host_view_gtk.h"
13 #include "content/browser/tab_contents/interstitial_page.h" 14 #include "content/browser/tab_contents/interstitial_page.h"
14 #include "content/browser/tab_contents/tab_contents.h" 15 #include "content/browser/tab_contents/tab_contents.h"
15 #include "ui/base/gtk/gtk_floating_container.h" 16 #include "ui/base/gtk/gtk_floating_container.h"
16 17
17 ChromeTabContentsViewWrapperGtk::ChromeTabContentsViewWrapperGtk() 18 ChromeTabContentsViewWrapperGtk::ChromeTabContentsViewWrapperGtk()
18 : floating_(gtk_floating_container_new()), 19 : floating_(gtk_floating_container_new()),
19 view_(NULL), 20 view_(NULL),
20 constrained_window_(NULL) { 21 constrained_window_(NULL) {
21 gtk_widget_set_name(floating_.get(), "chrome-tab-contents-wrapper-view"); 22 gtk_widget_set_name(floating_.get(), "chrome-tab-contents-wrapper-view");
22 g_signal_connect(floating_.get(), "set-floating-position", 23 g_signal_connect(floating_.get(), "set-floating-position",
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 view_->tab_contents()->render_view_host()->process()->GetListenerByID( 108 view_->tab_contents()->render_view_host()->process()->GetListenerByID(
108 params.custom_context.render_widget_id); 109 params.custom_context.render_widget_id);
109 if (!listener) { 110 if (!listener) {
110 NOTREACHED(); 111 NOTREACHED();
111 return; 112 return;
112 } 113 }
113 view = static_cast<RenderWidgetHost*>(listener)->view(); 114 view = static_cast<RenderWidgetHost*>(listener)->view();
114 } else { 115 } else {
115 view = view_->tab_contents()->GetRenderWidgetHostView(); 116 view = view_->tab_contents()->GetRenderWidgetHostView();
116 } 117 }
117 if (!view) 118 RenderWidgetHostViewGtk* view_gtk =
119 static_cast<RenderWidgetHostViewGtk*>(view);
120 if (!view_gtk)
118 return; 121 return;
119 122
120 context_menu_.reset(new RenderViewContextMenuGtk( 123 context_menu_.reset(new RenderViewContextMenuGtk(
121 view_->tab_contents(), params, GDK_CURRENT_TIME)); 124 view_->tab_contents(), params, view_gtk->last_mouse_down() ?
125 view_gtk->last_mouse_down()->time : GDK_CURRENT_TIME));
122 context_menu_->Init(); 126 context_menu_->Init();
123 127
124 gfx::Rect bounds; 128 gfx::Rect bounds;
125 view_->GetContainerBounds(&bounds); 129 view_->GetContainerBounds(&bounds);
126 gfx::Point point = bounds.origin(); 130 gfx::Point point = bounds.origin();
127 point.Offset(params.x, params.y); 131 point.Offset(params.x, params.y);
128 context_menu_->Popup(point); 132 context_menu_->Popup(point);
129 } 133 }
130 134
131 void ChromeTabContentsViewWrapperGtk::OnSetFloatingPosition( 135 void ChromeTabContentsViewWrapperGtk::OnSetFloatingPosition(
(...skipping 15 matching lines...) Expand all
147 g_value_set_int(&value, child_x); 151 g_value_set_int(&value, child_x);
148 gtk_container_child_set_property(GTK_CONTAINER(floating_container), 152 gtk_container_child_set_property(GTK_CONTAINER(floating_container),
149 widget, "x", &value); 153 widget, "x", &value);
150 154
151 int child_y = std::max((allocation->height - requisition.height) / 2, 0); 155 int child_y = std::max((allocation->height - requisition.height) / 2, 0);
152 g_value_set_int(&value, child_y); 156 g_value_set_int(&value, child_y);
153 gtk_container_child_set_property(GTK_CONTAINER(floating_container), 157 gtk_container_child_set_property(GTK_CONTAINER(floating_container),
154 widget, "y", &value); 158 widget, "y", &value);
155 g_value_unset(&value); 159 g_value_unset(&value);
156 } 160 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698