OLD | NEW |
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" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 context_menu_->Popup(point); | 133 context_menu_->Popup(point); |
134 } | 134 } |
135 | 135 |
136 void ChromeTabContentsViewWrapperGtk::OnSetFloatingPosition( | 136 void ChromeTabContentsViewWrapperGtk::OnSetFloatingPosition( |
137 GtkWidget* floating_container, GtkAllocation* allocation) { | 137 GtkWidget* floating_container, GtkAllocation* allocation) { |
138 if (!constrained_window_) | 138 if (!constrained_window_) |
139 return; | 139 return; |
140 | 140 |
141 // Place each ConstrainedWindow in the center of the view. | 141 // Place each ConstrainedWindow in the center of the view. |
142 GtkWidget* widget = constrained_window_->widget(); | 142 GtkWidget* widget = constrained_window_->widget(); |
143 DCHECK(widget->parent == floating_.get()); | 143 DCHECK(gtk_widget_get_parent(widget) == floating_.get()); |
144 | 144 |
145 GtkRequisition requisition; | 145 GtkRequisition requisition; |
146 gtk_widget_size_request(widget, &requisition); | 146 gtk_widget_size_request(widget, &requisition); |
147 | 147 |
148 GValue value = { 0, }; | 148 GValue value = { 0, }; |
149 g_value_init(&value, G_TYPE_INT); | 149 g_value_init(&value, G_TYPE_INT); |
150 | 150 |
151 int child_x = std::max((allocation->width - requisition.width) / 2, 0); | 151 int child_x = std::max((allocation->width - requisition.width) / 2, 0); |
152 g_value_set_int(&value, child_x); | 152 g_value_set_int(&value, child_x); |
153 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 153 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
154 widget, "x", &value); | 154 widget, "x", &value); |
155 | 155 |
156 int child_y = std::max((allocation->height - requisition.height) / 2, 0); | 156 int child_y = std::max((allocation->height - requisition.height) / 2, 0); |
157 g_value_set_int(&value, child_y); | 157 g_value_set_int(&value, child_y); |
158 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 158 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
159 widget, "y", &value); | 159 widget, "y", &value); |
160 g_value_unset(&value); | 160 g_value_unset(&value); |
161 } | 161 } |
OLD | NEW |