OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 focus_store_.Store(GetNativeView()); | 246 focus_store_.Store(GetNativeView()); |
247 } | 247 } |
248 | 248 |
249 void TabContentsViewGtk::RestoreFocus() { | 249 void TabContentsViewGtk::RestoreFocus() { |
250 if (focus_store_.widget()) | 250 if (focus_store_.widget()) |
251 gtk_widget_grab_focus(focus_store_.widget()); | 251 gtk_widget_grab_focus(focus_store_.widget()); |
252 else | 252 else |
253 SetInitialFocus(); | 253 SetInitialFocus(); |
254 } | 254 } |
255 | 255 |
| 256 void TabContentsViewGtk::GetViewBounds(gfx::Rect* out) const { |
| 257 if (!floating_->window) { |
| 258 out->SetRect(0, 0, requested_size_.width(), requested_size_.height()); |
| 259 return; |
| 260 } |
| 261 int x = 0, y = 0, w, h; |
| 262 gdk_window_get_geometry(floating_->window, &x, &y, &w, &h, NULL); |
| 263 out->SetRect(x, y, w, h); |
| 264 } |
| 265 |
256 void TabContentsViewGtk::SetFocusedWidget(GtkWidget* widget) { | 266 void TabContentsViewGtk::SetFocusedWidget(GtkWidget* widget) { |
257 focus_store_.SetWidget(widget); | 267 focus_store_.SetWidget(widget); |
258 } | 268 } |
259 | 269 |
260 void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { | 270 void TabContentsViewGtk::UpdateDragCursor(WebDragOperation operation) { |
261 drag_dest_->UpdateDragStatus(operation); | 271 drag_dest_->UpdateDragStatus(operation); |
262 } | 272 } |
263 | 273 |
264 void TabContentsViewGtk::GotFocus() { | 274 void TabContentsViewGtk::GotFocus() { |
265 // This is only used in the views FocusManager stuff but it bleeds through | 275 // This is only used in the views FocusManager stuff but it bleeds through |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 g_value_set_int(&value, child_x); | 427 g_value_set_int(&value, child_x); |
418 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 428 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
419 widget, "x", &value); | 429 widget, "x", &value); |
420 | 430 |
421 int child_y = std::max((allocation->height - requisition.height) / 2, 0); | 431 int child_y = std::max((allocation->height - requisition.height) / 2, 0); |
422 g_value_set_int(&value, child_y); | 432 g_value_set_int(&value, child_y); |
423 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 433 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
424 widget, "y", &value); | 434 widget, "y", &value); |
425 g_value_unset(&value); | 435 g_value_unset(&value); |
426 } | 436 } |
OLD | NEW |